From 434ea0b3e06242ab816475ad5c6d1f858552a7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A2ris=20MEULEMAN?= Date: Mon, 8 Mar 2021 10:22:55 +0000 Subject: [PATCH] Add WPT for COOP behavior in navigations to about:blank MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL adds a WPT test that checks the interaction of COOP same-origin-allow-popups with about:blank navigations. As discussed in https://github.com/whatwg/html/issues/5198. Change-Id: Iabe461416c36468f73a41af0f69c46c545744e14 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2678150 Auto-Submit: Pâris Meuleman Commit-Queue: Pâris Meuleman Reviewed-by: Arthur Sonzogni Cr-Commit-Position: refs/heads/master@{#860665} --- .../navigate-to-aboutblank.https-expected.txt | 7 + .../navigate-to-aboutblank.https.html | 176 ++++++++++++++++++ ...igate-top-to-aboutblank.https-expected.txt | 6 + .../navigate-top-to-aboutblank.https.html | 166 +++++++++++++++++ .../blink/web_tests/external/wpt/lint.ignore | 2 + 5 files changed, 357 insertions(+) create mode 100644 third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https-expected.txt create mode 100644 third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https.html create mode 100644 third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https-expected.txt create mode 100644 third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https.html diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https-expected.txt b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https-expected.txt new file mode 100644 index 00000000000000..70a6a029eebb27 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https-expected.txt @@ -0,0 +1,7 @@ +This is a testharness.js-based test. +PASS Navigate to about:blank from iframe with opener.top COOP: |header(Cross-Origin-Opener-Policy,same-origin), iframe origin: https://web-platform.test:8444, openee COOP: |header(Cross-Origin-Opener-Policy,same-origin), openee origin: https://web-platform.test:8444. +PASS Navigate to about:blank from iframe with opener.top COOP: |header(Cross-Origin-Opener-Policy,same-origin-allow-popups), iframe origin: https://web-platform.test:8444, openee COOP: |header(Cross-Origin-Opener-Policy,same-origin-allow-popups), openee origin: https://web-platform.test:8444. +FAIL Navigate to about:blank from iframe with opener.top COOP: |header(Cross-Origin-Opener-Policy,same-origin-allow-popups), iframe origin: https://web-platform.test:8444, openee COOP: |header(Cross-Origin-Opener-Policy,unsafe-none), openee origin: https://www1.web-platform.test:8444. assert_equals: expected "true" but got "false" +PASS Navigate to about:blank from iframe with opener.top COOP: |header(Cross-Origin-Opener-Policy,same-origin-allow-popups), iframe origin: https://www1.web-platform.test:8444, openee COOP: |header(Cross-Origin-Opener-Policy,unsafe-none), openee origin: https://www1.web-platform.test:8444. +Harness: the test ran to completion. + diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https.html new file mode 100644 index 00000000000000..8e3da11e04d3ac --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-to-aboutblank.https.html @@ -0,0 +1,176 @@ + + This tests the inheritance of COOP for navigations to about:blank. + + + + + + + + + + +

Non-initial empty documents (about:blank) should inherit their + cross-origin-opener-policy from the navigation's initiator top level document, + if the initiator and its top level document are same-origin, or default + (unsafe-none) otherwise. +

+ +
    +
  1. Create the opener popup with a given COOP openerCOOP.
  2. +
  3. Add iframe to the opener popup that is either same-origin or + cross-origin. +
  4. +
  5. Opener's iframe opens a new window, to a network document with openeeCOOP.
  6. +
  7. Opener's iframe navigates the openee popup to about:blank.
  8. +
+ + diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https-expected.txt b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https-expected.txt new file mode 100644 index 00000000000000..ccad4dea64da34 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https-expected.txt @@ -0,0 +1,6 @@ +This is a testharness.js-based test. +PASS Navigate top to about:blank from iframe with opener COOP: |header(Cross-Origin-Opener-Policy,same-origin), iframe origin: https://web-platform.test:8444 +FAIL Navigate top to about:blank from iframe with opener COOP: |header(Cross-Origin-Opener-Policy,same-origin), iframe origin: https://www1.web-platform.test:8444 assert_equals: expected "true" but got "false" +PASS Navigate top to about:blank from iframe with opener COOP: |header(Cross-Origin-Opener-Policy,same-origin-allow-popups), iframe origin: https://www1.web-platform.test:8444 +Harness: the test ran to completion. + diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https.html new file mode 100644 index 00000000000000..34a75cee57a1f6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https.html @@ -0,0 +1,166 @@ + + This tests the inheritance of COOP for navigations of the top document to about:blank. + + + + + + + + + + +

Non-initial empty documents (about:blank) should inherit their + cross-origin-opener-policy from the navigation's initiator top level document, + if the initiator and its top level document are same-origin, or default (to + unsafe-none) otherwise. +

+ +
    +
  1. Create the opener popup with a given COOP openerCOOP.
  2. +
  3. Add iframe to the opener popup that is either same-origin or + cross-origin. +
  4. +
  5. Opener opens a new window, to a network document with the same origin and + COOP value as opener.
  6. +
  7. Opener's iframe navigates its parent frame (opener) to about:blank.
  8. +
  9. Verify the openee still has access to its opener.
  10. +
+ + diff --git a/third_party/blink/web_tests/external/wpt/lint.ignore b/third_party/blink/web_tests/external/wpt/lint.ignore index bcf58ea5cfe0f6..5d8db43125e752 100644 --- a/third_party/blink/web_tests/external/wpt/lint.ignore +++ b/third_party/blink/web_tests/external/wpt/lint.ignore @@ -309,6 +309,8 @@ SET TIMEOUT: feature-policy/experimental-features/resources/focus-without-user-a SET TIMEOUT: permissions-policy/experimental-features/resources/focus-without-user-activation-iframe-tentative.html SET TIMEOUT: html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html SET TIMEOUT: html/cross-origin-embedder-policy/resources/reporting-worker.js +SET TIMEOUT: html/cross-origin-opener-policy/navigate-to-aboutblank.https.html +SET TIMEOUT: html/cross-origin-opener-policy/navigate-top-to-aboutblank.https.html SET TIMEOUT: html/cross-origin-opener-policy/reporting/resources/dispatcher.js SET TIMEOUT: html/dom/documents/dom-tree-accessors/Document.currentScript.html SET TIMEOUT: html/webappapis/timers/*