Skip to content

Commit

Permalink
Merge pull request #3 from w3c/master
Browse files Browse the repository at this point in the history
Sync up with W3C repo
  • Loading branch information
engelke committed May 11, 2016
2 parents f99441f + 5c52791 commit ab16276
Show file tree
Hide file tree
Showing 151 changed files with 4,912 additions and 804 deletions.
45 changes: 45 additions & 0 deletions IndexedDB/idbcursor_update_index8.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<title>IDBCursor.update() - index - throw InvalidStateError when the cursor is being iterated</title>
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/IndexedDB/#widl-IDBCursor-update-IDBRequest-any-value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<div id="log"></div>
<script>
var db,
t = async_test(),
records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" },
{ pKey: "primaryKey_1", iKey: "indexKey_1" } ];

var open_rq = createdb(t);
open_rq.onupgradeneeded = function(e) {
db = e.target.result;

var objStore = db.createObjectStore("store", { keyPath: "pKey" });
objStore.createIndex("index", "iKey");

for (var i = 0; i < records.length; i++)
objStore.add(records[i]);
};

open_rq.onsuccess = function(e) {
var cursor_rq = db.transaction("store", "readwrite")
.objectStore("store")
.index("index")
.openCursor();

cursor_rq.onsuccess = t.step_func(function(e) {
var cursor = e.target.result;
assert_true(cursor instanceof IDBCursor, "cursor exists");

cursor.continue();
assert_throws("InvalidStateError", function() {
cursor.update({ pKey: "primaryKey_0", iKey: "indexKey_0_updated" });
});

t.done();
});
}
</script>

45 changes: 45 additions & 0 deletions IndexedDB/idbcursor_update_objectstore9.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>IDBCursor.update() - object store - throw InvalidStateError when the cursor is being iterated</title>
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/IndexedDB/#widl-IDBCursor-update-IDBRequest-any-value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<div id="log"></div>
<script>
var db,
t = async_test(),
records = [{ pKey: "primaryKey_0", value: "value_0" },
{ pKey: "primaryKey_1", value: "value_1" }];

var open_rq = createdb(t);
open_rq.onupgradeneeded = function (event) {
db = event.target.result;

var objStore = db.createObjectStore("store", {keyPath : "pKey"});

for (var i = 0; i < records.length; i++) {
objStore.add(records[i]);
}
}

open_rq.onsuccess = function(e) {
var cursor_rq = db.transaction("store", "readwrite")
.objectStore("store")
.openCursor();

cursor_rq.onsuccess = t.step_func(function(event) {
var cursor = event.target.result;
assert_true(cursor instanceof IDBCursor, "cursor exists");

cursor.continue();
assert_throws("InvalidStateError", function() {
cursor.update({ pKey: "primaryKey_0", value: "value_0_updated" });
});

t.done();
});
}
</script>

4 changes: 2 additions & 2 deletions IndexedDB/interfaces.idl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ interface IDBDatabase : EventTarget {
};

interface IDBObjectStore {
readonly attribute DOMString name;
attribute DOMString name;
readonly attribute any keyPath;
readonly attribute DOMStringList indexNames;
readonly attribute IDBTransaction transaction;
Expand All @@ -106,7 +106,7 @@ interface IDBObjectStore {
};

interface IDBIndex {
readonly attribute DOMString name;
attribute DOMString name;
readonly attribute IDBObjectStore objectStore;
readonly attribute any keyPath;
readonly attribute boolean multiEntry;
Expand Down
41 changes: 41 additions & 0 deletions XMLHttpRequest/open-url-multi-window-6.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>XMLHttpRequest: open() in document that is not fully active (but may be active) should throw</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method">
</head>
<body>
<div id="log"></div>
<script>
var test = async_test(),
client,
count = 0,
win = window.open("resources/init.htm");
test.add_cleanup(function() { win.close(); });
function init() {
test.step(function() {
if(0 == count) {
var doc = win.document;
var ifr = document.createElement("iframe");
ifr.onload = function() {
// Again, do things async so we're not doing loads from inside
// load events.
setTimeout(function() {
client = new ifr.contentWindow.XMLHttpRequest();
count++;
// Important to do a normal navigation, not a reload.
win.location.href = "resources/init.htm";
}, 100);
}
doc.body.appendChild(ifr);
} else if(1 == count) {
assert_throws("InvalidStateError", function() { client.open("GET", "...") })
test.done()
}
})
}
</script>
</body>
</html>
13 changes: 12 additions & 1 deletion XMLHttpRequest/resources/init.htm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
<title>support init file</title>
</head>
<body>
<script> parent.init() </script>
<script>
onload = function() {
// Run async, because navigations from inside onload can be a bit weird.
setTimeout(function() {
if (parent != window) {
parent.init()
} else {
opener.init();
}
}, 0);
}
</script>
</body>
</html>
6 changes: 4 additions & 2 deletions compat/webkit-text-fill-color-property-005-ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<style type="text/css">
p {
font-size: 50px;
text-decoration: underline;
color: green;
}
p.underline {
text-decoration: underline;
}
</style>
<div><p>Pass if text underline is green!!!</p></div>
<div><p class="underline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></div>
10 changes: 6 additions & 4 deletions compat/webkit-text-fill-color-property-005.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>webkit-text-fill-color should take effect while rendering text-decoration underline</title>
<title>webkit-text-fill-color should not take effect while rendering text-decoration underline</title>
<link rel="author" title="Jeremy Chen" href="jeremychen@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://compat.spec.whatwg.org/#the-webkit-text-fill-color">
<meta name="assert" content="The color of text-decoration underline should be green">
<link rel="match" href="webkit-text-fill-color-property-005-ref.html">
<style type="text/css">
p {
font-size: 50px;
color: green;
}
p.underline {
text-decoration: underline;
color: red;
-webkit-text-fill-color: green;
-webkit-text-fill-color: red
}
</style>
<div><p>Pass if text underline is green!!!</p></div>
<div><p class="underline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></div>
7 changes: 7 additions & 0 deletions cors/credentials-flag.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ <h1>CORS - Access-Control-Allow-Credentials</h1>
* widthCredentials
*/
// XXX Do some https tests here as well

test(function () {
var client = new XMLHttpRequest()
client.open('GET', CROSSDOMAIN, false)
client.withCredentials = true;
}, 'Setting withCredentials on a sync XHR object should not throw')

async_test(function () {
var id = new Date().getTime() + '_1',
client = new XMLHttpRequest()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!DOCTYPE html>
<!-- Submitted from TestTWF Paris -->
<title>Event phases order</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
Expand All @@ -16,13 +15,12 @@
child.addEventListener('click', this.step_func(function(){ order.push(2) }), false);
parent.addEventListener('click', this.step_func(function(){ order.push(3) }), false);

child.click();
child.dispatchEvent(new Event('click', {bubbles: true}));

assert_array_equals(order, [1, 2, 3]);
}));
}, "Event phases order");
</script>

<div id="parent">
<div id="child"></div>
</div>
<div id="parent">
<div id="child"></div>
</div>
51 changes: 51 additions & 0 deletions dom/events/Event-dispatch-throwing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Throwing in event listeners</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
setup({allow_uncaught_exception:true})

test(function() {
var errorEvents = 0;
window.onerror = this.step_func(function(e) {
assert_equals(typeof e, 'string');
++errorEvents;
});

var element = document.createElement('div');

element.addEventListener('click', function() {
throw new Error('Error from only listener');
});

element.dispatchEvent(new Event('click'));

assert_equals(errorEvents, 1);
}, "Throwing in event listener with a single listeners");

test(function() {
var errorEvents = 0;
window.onerror = this.step_func(function(e) {
assert_equals(typeof e, 'string');
++errorEvents;
});

var element = document.createElement('div');

var secondCalled = false;

element.addEventListener('click', function() {
throw new Error('Error from first listener');
});
element.addEventListener('click', this.step_func(function() {
secondCalled = true;
}), false);

element.dispatchEvent(new Event('click'));

assert_equals(errorEvents, 1);
assert_true(secondCalled);
}, "Throwing in event listener with multiple listeners");
</script>
File renamed without changes.
20 changes: 20 additions & 0 deletions dom/nodes/Element-classlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,26 @@
assert_equals(secondelem.classList[0],'foo');
assert_equals(secondelem.classList[1],'bar');
}, 'classList must have [PutForwards=value]');
test(function () {
var foo = document.createElement('div');
foo.className = 'a';
foo.classList.replace('token1', 'token2');

assert_equals(foo.className, 'a');

foo.classList.replace('a', 'b');
assert_equals(foo.className, 'b');

assert_throws('SYNTAX_ERR', function () { foo.classList.replace('t with space', '') });
assert_throws('INVALID_CHARACTER_ERR', function () { foo.classList.replace('t with space', 'foo') });
assert_throws('SYNTAX_ERR', function () { foo.classList.replace('', 'foo') });
}, 'classList.replace should work');

test(function() {
var foo = document.createElement('div');
assert_throws(new TypeError(),
function() { foo.classList.supports('hello') });
}, 'classList.supports should throw');
</script>
</head>
<body>
Expand Down
Loading

0 comments on commit ab16276

Please sign in to comment.