From 10315421763cd33cf7fe7b72fda94e0d6c78a69d Mon Sep 17 00:00:00 2001 From: Arthur Hemery Date: Thu, 18 Nov 2021 05:58:39 -0800 Subject: [PATCH] [Fixit] Move some frameNavigation web tests to WPTs. Convert some older web tests into WPTs. Bug: 1187081 Change-Id: I6b24765bb311608110646259ca6db0d4faebb8ca Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3284525 Commit-Queue: Arthur Hemery Reviewed-by: Titouan Rigoudy Cr-Commit-Position: refs/heads/main@{#943060} --- ...n-with-user-activation-in-parent.window.js | 11 +++++++++ ...vigation-without-user-activation.window.js | 11 +++++++++ .../page-that-post-message-to-opener.html | 6 +++++ .../page-with-top-navigating-iframe.html | 24 +++++++++++++++++++ .../resources/top-navigating-page.html | 15 ++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-with-user-activation-in-parent.window.js create mode 100644 html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-without-user-activation.window.js create mode 100644 html/browsers/browsing-the-web/navigating-across-documents/resources/page-that-post-message-to-opener.html create mode 100644 html/browsers/browsing-the-web/navigating-across-documents/resources/page-with-top-navigating-iframe.html create mode 100644 html/browsers/browsing-the-web/navigating-across-documents/resources/top-navigating-page.html diff --git a/html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-with-user-activation-in-parent.window.js b/html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-with-user-activation-in-parent.window.js new file mode 100644 index 000000000000000..8dbe667348a00a3 --- /dev/null +++ b/html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-with-user-activation-in-parent.window.js @@ -0,0 +1,11 @@ +// META: script=/resources/testharness.js +// META: script=/resources/testharnessreport.js + +async_test(t => { + addEventListener('message', t.step_func_done(e => { + assert_equals(e.data, 'Denied'); + })); + const w = open("resources/page-with-top-navigating-iframe.html?parent_user_gesture=true"); + t.add_cleanup(() => {w.close()}); + +}, "Cross-origin top navigation is blocked without user activation, even if the parent has user activation"); diff --git a/html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-without-user-activation.window.js b/html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-without-user-activation.window.js new file mode 100644 index 000000000000000..bd7140f459770e5 --- /dev/null +++ b/html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-without-user-activation.window.js @@ -0,0 +1,11 @@ +// META: script=/resources/testharness.js +// META: script=/resources/testharnessreport.js + +async_test(t => { + addEventListener('message', t.step_func_done(e => { + assert_equals(e.data, 'Denied'); + })); + const w = open("resources/page-with-top-navigating-iframe.html"); + t.add_cleanup(() => {w.close()}); + +}, "Cross-origin top navigation is blocked without user activation"); diff --git a/html/browsers/browsing-the-web/navigating-across-documents/resources/page-that-post-message-to-opener.html b/html/browsers/browsing-the-web/navigating-across-documents/resources/page-that-post-message-to-opener.html new file mode 100644 index 000000000000000..65a0c821494ab32 --- /dev/null +++ b/html/browsers/browsing-the-web/navigating-across-documents/resources/page-that-post-message-to-opener.html @@ -0,0 +1,6 @@ + + +Page that postMessage to its opener + diff --git a/html/browsers/browsing-the-web/navigating-across-documents/resources/page-with-top-navigating-iframe.html b/html/browsers/browsing-the-web/navigating-across-documents/resources/page-with-top-navigating-iframe.html new file mode 100644 index 000000000000000..568e44296f10dfc --- /dev/null +++ b/html/browsers/browsing-the-web/navigating-across-documents/resources/page-with-top-navigating-iframe.html @@ -0,0 +1,24 @@ + + + + + +Page that embeds an iframe that navigates its top + + diff --git a/html/browsers/browsing-the-web/navigating-across-documents/resources/top-navigating-page.html b/html/browsers/browsing-the-web/navigating-across-documents/resources/top-navigating-page.html new file mode 100644 index 000000000000000..557f408fba0e63b --- /dev/null +++ b/html/browsers/browsing-the-web/navigating-across-documents/resources/top-navigating-page.html @@ -0,0 +1,15 @@ + + +Page that navigates its top + +