diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 349b3b074c07..28d3c7011aff 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -8983,10 +8983,6 @@ "path": "IndexedDB/index_sort_order.htm", "url": "/IndexedDB/index_sort_order.htm" }, - { - "path": "IndexedDB/interfaces.htm", - "url": "/IndexedDB/interfaces.htm" - }, { "path": "IndexedDB/interfaces.html", "url": "/IndexedDB/interfaces.html" @@ -10759,6 +10755,10 @@ "path": "dom/nodes/Text-constructor.html", "url": "/dom/nodes/Text-constructor.html" }, + { + "path": "dom/nodes/Text-splitText.html", + "url": "/dom/nodes/Text-splitText.html" + }, { "path": "dom/nodes/attributes.html", "url": "/dom/nodes/attributes.html" @@ -11803,6 +11803,10 @@ "path": "html/dom/documents/dom-tree-accessors/document.title-08.html", "url": "/html/dom/documents/dom-tree-accessors/document.title-08.html" }, + { + "path": "html/dom/documents/dom-tree-accessors/document.title-09.html", + "url": "/html/dom/documents/dom-tree-accessors/document.title-09.html" + }, { "path": "html/dom/documents/dom-tree-accessors/nameditem-01.html", "url": "/html/dom/documents/dom-tree-accessors/nameditem-01.html" @@ -16896,8 +16900,8 @@ "url": "/web-animations/animation-node/idlharness.html" }, { - "path": "web-animations/animation-timeline/animation-timeline.html", - "url": "/web-animations/animation-timeline/animation-timeline.html" + "path": "web-animations/animation-timeline/document-timeline.html", + "url": "/web-animations/animation-timeline/document-timeline.html" }, { "path": "web-animations/animation-timeline/idlharness.html", @@ -24821,7 +24825,7 @@ } ] }, - "rev": "20aef05e164be1ccbbd8f66192f01e778b5e5c18", + "rev": "40a9c4e9e4f99a738cd1a7602066c5e84d1b90b5", "url_base": "/", "version": 2 } \ No newline at end of file diff --git a/testing/web-platform/meta/mozilla-sync b/testing/web-platform/meta/mozilla-sync index af73402b0de1..a3063f835a9f 100644 --- a/testing/web-platform/meta/mozilla-sync +++ b/testing/web-platform/meta/mozilla-sync @@ -1 +1 @@ -821cd0c3a55889f05c04ed9b6c12c810cd1a6c0f \ No newline at end of file +eb7ac376c982330bc85c58e68fffc55aabef604c \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm index 20b4890382da..10c04b6a8a73 100644 --- a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm @@ -11,6 +11,9 @@ - - - - - -
diff --git a/testing/web-platform/tests/battery-status/battery-interface.js b/testing/web-platform/tests/battery-status/battery-interface.js index 7542dc965fbc..7aac89381297 100644 --- a/testing/web-platform/tests/battery-status/battery-interface.js +++ b/testing/web-platform/tests/battery-status/battery-interface.js @@ -144,13 +144,6 @@ assert_equals(battery.onchargingchange, null, desc); }, 'onchargingchange: treat array as null'); - test(function() { - var desc = 'onchargingchange did not treat noncallable host object as null'; - battery.onchargingchange = function() {}; - battery.onchargingchange = Node; - assert_equals(battery.onchargingchange, null, desc); - }, 'onchargingchange: treat non-callable host object as null'); - // attribute EventHandler onchargingtimechange; test(function() { @@ -214,13 +207,6 @@ assert_equals(battery.onchargingtimechange, null, desc); }, 'onchargingtimechange: treat array as null'); - test(function() { - var desc = 'onchargingtimechange did not treat noncallable host object as null'; - battery.onchargingtimechange = function() {}; - battery.onchargingtimechange = Node; - assert_equals(battery.onchargingtimechange, null, desc); - }, 'onchargingtimechange: treat non-callable host object as null'); - // attribute EventHandler ondischargingtimechange; test(function() { @@ -284,13 +270,6 @@ assert_equals(battery.ondischargingtimechange, null, desc); }, 'ondischargingtimechange: treat array as null'); - test(function() { - var desc = 'ondischargingtimechange did not treat noncallable host object as null'; - battery.ondischargingtimechange = function() {}; - battery.ondischargingtimechange = Node; - assert_equals(battery.ondischargingtimechange, null, desc); - }, 'ondischargingtimechange: treat non-callable host object as null'); - // attribute EventHandler onlevelchange; test(function() { @@ -354,13 +333,6 @@ assert_equals(battery.onlevelchange, null, desc); }, 'onlevelchange: treat array as null'); - test(function() { - var desc = 'onlevelchange did not treat noncallable host object as null'; - battery.onlevelchange = function() {}; - battery.onlevelchange = Node; - assert_equals(battery.onlevelchange, null, desc); - }, 'onlevelchange: treat non-callable host object as null'); - done(); }, function () {}); diff --git a/testing/web-platform/tests/dom/nodes/CharacterData-appendData.html b/testing/web-platform/tests/dom/nodes/CharacterData-appendData.html index 464a119a03df..d754218bfb1f 100644 --- a/testing/web-platform/tests/dom/nodes/CharacterData-appendData.html +++ b/testing/web-platform/tests/dom/nodes/CharacterData-appendData.html @@ -24,6 +24,14 @@ function testNode(create, type) { assert_equals(node.data, "test") }, type + ".appendData('')") + test(function() { + var node = create() + assert_equals(node.data, "test") + node.appendData(", append more 資料,測試資料"); + assert_equals(node.data, "test, append more 資料,測試資料"); + assert_equals(node.length, 25); + }, type + ".appendData(non-ASCII)") + test(function() { var node = create() assert_equals(node.data, "test") diff --git a/testing/web-platform/tests/dom/nodes/CharacterData-deleteData.html b/testing/web-platform/tests/dom/nodes/CharacterData-deleteData.html index 25654bafedc6..ef31a79dcf48 100644 --- a/testing/web-platform/tests/dom/nodes/CharacterData-deleteData.html +++ b/testing/web-platform/tests/dom/nodes/CharacterData-deleteData.html @@ -7,22 +7,79 @@
diff --git a/testing/web-platform/tests/dom/nodes/CharacterData-insertData.html b/testing/web-platform/tests/dom/nodes/CharacterData-insertData.html index a1f1b390c0ed..983e791dca2d 100644 --- a/testing/web-platform/tests/dom/nodes/CharacterData-insertData.html +++ b/testing/web-platform/tests/dom/nodes/CharacterData-insertData.html @@ -7,22 +7,74 @@
diff --git a/testing/web-platform/tests/dom/nodes/Text-splitText.html b/testing/web-platform/tests/dom/nodes/Text-splitText.html new file mode 100644 index 000000000000..aec1cee52ed5 --- /dev/null +++ b/testing/web-platform/tests/dom/nodes/Text-splitText.html @@ -0,0 +1,53 @@ + + +Text.splitText() + + + +
+ diff --git a/testing/web-platform/tests/encoding/api-invalid-label.html b/testing/web-platform/tests/encoding/api-invalid-label.html index 04f939a789d8..2f2fd6eb0c68 100644 --- a/testing/web-platform/tests/encoding/api-invalid-label.html +++ b/testing/web-platform/tests/encoding/api-invalid-label.html @@ -2,13 +2,32 @@ Encoding API: invalid label + diff --git a/testing/web-platform/tests/encoding/resources/text-plain-charset.py b/testing/web-platform/tests/encoding/resources/text-plain-charset.py new file mode 100644 index 000000000000..a1c07e70189b --- /dev/null +++ b/testing/web-platform/tests/encoding/resources/text-plain-charset.py @@ -0,0 +1,3 @@ +def main(request, response): + response.headers.set("Content-Type", "text/plain;charset=" + request.GET.first("label")) + response.content = "hello encoding" diff --git a/testing/web-platform/tests/encoding/single-byte-decoder.html b/testing/web-platform/tests/encoding/single-byte-decoder.html index 62e34cfb3069..eb463e1add8e 100644 --- a/testing/web-platform/tests/encoding/single-byte-decoder.html +++ b/testing/web-platform/tests/encoding/single-byte-decoder.html @@ -86,7 +86,7 @@ async_test(function(t) { var frame = document.createElement("iframe"), name = compatibility_names[encoding.name] || encoding.name; - frame.src = "resources/single-byte-raw.py?label=" + label + frame.src = "resources/text-plain-charset.py?label=" + label frame.onload = t.step_func_done(function() { assert_equals(frame.contentDocument.characterSet, name) assert_equals(frame.contentDocument.inputEncoding, name) diff --git a/testing/web-platform/tests/encoding/textdecoder-labels.html b/testing/web-platform/tests/encoding/textdecoder-labels.html index 5a56ff9cb6db..1f3202c963eb 100644 --- a/testing/web-platform/tests/encoding/textdecoder-labels.html +++ b/testing/web-platform/tests/encoding/textdecoder-labels.html @@ -4,22 +4,33 @@ diff --git a/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.title-09.html b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.title-09.html new file mode 100644 index 000000000000..731d78cc14f3 --- /dev/null +++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.title-09.html @@ -0,0 +1,60 @@ + + + + +
+ diff --git a/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/nameditem-06.html b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/nameditem-06.html index 1ff039915e1b..843acbd8dad1 100644 --- a/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/nameditem-06.html +++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/nameditem-06.html @@ -63,9 +63,7 @@ test(function() { assert_equals(img2.id, "test4"); assert_false("test4" in document, '"test4" in document should be false'); - var collection = document.test4; - assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection"); - assert_array_equals(collection, [img1, img2]); + assert_equals(document.test4, undefined); }, "If there are two imgs, nothing should be returned. (id)"); test(function() { diff --git a/testing/web-platform/tests/html/dom/reflection.js b/testing/web-platform/tests/html/dom/reflection.js index 4010d7e30480..7bd41d516225 100644 --- a/testing/web-platform/tests/html/dom/reflection.js +++ b/testing/web-platform/tests/html/dom/reflection.js @@ -373,7 +373,7 @@ ReflectionTests.typeMap = { {toString:function() {return 2;}, valueOf: null}, {valueOf:function() {return 3;}}], "domExpected": function(val) { - var parsed = ReflectionTests.parseNonneg(val + ""); + var parsed = ReflectionTests.parseNonneg(String(val)); if (parsed === false || parsed > maxInt || parsed < minInt) { return null; } @@ -409,7 +409,7 @@ ReflectionTests.typeMap = { {toString:function() {return 2;}, valueOf: null}, {valueOf:function() {return 3;}}], "domExpected": function(val) { - var parsed = ReflectionTests.parseNonneg(val + ""); + var parsed = ReflectionTests.parseNonneg(String(val)); // Note maxInt, not maxUnsigned. if (parsed === false || parsed < 0 || parsed > maxInt) { return null; @@ -450,7 +450,7 @@ ReflectionTests.typeMap = { {toString:function() {return 2;}, valueOf: null}, {valueOf:function() {return 3;}}], "domExpected": function(val) { - var parsed = ReflectionTests.parseNonneg(val + ""); + var parsed = ReflectionTests.parseNonneg(String(val)); // Note maxInt, not maxUnsigned. if (parsed === false || parsed < 1 || parsed > maxInt) { return null; @@ -696,7 +696,7 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) { } try { domObj.setAttribute(domName, domTests[i]); - ReflectionHarness.test(domObj.getAttribute(domName), domTests[i] + "", "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by getAttribute()"); + ReflectionHarness.test(domObj.getAttribute(domName), String(domTests[i]), "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by getAttribute()"); ReflectionHarness.test(idlObj[idlName], domExpected[i], "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by IDL get"); if (ReflectionHarness.catchUnexpectedExceptions) { ReflectionHarness.success(); diff --git a/testing/web-platform/tests/html/semantics/interfaces.html b/testing/web-platform/tests/html/semantics/interfaces.html index d3b2a23e27cd..c08fea82e523 100644 --- a/testing/web-platform/tests/html/semantics/interfaces.html +++ b/testing/web-platform/tests/html/semantics/interfaces.html @@ -9,22 +9,25 @@
diff --git a/testing/web-platform/tests/html/semantics/interfaces.js b/testing/web-platform/tests/html/semantics/interfaces.js index 5f5d2d908fab..3609e36bf483 100644 --- a/testing/web-platform/tests/html/semantics/interfaces.js +++ b/testing/web-platform/tests/html/semantics/interfaces.js @@ -134,5 +134,6 @@ var elements = [ ["dialog", "Dialog"], ["figcaption", ""], ["summary", ""], - ["track", "Track"] + ["track", "Track"], + ["foo", "Unknown"] ]; diff --git a/testing/web-platform/tests/media-source/mediasource-config-changes.js b/testing/web-platform/tests/media-source/mediasource-config-changes.js index 586e25f2b305..2ccc1e1a05d1 100644 --- a/testing/web-platform/tests/media-source/mediasource-config-changes.js +++ b/testing/web-platform/tests/media-source/mediasource-config-changes.js @@ -97,5 +97,5 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description) }); }); }); - }, description, { timeout: 10000 } ); + }, description); }; diff --git a/testing/web-platform/tests/media-source/mediasource-duration.html b/testing/web-platform/tests/media-source/mediasource-duration.html index ca6b25de73fc..c0a33f3421c8 100644 --- a/testing/web-platform/tests/media-source/mediasource-duration.html +++ b/testing/web-platform/tests/media-source/mediasource-duration.html @@ -211,7 +211,7 @@ test.done(); }); }); - }, 'Test setting same duration multiple times does not fire duplicate durationchange', {timeout: 2500}); + }, 'Test setting same duration multiple times does not fire duplicate durationchange'); diff --git a/testing/web-platform/tests/media-source/mediasource-getvideoplaybackquality.html b/testing/web-platform/tests/media-source/mediasource-getvideoplaybackquality.html index d813d631f955..1c71968fc159 100644 --- a/testing/web-platform/tests/media-source/mediasource-getvideoplaybackquality.html +++ b/testing/web-platform/tests/media-source/mediasource-getvideoplaybackquality.html @@ -65,7 +65,7 @@ assert_greater_than(timeUpdateCount, 2, "timeUpdateCount"); test.done(); }); - }, "Test HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API", {timeout: 5000}); + }, "Test HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API"); diff --git a/testing/web-platform/tests/media-source/mediasource-play.html b/testing/web-platform/tests/media-source/mediasource-play.html index 73153462d770..928aa72f3317 100644 --- a/testing/web-platform/tests/media-source/mediasource-play.html +++ b/testing/web-platform/tests/media-source/mediasource-play.html @@ -38,7 +38,7 @@ mediaSource.endOfStream(); mediaElement.play(); }); - }, "Test normal playback case with MediaSource API", {timeout: 5000}); + }, "Test normal playback case with MediaSource API"); diff --git a/testing/web-platform/tests/media-source/mediasource-seek-during-pending-seek.html b/testing/web-platform/tests/media-source/mediasource-seek-during-pending-seek.html index b12903289dcc..4b415a6df2b5 100644 --- a/testing/web-platform/tests/media-source/mediasource-seek-during-pending-seek.html +++ b/testing/web-platform/tests/media-source/mediasource-seek-during-pending-seek.html @@ -63,7 +63,7 @@ test.done(); }); - }, 'Test seeking to a new location before transitioning beyond HAVE_METADATA.', {timeout: 10000} ); + }, 'Test seeking to a new location before transitioning beyond HAVE_METADATA.'); mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { @@ -136,7 +136,7 @@ assert_greater_than(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA, 'Greater than HAVE_CURRENT_DATA'); test.done(); }); - }, 'Test seeking to a new location during a pending seek.', {timeout: 10000} ); + }, 'Test seeking to a new location during a pending seek.'); diff --git a/testing/web-platform/tests/media-source/mediasource-util.js b/testing/web-platform/tests/media-source/mediasource-util.js index de1560e17ba0..0271fc5caee7 100644 --- a/testing/web-platform/tests/media-source/mediasource-util.js +++ b/testing/web-platform/tests/media-source/mediasource-util.js @@ -1,6 +1,4 @@ (function(window) { - setup({ timeout: 12000 }); - var SEGMENT_INFO_LIST = [ { url: 'mp4/test.mp4', diff --git a/testing/web-platform/tests/resources/idlharness.js b/testing/web-platform/tests/resources/idlharness.js index 170b5835392d..b8a87c669900 100644 --- a/testing/web-platform/tests/resources/idlharness.js +++ b/testing/web-platform/tests/resources/idlharness.js @@ -555,8 +555,8 @@ function IdlInterface(obj, is_callback) { this.members = obj.members.map(function(m){return new IdlInterfaceMember(m); }); if (this.has_extended_attribute("Unforgeable")) { this.members - .filter(m => !m["static"] && (m.type == "attribute" || m.type == "operation")) - .forEach(m => m.isUnforgeable = true); + .filter(function(m) { return !m["static"] && (m.type == "attribute" || m.type == "operation"); }) + .forEach(function(m) { return m.isUnforgeable = true; }); } /** diff --git a/testing/web-platform/tests/resources/testharness.js b/testing/web-platform/tests/resources/testharness.js index 67b0f406c08f..981938cbc23d 100644 --- a/testing/web-platform/tests/resources/testharness.js +++ b/testing/web-platform/tests/resources/testharness.js @@ -368,8 +368,20 @@ policies and contribution forms [3]. self.addEventListener("message", function(event) { if (event.data.type && event.data.type === "connect") { - this_obj._add_message_port(event.ports[0]); - event.ports[0].start(); + if (event.ports && event.ports[0]) { + // If a MessageChannel was passed, then use it to + // send results back to the main window. This + // allows the tests to work even if the browser + // does not fully support MessageEvent.source in + // ServiceWorkers yet. + this_obj._add_message_port(event.ports[0]); + event.ports[0].start(); + } else { + // If there is no MessageChannel, then attempt to + // use the MessageEvent.source to send results + // back to the main window. + this_obj._add_message_port(event.source); + } } }); @@ -1476,15 +1488,24 @@ policies and contribution forms [3]. var message_port; if (is_service_worker(worker)) { - // The ServiceWorker's implicit MessagePort is currently not - // reliably accessible from the ServiceWorkerGlobalScope due to - // Blink setting MessageEvent.source to null for messages sent via - // ServiceWorker.postMessage(). Until that's resolved, create an - // explicit MessageChannel and pass one end to the worker. - var message_channel = new MessageChannel(); - message_port = message_channel.port1; - message_port.start(); - worker.postMessage({type: "connect"}, [message_channel.port2]); + if (window.MessageChannel) { + // The ServiceWorker's implicit MessagePort is currently not + // reliably accessible from the ServiceWorkerGlobalScope due to + // Blink setting MessageEvent.source to null for messages sent + // via ServiceWorker.postMessage(). Until that's resolved, + // create an explicit MessageChannel and pass one end to the + // worker. + var message_channel = new MessageChannel(); + message_port = message_channel.port1; + message_port.start(); + worker.postMessage({type: "connect"}, [message_channel.port2]); + } else { + // If MessageChannel is not available, then try the + // ServiceWorker.postMessage() approach using MessageEvent.source + // on the other end. + message_port = navigator.serviceWorker; + worker.postMessage({type: "connect"}); + } } else if (is_shared_worker(worker)) { message_port = worker.port; } else { diff --git a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-add.js b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-add.js index 3e827382bd14..49b8db4cd710 100644 --- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-add.js +++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-add.js @@ -22,12 +22,12 @@ cache_test(function(cache) { cache_test(function(cache) { return assert_promise_rejects( cache.add('javascript://this-is-not-http-mmkay'), - 'NetworkError', - 'Cache.add should throw a NetworkError for non-HTTP/HTTPS URLs.'); + new TypeError(), + 'Cache.add should throw a TypeError for non-HTTP/HTTPS URLs.'); }, 'Cache.add called with non-HTTP/HTTPS URL'); cache_test(function(cache) { - var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'}); + var request = new Request('../resources/simple.txt'); return cache.add(request) .then(function(result) { assert_equals(result, undefined, @@ -36,28 +36,18 @@ cache_test(function(cache) { }, 'Cache.add called with Request object'); cache_test(function(cache) { - var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'}); - return request.text() - .then(function() { - assert_false(request.bodyUsed); - }) - .then(function() { - return cache.add(request); - }); - }, 'Cache.add called with Request object with a used body'); - -cache_test(function(cache) { - var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'}); + var request = new Request('../resources/simple.txt'); return cache.add(request) .then(function(result) { assert_equals(result, undefined, 'Cache.add should resolve with undefined on success.'); }) .then(function() { - return assert_promise_rejects( - cache.add(request), - new TypeError(), - 'Cache.add should throw TypeError if same request is added twice.'); + return cache.add(request); + }) + .then(function(result) { + assert_equals(result, undefined, + 'Cache.add should resolve with undefined on success.'); }); }, 'Cache.add called twice with the same Request object'); @@ -137,8 +127,8 @@ cache_test(function(cache) { var request = new Request('../resources/simple.txt'); return assert_promise_rejects( cache.addAll([request, request]), - new TypeError(), - 'Cache.addAll should throw TypeError if the same request is added ' + + 'InvalidStateError', + 'Cache.addAll should throw InvalidStateError if the same request is added ' + 'twice.'); }, 'Cache.addAll called with the same Request object specified twice'); diff --git a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-delete.js b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-delete.js index 36ca8473164c..75a474c2b2c9 100644 --- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-delete.js +++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-delete.js @@ -43,8 +43,8 @@ cache_test(function(cache) { }, 'Cache.delete called with a string URL'); cache_test(function(cache) { - var request = new Request(test_url, { method: 'POST', body: 'Abc' }); - return cache.put(request.clone(), new_test_response()) + var request = new Request(test_url); + return cache.put(request, new_test_response()) .then(function() { return cache.delete(request); }) @@ -52,33 +52,9 @@ cache_test(function(cache) { assert_true(result, 'Cache.delete should resolve with "true" if an entry ' + 'was successfully deleted.'); - assert_false(request.bodyUsed, - 'Cache.delete should not consume request body.'); }); }, 'Cache.delete called with a Request object'); -cache_test(function(cache) { - var request = new Request(test_url, { method: 'POST', body: 'Abc' }); - return cache.put(request.clone(), new_test_response()) - .then(function() { - return request.text(); - }) - .then(function() { - assert_true(request.bodyUsed, - '[https://fetch.spec.whatwg.org/#body-mixin] ' + - 'Request.bodyUsed should be true after text() method ' + - 'resolves.'); - }) - .then(function() { - return cache.delete(request); - }) - .then(function(result) { - assert_true(result, - 'Cache.delete should resolve with "true" if an entry ' + - 'was successfully deleted.'); - }); - }, 'Cache.delete with a Request object containing used body'); - cache_test(function(cache) { return cache.delete(test_url) .then(function(result) { diff --git a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-match.js b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-match.js index 4a027b6f1653..8d3e5ee68599 100644 --- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-match.js +++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-match.js @@ -103,14 +103,6 @@ var vary_entries = [ request: new Request('http://example.com/c'), response: new Response('', {headers: {'Vary': 'Cookies'}}) - }, - - { - name: 'vary_wildcard', - request: new Request('http://example.com/c', - {headers: {'Cookies': 'x', 'X-Key': '1'}}), - response: new Response('', - {headers: {'Vary': '*'}}) } ]; @@ -181,32 +173,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) { }); }, 'Cache.match with new Request'); -cache_test(function(cache) { - var request = new Request('https://example.com/foo', { - method: 'POST', - body: 'Hello world!' - }); - var response = new Response('Booyah!', { - status: 200, - headers: {'Content-Type': 'text/plain'} - }); - - return cache.put(request.clone(), response.clone()) - .then(function() { - assert_false( - request.bodyUsed, - '[https://fetch.spec.whatwg.org/#concept-body-used-flag] ' + - 'Request.bodyUsed flag should be initially false.'); - }) - .then(function() { - return cache.match(request); - }) - .then(function(result) { - assert_false(request.bodyUsed, - 'Cache.match should not consume Request body.'); - }); - }, 'Cache.match with Request containing non-empty body'); - prepopulated_cache_test(simple_entries, function(cache, entries) { return cache.matchAll(entries.a.request, {ignoreSearch: true}) @@ -337,7 +303,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) { assert_array_equivalent( result, [ - entries.vary_wildcard.response, entries.vary_cookie_absent.response ], 'Cache.matchAll should exclude matches if a vary header is ' + @@ -354,7 +319,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) { assert_array_equivalent( result, [ - entries.vary_wildcard.response ], 'Cache.matchAll should exclude matches if a vary header is ' + 'missing in the cached request, but is present in the query ' + @@ -381,7 +345,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) { assert_object_in_array( result, [ - entries.vary_wildcard.response, entries.vary_cookie_absent.response ], 'Cache.match should honor "Vary" header.'); @@ -398,7 +361,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) { entries.vary_cookie_is_cookie.response, entries.vary_cookie_is_good.response, entries.vary_cookie_absent.response, - entries.vary_wildcard.response ], 'Cache.matchAll should honor "ignoreVary" parameter.'); }); @@ -464,6 +426,15 @@ cache_test(function(cache) { }); }, 'Cache.match invoked multiple times for the same Request/Response'); +prepopulated_cache_test(simple_entries, function(cache, entries) { + var request = new Request(entries.a.request, { method: 'POST' }); + return cache.match(request) + .then(function(result) { + assert_equals(result, undefined, + 'Cache.match should not find a match'); + }); + }, 'Cache.match with POST Request'); + // Helpers --- // Run |test_function| with a Cache object as its only parameter. Prior to the diff --git a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-put.js b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-put.js index ec1617f04e9a..eeedf80eb4b5 100644 --- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-put.js +++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-put.js @@ -67,29 +67,6 @@ cache_test(function(cache) { }); }, 'Cache.put with Response without a body'); -cache_test(function(cache) { - var request = new Request(test_url, { - method: 'POST', - body: 'Hello' - }); - var response = new Response(test_body); - assert_false(request.bodyUsed, - '[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' + - 'Request.bodyUsed should be initially false.'); - return cache.put(request, response.clone()) - .then(function() { - assert_true(request.bodyUsed, - 'Cache.put should consume Request body.'); - }) - .then(function() { - return cache.match(request); - }) - .then(function(result) { - assert_object_equals(result, response, - 'Cache.put should store response body.'); - }); - }, 'Cache.put with Request containing a body'); - cache_test(function(cache) { var request = new Request(test_url); var response = new Response(test_body); @@ -294,18 +271,11 @@ cache_test(function(cache) { cache_test(function(cache) { var request = new Request(test_url, {method: 'POST', body: test_body}); - assert_false(request.bodyUsed, - '[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' + - 'Request.bodyUsed should be initially false.'); - var copy = new Request(request); - assert_true(request.bodyUsed, - '[https://fetch.spec.whatwg.org/#dom-request] ' + - 'Request constructor should set input\'s used flag.'); return assert_promise_rejects( cache.put(request, new Response(test_body)), new TypeError(), - 'Cache.put should throw a TypeError for a request with used body.'); - }, 'Cache.put with a used request body'); + 'Cache.put should throw a TypeError for a POST request.'); + }, 'Cache.put with a POST request'); cache_test(function(cache) { var response = new Response(test_body); @@ -313,12 +283,35 @@ cache_test(function(cache) { '[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' + 'Response.bodyUsed should be initially false.'); return response.text().then(function() { - assert_false( + assert_true( response.bodyUsed, '[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' + - 'The text() method should not set "body passed" flag.'); - return cache.put(new Request(test_url), response); - }); + 'The text() method should set "body used" flag.'); + return assert_promise_rejects( + cache.put(new Request(test_url), response), + new TypeError, + '[https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-put] ' + + 'Cache put should reject with TypeError when Response ' + + 'body is already used.'); + }); }, 'Cache.put with a used response body'); +cache_test(function(cache) { + return assert_promise_rejects( + cache.put(new Request(test_url), + new Response(test_body, { headers: { VARY: '*' }})), + new TypeError(), + 'Cache.put should reject VARY:* Responses with a TypeError.'); + }, 'Cache.put with a VARY:* Response'); + +cache_test(function(cache) { + return assert_promise_rejects( + cache.put(new Request(test_url), + new Response(test_body, + { headers: { VARY: 'Accept-Language,*' }})), + new TypeError(), + 'Cache.put should reject Responses with an embedded VARY:* with a ' + + 'TypeError.'); + }, 'Cache.put with an embedded VARY:* Response'); + done(); diff --git a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage-match.js b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage-match.js index 06b2888e891c..0de85146a6a7 100644 --- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage-match.js +++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage-match.js @@ -111,8 +111,11 @@ promise_test(function(test) { return self.caches.match(transaction.request, {cacheName: 'foo'}); }) .then(function(response) { - assert_equals(response, undefined, - 'The response should not be found.'); + assert_unreached('The match with bad cache name should reject.'); + }) + .catch(function(err) { + assert_equals(err.name, 'NotFoundError', + 'The match should reject with NotFoundError.'); return self.caches.has('foo'); }) .then(function(has_foo) { diff --git a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage.js b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage.js index cb8e0483b221..a8d4e7e61de4 100644 --- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage.js +++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage.js @@ -106,6 +106,7 @@ promise_test(function(t) { promise_test(function(t) { var cache_name = 'cache-storage/open'; + var url = '../resources/simple.txt'; var cache; return self.caches.delete(cache_name) .then(function() { @@ -115,21 +116,26 @@ promise_test(function(t) { cache = result; }) .then(function() { - return self.caches.open(cache_name); - }) - .then(function(result) { - assert_equals(result, cache, - 'CacheStorage.open should return the named Cache ' + - 'object if it exists.'); + return cache.add('../resources/simple.txt'); }) .then(function() { return self.caches.open(cache_name); }) .then(function(result) { - assert_equals(result, cache, - 'CacheStorage.open should return the same ' + - 'instance of an existing Cache object.'); - }); + assert_true(result instanceof Cache, + 'CacheStorage.open should return a Cache object'); + assert_not_equals(result, cache, + 'CacheStorage.open should return a new Cache ' + + 'object each time its called.'); + return Promise.all([cache.keys(), result.keys()]); + }) + .then(function(results) { + var expected_urls = results[0].map(function(r) { return r.url }); + var actual_urls = results[1].map(function(r) { return r.url }); + assert_array_equals(actual_urls, expected_urls, + 'CacheStorage.open should return a new Cache ' + + 'object for the same backing store.'); + }) }, 'CacheStorage.open with existing cache'); promise_test(function(t) { diff --git a/testing/web-platform/tests/service-workers/cache-storage/window/sandboxed-iframes.https.html b/testing/web-platform/tests/service-workers/cache-storage/window/sandboxed-iframes.https.html index aa8613ec77db..de70db4e1371 100644 --- a/testing/web-platform/tests/service-workers/cache-storage/window/sandboxed-iframes.https.html +++ b/testing/web-platform/tests/service-workers/cache-storage/window/sandboxed-iframes.https.html @@ -23,7 +23,7 @@ function wait_for_message(id) { self.addEventListener('message', function listener(e) { if (e.data.id === id) { resolve(e.data); - self.removeEventListener(listener); + self.removeEventListener('message', listener); } }); }); diff --git a/testing/web-platform/tests/web-animations/animation-timeline/animation-timeline.html b/testing/web-platform/tests/web-animations/animation-timeline/document-timeline.html similarity index 98% rename from testing/web-platform/tests/web-animations/animation-timeline/animation-timeline.html rename to testing/web-platform/tests/web-animations/animation-timeline/document-timeline.html index edb0c84553ed..e7ab1687a148 100644 --- a/testing/web-platform/tests/web-animations/animation-timeline/animation-timeline.html +++ b/testing/web-platform/tests/web-animations/animation-timeline/document-timeline.html @@ -1,6 +1,6 @@ -Web Animations API: AnimationTimeline tests +Web Animations API: DocumentTimeline tests
diff --git a/testing/web-platform/tests/web-animations/animation-timeline/idlharness.html b/testing/web-platform/tests/web-animations/animation-timeline/idlharness.html index 440ebb4e0e70..9a489086a171 100644 --- a/testing/web-platform/tests/web-animations/animation-timeline/idlharness.html +++ b/testing/web-platform/tests/web-animations/animation-timeline/idlharness.html @@ -1,15 +1,18 @@ -Web Animations API: AnimationTimeline tests +Web Animations API: DocumentTimeline tests
-
diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html index 767693da02e3..d65695632bc1 100644 --- a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html @@ -12,23 +12,15 @@ close();
- - diff --git a/testing/web-platform/tests/workers/support/WorkerTerminate.js b/testing/web-platform/tests/workers/support/WorkerTerminate.js index 03e028746da6..7c99e7ec5605 100644 --- a/testing/web-platform/tests/workers/support/WorkerTerminate.js +++ b/testing/web-platform/tests/workers/support/WorkerTerminate.js @@ -2,9 +2,9 @@ onmessage = function(evt) { for (var i=0; true; i++) { - if (i%1000 == 1) + if (i%1000 == 0) { postMessage(i); } } -} \ No newline at end of file +}