diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/embedded-content')
11 files changed, 122 insertions, 27 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/offsets-into-the-media-resource/currentTime-move-within-document.html b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/offsets-into-the-media-resource/currentTime-move-within-document.html new file mode 100644 index 0000000000..22b579d720 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/offsets-into-the-media-resource/currentTime-move-within-document.html @@ -0,0 +1,31 @@ +<!doctype html> +<title>playback should not reset when moving within a document</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/media.js"></script> +<div id="log"></div> +<video autoplay muted hidden></video> +<div id="elsewhere"></div> +<script> +async_test(t => { + const v = document.querySelector('video'); + v.src = getVideoURI('/media/movie_300'); + v.currentTime = 0; + v.onplaying = t.step_func(() => { + v.currentTime = 10; + t.step_timeout(() => { + assert_greater_than_equal(v.currentTime, 10); + document.getElementById('elsewhere').appendChild(v); + assert_false(v.paused, 'paused after moving'); + assert_greater_than_equal(v.currentTime, 10); + t.step_timeout(() => { + assert_greater_than_equal(v.currentTime, 10); + t.done(); + }, 0); + }, 0); + + }); + v.play(); + v.onpause = t.step_func(function() { assert_unreached(); }); +}); +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-2.html b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-2.html index d080831175..9eec621c89 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-2.html +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-2.html @@ -31,7 +31,7 @@ <div id=scroller2> <div id="spacer"></div> <div id="scroller"> - <iframe> + <iframe id="target" src="resources/subframe.html" loading="lazy" diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_allow_downloads.sub.tentative.html b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_allow_downloads.sub.tentative.https.html index 6b3b3104ef..6b3b3104ef 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_allow_downloads.sub.tentative.html +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_allow_downloads.sub.tentative.https.html diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_window_open_download_allow_downloads.tentative.html b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_window_open_download_allow_downloads.tentative.https.html index 158fc4f947..158fc4f947 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_window_open_download_allow_downloads.tentative.html +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_window_open_download_allow_downloads.tentative.https.html diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/resources/sandbox-top-navigation-helper.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/resources/sandbox-top-navigation-helper.sub.js index 413f392dfc..bec8f6a64a 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/resources/sandbox-top-navigation-helper.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/resources/sandbox-top-navigation-helper.sub.js @@ -5,7 +5,7 @@ // // META: script=/resources/testdriver.js // // META: script=/resources/testdriver-vendor.js // // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// // META: script=./resources/sandbox-top-navigation-helper.js +// // META: script=./resources/sandbox-top-navigation-helper.sub.js // Helper file that provides various functions to test top-level navigation // with various frame and sandbox flag configurations. @@ -27,18 +27,28 @@ async function createNestedIframe(parent, origin, frame_sandbox, header_sandbox) origin: origin, scripts: [ '/resources/testdriver.js', - '/resources/testdriver-driver.js', - '/resources/testdriver-vendor.js' + '/resources/testdriver-vendor.js', ], headers: headers, }, iframe_attributes); } +async function navigateFrameTo(frame, origin) { + return frame.navigateToNew({ + origin: origin, + scripts: [ + '/resources/testdriver.js', + '/resources/testdriver-vendor.js', + ], + }); +} + async function attemptTopNavigation(iframe, should_succeed) { let did_succeed; try { await iframe.executeScript(() => { - window.top.location.href = "https://google.com"; + window.top.location.href = + 'http://{{hosts[alt][www2]}}:{{ports[http][0]}}'; }); did_succeed = true; } catch (e) { diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin.tentative.sub.window.js new file mode 100644 index 0000000000..95d53e1fe3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin.tentative.sub.window.js @@ -0,0 +1,28 @@ +// META: title=Top-level navigation tests with cross origin & user activated child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +// /* ---------------------- CROSS ORIGIN (A -> B) TESTS ---------------------- */ + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, + "HTTP_REMOTE_ORIGIN", "allow-top-navigation", ""); + + await attemptTopNavigation(iframe_1, true); +}, "A cross-origin frame with frame sandbox flags can navigate top"); + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, + "HTTP_REMOTE_ORIGIN", "", "allow-top-navigation"); + + await attemptTopNavigation(iframe_1, false); +}, "A cross-origin frame with delivered sandbox flags can not navigate top"); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child.tentative.sub.window.js index 53faa99a40..1d5ea93830 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child.tentative.sub.window.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child.tentative.sub.window.js @@ -5,7 +5,7 @@ // META: script=/resources/testdriver.js // META: script=/resources/testdriver-vendor.js // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// META: script=./resources/sandbox-top-navigation-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js 'use strict'; diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.js new file mode 100644 index 0000000000..26db4eeaca --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.js @@ -0,0 +1,43 @@ +// META: title=Top-level navigation tests with cross origin & user activated child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-actions.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + + const iframe = await createNestedIframe(main, "HTTP_ORIGIN", "", ""); + await activate(iframe); + + const new_iframe = await navigateFrameTo(iframe, "HTTPS_REMOTE_ORIGIN"); + await attemptTopNavigation(new_iframe, false); +}, "A cross-site unsandboxed iframe navigation consumes user activation and " + + "disallows top-level navigation."); + +promise_test(async t => { + const main = await setupTest(); + + const iframe = await createNestedIframe(main, "HTTP_ORIGIN", "", ""); + await activate(iframe); + + const new_iframe = await navigateFrameTo(iframe, "HTTP_REMOTE_ORIGIN"); + await attemptTopNavigation(new_iframe, true); +}, "A same-site unsandboxed iframe navigation does not consume user " + + "activation and allows top-level navigation."); + +promise_test(async t => { + const main = await setupTest(); + + const iframe = await createNestedIframe(main, "HTTP_ORIGIN", "", ""); + + const new_iframe = await navigateFrameTo(iframe, "HTTP_REMOTE_ORIGIN"); + await attemptTopNavigation(new_iframe, false); +}, "A same-site unsandboxed iframe navigation without sticky user activation " + + "does not allow top-level navigation."); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-escalate-privileges.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-escalate-privileges.tentative.sub.window.js index a5cda9b0b9..2ea0ba606e 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-escalate-privileges.tentative.sub.window.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-escalate-privileges.tentative.sub.window.js @@ -5,7 +5,7 @@ // META: script=/resources/testdriver.js // META: script=/resources/testdriver-vendor.js // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// META: script=./resources/sandbox-top-navigation-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js 'use strict'; diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild.tentative.sub.window.js index a07148f802..326c1dd54a 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild.tentative.sub.window.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild.tentative.sub.window.js @@ -5,7 +5,7 @@ // META: script=/resources/testdriver.js // META: script=/resources/testdriver-vendor.js // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// META: script=./resources/sandbox-top-navigation-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js 'use strict'; diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-special-cases.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation.tentative.sub.window.js index 8681411dd7..5079c8ad14 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-special-cases.tentative.sub.window.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation.tentative.sub.window.js @@ -3,9 +3,10 @@ // META: script=/common/get-host-info.sub.js // META: script=/common/utils.js // META: script=/resources/testdriver.js +// META: script=/resources/testdriver-actions.js // META: script=/resources/testdriver-vendor.js // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// META: script=./resources/sandbox-top-navigation-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js 'use strict'; @@ -27,21 +28,3 @@ promise_test(async t => { await attemptTopNavigation(iframe_1, false); }, "allow-top-navigation-by-user-activation set but no sticky activation"); - -/* ---------------------- CROSS ORIGIN (A -> B) TESTS ---------------------- */ - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_REMOTE_ORIGIN", "allow-top-navigation", ""); - - await attemptTopNavigation(iframe_1, true); -}, "A cross-origin frame with frame sandbox flags can navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_REMOTE_ORIGIN", "", "allow-top-navigation"); - - await attemptTopNavigation(iframe_1, false); -}, "A cross-origin frame with delivered sandbox flags can not navigate top"); |