diff options
Diffstat (limited to 'testing/web-platform')
9 files changed, 132 insertions, 37 deletions
diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index ca574833b..3c7df67fa 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -38674,6 +38674,12 @@ "url": "/html/webappapis/idle-callbacks/callback-multiple-calls.html" } ], + "html/webappapis/idle-callbacks/callback-suspended.html": [ + { + "path": "html/webappapis/idle-callbacks/callback-suspended.html", + "url": "/html/webappapis/idle-callbacks/callback-suspended.html" + } + ], "html/webappapis/idle-callbacks/callback-timeout.html": [ { "path": "html/webappapis/idle-callbacks/callback-timeout.html", diff --git a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini index d62b521c5..0d489b03d 100644 --- a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini +++ b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini @@ -12,10 +12,6 @@ expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 - [If the event's initialized flag is not set, an InvalidStateError must be thrown (FocusEvent).] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - [If the event's initialized flag is not set, an InvalidStateError must be thrown (IDBVersionChangeEvent).] expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 diff --git a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini index 1d92f01ae..a1c822113 100644 --- a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini +++ b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini @@ -76,30 +76,6 @@ expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 - [FocusEvent should be an alias for FocusEvent.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [createEvent('FocusEvent') should be initialized correctly.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [focusevent should be an alias for FocusEvent.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [createEvent('focusevent') should be initialized correctly.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [FOCUSEVENT should be an alias for FocusEvent.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [createEvent('FOCUSEVENT') should be initialized correctly.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - [IDBVersionChangeEvent should be an alias for IDBVersionChangeEvent.] expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 diff --git a/testing/web-platform/meta/selection/getSelection.html.ini b/testing/web-platform/meta/selection/getSelection.html.ini index 4db5721ae..672b83770 100644 --- a/testing/web-platform/meta/selection/getSelection.html.ini +++ b/testing/web-platform/meta/selection/getSelection.html.ini @@ -1,14 +1,5 @@ [getSelection.html] type: testharness - [getSelection() on HTML document with null defaultView must be null] - expected: FAIL - - [getSelection() on XML document with null defaultView must be null] - expected: FAIL - - [getSelection() on HTML document with null defaultView must be null inside an iframe onload] - expected: FAIL - [window.getSelection() instanceof Selection in an iframe immediately after appendChild] expected: FAIL diff --git a/testing/web-platform/tests/fetch/api/response/response-init-002.html b/testing/web-platform/tests/fetch/api/response/response-init-002.html index 0bb2e8d0b..a48af8336 100644 --- a/testing/web-platform/tests/fetch/api/response/response-init-002.html +++ b/testing/web-platform/tests/fetch/api/response/response-init-002.html @@ -65,6 +65,11 @@ }); }, "Testing empty Response Content-Type header"); + test(function() { + var response = new Response(null, {status: 204}); + assert_equals(response.body, null); + }, "Testing null Response body"); + </script> </body> </html> diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html new file mode 100644 index 000000000..6040de922 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html @@ -0,0 +1,93 @@ +<!doctype html> +<meta charset=utf-8> +<title>Dispatching idle callbacks should be able to be suspended and then resumed</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<div id="log"></div> +<script> + function withEventListener(target, event, handler) { + handler = handler || (e => e); + return new Promise(resolve => { + let wrapper = function(e) { + let result = handler(e); + if (!result) { + return; + } + + resolve(result); + } + target.addEventListener(event, wrapper, { once: true }); + }); + } + + function makePostBackUrl(name) { + return new URL('resources/post_name_on_load.html?name=' + name, + window.location).href; + } + + function waitForMessage(message, handler) { + return withEventListener(window, 'message', e => (e.data === message) && handler(e));; + } + + function withWindow(name) { + let win = window.open(makePostBackUrl(name)) + return waitForMessage(name, _ => win); + } + + function navigateWindow(win, name) { + win.location = makePostBackUrl(name); + return waitForMessage(name, _ => win); + } + + function waitDuration(delay) { + return new Promise(resolve => { + setTimeout(resolve, delay); + }) + } + + function goBack(win) { + var p = withEventListener(win, 'pagehide'); + win.history.back(); + return p; + } + + promise_test(t => { + let idleCalled = false; + let running = true; + return withWindow('foo') + .then(win => { + let callback = function(d) { + idleCalled = true; + if (running) { + win.requestIdleCallback(callback); + } + }; + + win.requestIdleCallback(callback); + + return navigateWindow(win, 'bar') + .then(_ => idleCalled = false) + .then(_ => waitDuration(2000)) + .then(_ => { + assert_false(idleCalled, "idle callback shouldn't have been called yet"); + return goBack(win); + }) + .then(_ => Promise.race([ + // At this point it's a matter of having bfcache ... + waitDuration(2000) + .then(_ => { + assert_true(idleCalled, "idle callback should've been called by now"); + running = false; + }), + // ... or not. If not, we expect a load event. + waitForMessage("foo") + ])) + .then(_ => win.close()) + .catch(e => { + win.close(); + throw e; + }) + }); + }); + +</script> diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html index 823d5f5db..cc2660a19 100644 --- a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html @@ -25,4 +25,19 @@ } window.requestIdleCallback(t.step_func(f)); }, "requestIdleCallback callback should time out"); + + async_test(function (t) { + assert_false(document.hidden, "document.hidden must exist and be false to run this test properly"); + function g(deadline) { + assert_false(deadline.didTimeout) + t.done(); + } + + function f(deadline) { + assert_false(deadline.didTimeout); + window.requestIdleCallback(t.step_func(g), {timeout:100000}); + } + window.requestIdleCallback(t.step_func(f)); + }, "requestIdleCallback callback should not time out"); + </script> diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html index 8956b8709..9fb77d65d 100644 --- a/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html @@ -23,4 +23,10 @@ t.done(); }, 2000); }, "A cancelled callback is never invoked"); + + async_test(function (t) { + var handle = requestIdleCallback(t.step_func_done(function () { + cancelIdleCallback(handle); + })); + }, "Cancelling the currently executing idle callback should be allowed"); </script> diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html new file mode 100644 index 000000000..4679a6e6e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html @@ -0,0 +1,7 @@ +<!doctype html> +<script> + addEventListener('load', _ => { + let params = new URLSearchParams(window.location.search); + window.opener.postMessage(params.get('name'), '*'); + }); +</script> |