From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../ancestor-throttle-iframe-csp.https.html | 18 + ...ancestor-throttle-iframe-csp.https.html.headers | 2 + .../ancestor-throttle-iframe-xfo.https.html | 18 + ...ancestor-throttle-iframe-xfo.https.html.headers | 2 + .../resources/ancestor-throttle-inner.https.html | 33 ++ .../ancestor-throttle-inner.https.html.headers | 1 + .../resources/ancestor-throttle-nested.https.html | 22 + .../ancestor-throttle-nested.https.html.headers | 1 + .../resources/automatic-beacon-store.py | 25 + .../resources/background-fetch-inner.https.html | 47 ++ .../background-fetch-inner.https.html.headers | 1 + .../resources/background-fetch-sw-inner.https.html | 38 ++ .../background-fetch-sw-inner.https.html.headers | 1 + .../fenced-frame/resources/background-fetch-sw.js | 36 ++ .../resources/background-sync-helper.js | 23 + .../resources/background-sync-inner.https.html | 32 ++ .../background-sync-inner.https.html.headers | 1 + .../resources/background-sync-sw-inner.https.html | 41 ++ .../background-sync-sw-inner.https.html.headers | 1 + .../fenced-frame/resources/background-sync-sw.js | 21 + .../tests/fenced-frame/resources/badging-sw.js | 23 + .../resources/before-unload-inner.html | 27 ++ .../resources/before-unload-inner.html.headers | 1 + .../resources/check-header-referrer.py | 16 + .../resources/check-header-sec-fetch-dest.py | 14 + .../client-hints-iframe-inner.sub.https.html | 11 + ...lient-hints-iframe-inner.sub.https.html.headers | 4 + .../resources/client-hints-inner.sub.https.html | 27 ++ .../client-hints-inner.sub.https.html.headers | 5 + .../client-hints-meta-iframe-inner.sub.https.html | 15 + ...-hints-meta-iframe-inner.sub.https.html.headers | 2 + .../client-hints-meta-inner.sub.https.html | 31 ++ .../client-hints-meta-inner.sub.https.html.headers | 2 + .../fenced-frame/resources/content-index-sw.js | 28 ++ .../resources/cookie-access.https.html | 11 + .../resources/cookie-access.https.html.headers | 1 + .../resources/create-credential-inner.https.html | 38 ++ .../create-credential-inner.https.html.headers | 1 + .../tests/fenced-frame/resources/create-popup.html | 18 + .../resources/create-popup.html.headers | 1 + .../csp-fenced-frame-src-allowed-inner.html | 7 + ...csp-fenced-frame-src-allowed-inner.html.headers | 1 + .../csp-fenced-frame-src-blocked-inner.html | 10 + ...csp-fenced-frame-src-blocked-inner.html.headers | 1 + .../resources/csp-frame-src-allowed-inner.html | 7 + .../csp-frame-src-allowed-inner.html.headers | 1 + .../resources/csp-frame-src-blocked-inner.html | 9 + .../csp-frame-src-blocked-inner.html.headers | 1 + .../tests/fenced-frame/resources/csp-inner.html | 37 ++ .../fenced-frame/resources/csp-inner.html.headers | 2 + .../tests/fenced-frame/resources/csp.png | Bin 0 -> 4476 bytes .../resources/dangling-markup-helper.js | 15 + .../resources/default-enabled-features-helper.js | 45 ++ .../default-enabled-features-redirect.https.html | 32 ++ ...lt-enabled-features-redirect.https.html.headers | 1 + ...nabled-features-subframe-fencedframe.https.html | 21 + ...eatures-subframe-fencedframe.https.html.headers | 2 + ...ult-enabled-features-subframe-iframe.https.html | 19 + ...led-features-subframe-iframe.https.html.headers | 1 + .../fenced-frame/resources/download-helper.js | 29 ++ .../fenced-frame/resources/download-inner.html | 34 ++ .../resources/download-inner.html.headers | 1 + .../tests/fenced-frame/resources/download-stash.py | 28 ++ .../tests/fenced-frame/resources/dummy.html | 2 + .../tests/fenced-frame/resources/embeddee.html | 7 + .../fenced-frame/resources/embeddee.html.headers | 1 + .../fenced-frame/resources/embedder-policy.js | 39 ++ .../tests/fenced-frame/resources/empty-worker.js | 1 + .../fedcm-get-credential-inner.https.html | 45 ++ .../fedcm-get-credential-inner.https.html.headers | 1 + .../resources/fence-api-inner.https.html | 22 + .../resources/fence-api-inner.https.html.headers | 1 + .../resources/fenced-frame-loaded.html | 13 + .../resources/fenced-frame-loaded.html.headers | 1 + ...t-ready-for-outermost-document-to-navigate.html | 16 + ...for-outermost-document-to-navigate.html.headers | 1 + .../resources/fledge-bidding-logic-with-size.js | 37 ++ .../fledge-bidding-logic-with-size.js.headers | 2 + .../fenced-frame/resources/fledge-bidding-logic.js | 34 ++ .../resources/fledge-bidding-logic.js.headers | 2 + .../resources/fledge-decision-logic.js | 15 + .../resources/fledge-decision-logic.js.headers | 2 + ...frame-navigation-inner-create-nested.https.html | 48 ++ ...vigation-inner-create-nested.https.html.headers | 1 + .../frame-navigation-inner-simple.https.html | 13 + ...rame-navigation-inner-simple.https.html.headers | 1 + .../frame-with-intersection-observer.html | 29 ++ .../frame-with-intersection-observer.html.headers | 1 + .../fenced-frame/resources/gamepad-inner.html | 13 + .../resources/gamepad-inner.html.headers | 1 + .../resources/get-nested-configs-inner.html | 10 + .../get-nested-configs-inner.html.headers | 1 + .../get-nested-configs-nested-iframe.html | 10 + .../get-nested-configs-nested-iframe.html.headers | 1 + .../tests/fenced-frame/resources/get_battery.html | 17 + .../resources/get_battery.html.headers | 1 + .../resources/header-referrer-inner.html | 40 ++ .../resources/header-referrer-inner.html.headers | 1 + .../resources/header-secFetchDest-inner.html | 26 ++ .../header-secFetchDest-inner.html.headers | 1 + ...rward-should-not-work-in-fenced-tree-inner.html | 45 ++ ...ould-not-work-in-fenced-tree-inner.html.headers | 1 + ...s-replace-do-not-contribute-to-joint-inner.html | 115 +++++ ...e-do-not-contribute-to-joint-inner.html.headers | 1 + ...e-navigation-not-reflected-in-fenced-inner.html | 72 +++ ...tion-not-reflected-in-fenced-inner.html.headers | 1 + ...nore-child-fenced-frame-onload-event-inner.html | 41 ++ ...ld-fenced-frame-onload-event-inner.html.headers | 1 + .../fenced-frame/resources/key-value-store.py | 46 ++ .../location-ancestorOrigins-inner.https.html | 53 +++ ...cation-ancestorOrigins-inner.https.html.headers | 1 + .../navigate-ancestor-destination.https.html | 17 + ...avigate-ancestor-destination.https.html.headers | 1 + ...te-ancestor-from-nested-fenced-frame.https.html | 39 ++ ...tor-from-nested-fenced-frame.https.html.headers | 1 + ...navigate-ancestor-from-nested-iframe.https.html | 38 ++ ...-ancestor-from-nested-iframe.https.html.headers | 1 + .../resources/navigate-ancestor-helper.https.html | 33 ++ .../navigate-ancestor-helper.https.html.headers | 1 + .../resources/navigate-ancestor-helper.js | 28 ++ .../navigate-ancestor-test-runner.https.html | 76 ++++ .../resources/navigate-by-name-inner.html | 45 ++ .../resources/navigate-by-name-inner.html.headers | 1 + .../navigate-by-name-reporting-helper.html | 34 ++ .../navigate-by-name-reporting-helper.html.headers | 1 + .../resources/navigate-nested-config.html | 14 + .../resources/navigate-nested-config.html.headers | 1 + .../navigator-keyboard-layout-map-inner.html | 21 + ...avigator-keyboard-layout-map-inner.html.headers | 1 + .../resources/navigator-keyboard-lock-inner.html | 21 + .../navigator-keyboard-lock-inner.html.headers | 1 + .../fenced-frame/resources/notification-sw.js | 20 + .../resources/opaque-ad-sizes-utils.js | 47 ++ .../fenced-frame/resources/payment-handler-sw.js | 10 + .../resources/permission-api-denied-inner.html | 15 + .../permission-api-denied-inner.html.headers | 1 + .../resources/permission-geolocation-inner.html | 16 + .../permission-geolocation-inner.html.headers | 1 + .../permission-geolocation-test-runner.html | 24 + .../resources/permission-notification-inner.html | 13 + .../permission-notification-inner.html.headers | 1 + .../resources/popup-noopener-destination.html | 20 + .../resources/popup-noopener-inner.html | 48 ++ .../resources/popup-noopener-inner.html.headers | 1 + .../fenced-frame/resources/prerender-inner.html | 20 + .../resources/prerender-inner.html.headers | 1 + .../resources/presentation-receiver-inner.html | 17 + .../presentation-receiver-inner.html.headers | 1 + .../resources/remote-context-executor.https.html | 29 ++ .../tests/fenced-frame/resources/report-url.html | 7 + .../fenced-frame/resources/report-url.html.headers | 1 + .../resources/resize-lock-inner-input.html | 43 ++ .../resources/resize-lock-inner-input.html.headers | 1 + .../fenced-frame/resources/resize-lock-inner.html | 23 + .../resources/resize-lock-inner.html.headers | 1 + .../tests/fenced-frame/resources/response-204.py | 4 + .../sandbox-mandatory-flags-iframe.sub.html | 13 + .../sandbox-mandatory-flags-inner.sub.html | 6 + .../sandbox-mandatory-flags-inner.sub.html.headers | 1 + ...box-mandatory-flags-looser-restriction.sub.html | 14 + .../resources/sandboxed-features-inner.sub.html | 20 + .../sandboxed-features-inner.sub.html.headers | 1 + .../sandboxed-features-looser-restriction.sub.html | 19 + ...ed-features-looser-restriction.sub.html.headers | 1 + .../fenced-frame/resources/sandboxed-features.js | 126 ++++++ .../serviceWorker-dedicated-worker-inner.html | 28 ++ ...rviceWorker-dedicated-worker-inner.html.headers | 1 + .../resources/serviceWorker-dedicated-worker-sw.js | 18 + .../serviceWorker-dedicated-worker-sw.js.headers | 1 + .../resources/serviceWorker-dedicated-worker.js | 8 + .../resources/serviceWorker-frameType-inner.html | 37 ++ .../serviceWorker-frameType-inner.html.headers | 1 + .../resources/serviceWorker-frameType-nested.html | 25 + .../serviceWorker-frameType-nested.html.headers | 1 + .../resources/serviceWorker-frameType.js | 19 + .../serviceWorker-navigate-inner-success.html | 11 + ...rviceWorker-navigate-inner-success.html.headers | 1 + .../resources/serviceWorker-navigate-inner.html | 16 + .../serviceWorker-navigate-inner.html.headers | 1 + .../resources/serviceWorker-navigate.js | 18 + .../resources/serviceWorker-push-sw.js | 19 + .../unique-cookie-partition-inner.https.html | 42 ++ ...nique-cookie-partition-inner.https.html.headers | 2 + .../tests/fenced-frame/resources/utils.js | 501 +++++++++++++++++++++ .../resources/web-bluetooth-inner.html | 33 ++ .../resources/web-bluetooth-inner.html.headers | 1 + .../resources/web-nfc-inner.https.html | 23 + .../resources/web-nfc-inner.https.html.headers | 1 + .../fenced-frame/resources/web-share-inner.html | 21 + .../resources/web-share-inner.html.headers | 1 + .../resources/window-frameElement-inner.html | 14 + .../window-frameElement-inner.html.headers | 1 + .../resources/window-navigation-204-inner.html | 23 + .../window-navigation-204-inner.html.headers | 1 + .../resources/window-outer-dimensions-inner.html | 36 ++ .../window-outer-dimensions-inner.html.headers | 1 + .../resources/window-parent-inner.html | 64 +++ .../resources/window-parent-inner.html.headers | 1 + .../fenced-frame/resources/window-top-inner.html | 63 +++ .../resources/window-top-inner.html.headers | 1 + 200 files changed, 3754 insertions(+) create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/automatic-beacon-store.py create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-fetch-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-sync-helper.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/background-sync-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/badging-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/check-header-referrer.py create mode 100644 testing/web-platform/tests/fenced-frame/resources/check-header-sec-fetch-dest.py create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/content-index-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/create-popup.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/create-popup.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/csp.png create mode 100644 testing/web-platform/tests/fenced-frame/resources/dangling-markup-helper.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/default-enabled-features-helper.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/download-helper.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/download-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/download-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/download-stash.py create mode 100644 testing/web-platform/tests/fenced-frame/resources/dummy.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/embeddee.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/embeddee.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/embedder-policy.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/empty-worker.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/get_battery.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/get_battery.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/key-value-store.py create mode 100644 testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-test-runner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/notification-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/opaque-ad-sizes-utils.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/payment-handler-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/permission-geolocation-test-runner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/popup-noopener-destination.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/prerender-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/prerender-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/remote-context-executor.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/report-url.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/report-url.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/response-204.py create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-iframe.sub.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-looser-restriction.sub.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/sandboxed-features.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/serviceWorker-push-sw.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/utils.js create mode 100644 testing/web-platform/tests/fenced-frame/resources/web-bluetooth-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/web-bluetooth-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/web-share-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/web-share-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html.headers create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-top-inner.html create mode 100644 testing/web-platform/tests/fenced-frame/resources/window-top-inner.html.headers (limited to 'testing/web-platform/tests/fenced-frame/resources') diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html new file mode 100644 index 0000000000..28fadb296c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html @@ -0,0 +1,18 @@ + + + +Header Inheritance CSP Reporting Page + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html.headers new file mode 100644 index 0000000000..bb76329b1d --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-csp.https.html.headers @@ -0,0 +1,2 @@ +Supports-Loading-Mode: fenced-frame +Content-Security-Policy: frame-ancestors 'self' diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html new file mode 100644 index 0000000000..267aa076c0 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html @@ -0,0 +1,18 @@ + + + +Header Inheritance XFO Reporting Page + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html.headers new file mode 100644 index 0000000000..63d5019c35 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-iframe-xfo.https.html.headers @@ -0,0 +1,2 @@ +Supports-Loading-Mode: fenced-frame +X-Frame-Options: SAMEORIGIN diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html new file mode 100644 index 0000000000..e0977c73f0 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html @@ -0,0 +1,33 @@ + + + + +Header Inheritance Inner Page + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html new file mode 100644 index 0000000000..a26b7bfdc2 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html @@ -0,0 +1,22 @@ + + + +Header Inheritance CSP Reporting Page + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ancestor-throttle-nested.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/automatic-beacon-store.py b/testing/web-platform/tests/fenced-frame/resources/automatic-beacon-store.py new file mode 100644 index 0000000000..f783c8530c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/automatic-beacon-store.py @@ -0,0 +1,25 @@ +"""Automatic beacon store server. + +- When a request body is not specified, serves a 200 response whose body + contains the stored value from the last automatic beacon. If the stored value + doesn't exist, serves a 200 response with an empty body. +- When a request body is specified, stores the data in the body and serves a 200 + response without body. +""" +# Use an arbitrary key since `request.server.stash.put` expects a valid UUID. +BEACON_KEY = "0c02dba4-f01e-11ed-a05b-0242ac120003" + +def main(request, response): + # Requests with a body imply they were sent as an automatic beacon for + # reserved.top_navigation. Note that this only stores the most recent beacon + # that was sent. + if request.body: + request.server.stash.put(BEACON_KEY, request.body) + return (200, [], b"") + + # Requests without a body imply they were sent as the request from + # nextAutomaticBeacon(). + data = request.server.stash.take(BEACON_KEY) + if not data and data != "": + return (200, [], b"") + return (200, [], data) diff --git a/testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html new file mode 100644 index 0000000000..1bca25a957 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html @@ -0,0 +1,47 @@ + + + + +Fenced frame content to report the result of background fetch + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-fetch-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html new file mode 100644 index 0000000000..78e58e5bbf --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html @@ -0,0 +1,38 @@ + + + + +Fenced frame content to report the result of background fetch in SW + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw.js b/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw.js new file mode 100644 index 0000000000..44b7d087b5 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-fetch-sw.js @@ -0,0 +1,36 @@ +self.addEventListener('install', e => e.waitUntil(skipWaiting())); +self.addEventListener('activate', e => e.waitUntil(clients.claim())); + +self.addEventListener('message', async e => { + const method = e.data; + + let promise; + switch (method) { + case 'fetch': + promise = self.registration.backgroundFetch.fetch( + 'test-fetch', ['background-fetch-inner.https.html.headers'], + {title: 'Background Fetch'}); + break; + case 'get': + promise = self.registration.backgroundFetch.get('test-fetch') + break; + case 'getIds': + promise = registration.backgroundFetch.getIds(); + break; + default: + promise = Promise.resolve(); + break; + } + + const message = + await promise + .then(() => { + return `[backgroundFetch.${method}] Unexpectedly started`; + }) + .catch((e) => { + return `[backgroundFetch.${ + method}] Failed inside fencedframe as expected`; + }); + + e.source.postMessage(message); +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/background-sync-helper.js b/testing/web-platform/tests/fenced-frame/resources/background-sync-helper.js new file mode 100644 index 0000000000..78b69f15de --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-sync-helper.js @@ -0,0 +1,23 @@ +const getOneShotSyncPromise = (registration, method) => { + if (method === 'register') { + return registration.sync.register('fencedframe-oneshot'); + } else if (method === 'getTags') { + return registration.sync.getTags(); + } + return Promise.resolve(); +}; + +const getPeriodicSyncPromise = (registration, method) => { + if (method === 'register') { + return registration.periodicSync.register( + 'fencedframe-periodic', {minInterval: 1000}); + } else if (method === 'getTags') { + return registration.periodicSync.getTags(); + } else if (method === 'unregister') { + return registration.periodicSync.unregister('fencedframe-periodic'); + } else { + return Promise.resolve(); + } +}; + +export {getOneShotSyncPromise, getPeriodicSyncPromise} diff --git a/testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html new file mode 100644 index 0000000000..81974c803a --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html @@ -0,0 +1,32 @@ + + + + +Fenced frame content to report the result of background sync's register + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-sync-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html new file mode 100644 index 0000000000..b9521a4e20 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html @@ -0,0 +1,41 @@ + + + + +Fenced frame content to report the result of background sync's register in SW + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-sync-sw-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/background-sync-sw.js b/testing/web-platform/tests/fenced-frame/resources/background-sync-sw.js new file mode 100644 index 0000000000..5b0c791f0d --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/background-sync-sw.js @@ -0,0 +1,21 @@ +import {getOneShotSyncPromise, getPeriodicSyncPromise} from './background-sync-helper.js'; + +self.addEventListener('install', e => e.waitUntil(skipWaiting())); +self.addEventListener('activate', e => e.waitUntil(clients.claim())); + +self.addEventListener('message', async e => { + const {method, isPeriodic} = e.data; + const promise = isPeriodic ? + getPeriodicSyncPromise(self.registration, method) : + getOneShotSyncPromise(self.registration, method); + const message = + await promise + .then(() => { + return `[background synnc ${method}] Unexpectedly started`; + }) + .catch((e) => { + return e.message; + }); + + e.source.postMessage(message); +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/badging-sw.js b/testing/web-platform/tests/fenced-frame/resources/badging-sw.js new file mode 100644 index 0000000000..5bc3c9a190 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/badging-sw.js @@ -0,0 +1,23 @@ +self.addEventListener('install', e => e.waitUntil(skipWaiting())); +self.addEventListener('activate', e => e.waitUntil(clients.claim())); + +self.addEventListener('message', async e => { + const method = e.data; + + let promise; + if (method === 'setAppBadge') { + promise = self.navigator.setAppBadge(1); + } else if (method === 'clearAppBadge') { + promise = self.navigator.clearAppBadge(); + } else { + promise = Promise.resolve(); + } + + const error = await promise + .then(() => { + return `[Badging API ${method}] Unexpectedly started`; + }) + .catch((e) => e); + + e.source.postMessage(error); +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html b/testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html new file mode 100644 index 0000000000..6d23cf88a3 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html @@ -0,0 +1,27 @@ + + +Fenced frame content to report the beforeunload event is not fired + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/check-header-referrer.py b/testing/web-platform/tests/fenced-frame/resources/check-header-referrer.py new file mode 100644 index 0000000000..b06fbc2704 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/check-header-referrer.py @@ -0,0 +1,16 @@ +import os + +from wptserve.utils import isomorphic_decode + + +def main(request, response): + response.headers.set(b"supports-loading-mode", b"fenced-frame") + + script = u""" + + + """ % (isomorphic_decode(request.headers.get(b"referer", b""))) + return (200, [], script) diff --git a/testing/web-platform/tests/fenced-frame/resources/check-header-sec-fetch-dest.py b/testing/web-platform/tests/fenced-frame/resources/check-header-sec-fetch-dest.py new file mode 100644 index 0000000000..98231079b3 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/check-header-sec-fetch-dest.py @@ -0,0 +1,14 @@ +import os + + +def main(request, response): + response.headers.set(b"supports-loading-mode", b"fenced-frame") + + script = u""" + + + """ % (request.headers.get(b"sec-fetch-dest", b"none")) + return (200, [], script) diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html b/testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html new file mode 100644 index 0000000000..d02abd6957 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html @@ -0,0 +1,11 @@ + +Client Hint Echoing Iframe + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html.headers new file mode 100644 index 0000000000..f500a60ae8 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-iframe-inner.sub.https.html.headers @@ -0,0 +1,4 @@ +Supports-Loading-Mode: fenced-frame +Accept-CH: sec-ch-viewport-width, sec-ch-ua-reduced +Feature-Policy: ch-viewport-width *, ch-ua-reduced * +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html b/testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html new file mode 100644 index 0000000000..0271d0290d --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html @@ -0,0 +1,27 @@ + + + +Client Hints Helper + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html.headers new file mode 100644 index 0000000000..ea4cf59d16 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-inner.sub.https.html.headers @@ -0,0 +1,5 @@ +Supports-Loading-Mode: fenced-frame +Accept-CH: sec-ch-viewport-width, sec-ch-ua-reduced +Feature-Policy: ch-viewport-width *, ch-ua-reduced * +Access-Control-Allow-Origin: * + diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html new file mode 100644 index 0000000000..9afb5c6a85 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html @@ -0,0 +1,15 @@ + + + +Client Hint Echoing Iframe + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html.headers new file mode 100644 index 0000000000..b7952e5d05 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-iframe-inner.sub.https.html.headers @@ -0,0 +1,2 @@ + +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html new file mode 100644 index 0000000000..b84f16ffd0 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html @@ -0,0 +1,31 @@ + + + + + +Client Hints Helper + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html.headers new file mode 100644 index 0000000000..afe7b4f317 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/client-hints-meta-inner.sub.https.html.headers @@ -0,0 +1,2 @@ +Supports-Loading-Mode: fenced-frame +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/fenced-frame/resources/content-index-sw.js b/testing/web-platform/tests/fenced-frame/resources/content-index-sw.js new file mode 100644 index 0000000000..c2759d9630 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/content-index-sw.js @@ -0,0 +1,28 @@ +self.addEventListener('install', e => e.waitUntil(skipWaiting())); +self.addEventListener('activate', e => e.waitUntil(clients.claim())); + +self.addEventListener('message', async event => { + const method = event.data; + const {index} = self.registration; + const id = 'fenced-frame-id-sw'; + + let promise; + if (method === 'add') { + promise = index.add({ + id, + title: 'same title', + description: 'same description', + url: 'resources/' + }); + } else if (method === 'delete') { + promise = index.delete(id); + } else if (method === 'getAll') { + promise = index.getAll(); + } else { + promise = Promise.resolve(); + } + + const message = await promise.then(() => 'success').catch(e => e.message); + + event.source.postMessage(message); +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html b/testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html new file mode 100644 index 0000000000..34e5681139 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html @@ -0,0 +1,11 @@ + + +Page loaded in a frame in a fenced frame tree + diff --git a/testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/cookie-access.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html new file mode 100644 index 0000000000..5725177f21 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html @@ -0,0 +1,38 @@ + + + + + + + +Fenced frame content to report the result of navigator.credentials.create + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/create-credential-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/create-popup.html b/testing/web-platform/tests/fenced-frame/resources/create-popup.html new file mode 100644 index 0000000000..a6cd81ec14 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/create-popup.html @@ -0,0 +1,18 @@ + + +Nested frames in a Fenced Frame tree creating popups + diff --git a/testing/web-platform/tests/fenced-frame/resources/create-popup.html.headers b/testing/web-platform/tests/fenced-frame/resources/create-popup.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/create-popup.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html new file mode 100644 index 0000000000..bdb448c347 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html @@ -0,0 +1,7 @@ + + +Page embedded as a fenced frame + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-allowed-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html new file mode 100644 index 0000000000..990f5ee469 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html @@ -0,0 +1,10 @@ + + +Page embedded as a fenced frame + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-fenced-frame-src-blocked-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html new file mode 100644 index 0000000000..bdb448c347 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html @@ -0,0 +1,7 @@ + + +Page embedded as a fenced frame + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-allowed-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html new file mode 100644 index 0000000000..eb90bb94e9 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html @@ -0,0 +1,9 @@ + + +Page embedded as a fenced frame + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-frame-src-blocked-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-inner.html b/testing/web-platform/tests/fenced-frame/resources/csp-inner.html new file mode 100644 index 0000000000..99df39fdc5 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-inner.html @@ -0,0 +1,37 @@ + + + + + + Fenced frame content to test Content Security Policies + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/csp-inner.html.headers new file mode 100644 index 0000000000..e89be70a43 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/csp-inner.html.headers @@ -0,0 +1,2 @@ +Supports-Loading-Mode: fenced-frame +Content-Security-Policy: img-src 'none' \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/csp.png b/testing/web-platform/tests/fenced-frame/resources/csp.png new file mode 100644 index 0000000000..53a9748ae0 Binary files /dev/null and b/testing/web-platform/tests/fenced-frame/resources/csp.png differ diff --git a/testing/web-platform/tests/fenced-frame/resources/dangling-markup-helper.js b/testing/web-platform/tests/fenced-frame/resources/dangling-markup-helper.js new file mode 100644 index 0000000000..9e0fff2301 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/dangling-markup-helper.js @@ -0,0 +1,15 @@ +// These are used in tests that rely on URLs containing dangling markup. See +// https://github.com/whatwg/fetch/pull/519. +const kDanglingMarkupSubstrings = [ + "blo\nck + t.step_timeout(() => resolve("NOT LOADED"), 1500)); +} \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-helper.js b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-helper.js new file mode 100644 index 0000000000..821ebf69e3 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-helper.js @@ -0,0 +1,45 @@ +// This is a helper file used for the attribution-reporting-*.https.html tests. +// To use this, make sure you import these scripts: +// +// +// +// +// +// + +async function runDefaultEnabledFeaturesTest(t, should_load, fenced_origin, + generator_api="fledge", allow="") { + const fencedframe = await attachFencedFrameContext({ + generator_api: generator_api, + attributes: [["allow", allow]], + origin: fenced_origin}); + + if (!should_load) { + const fencedframe_blocked = new Promise(r => t.step_timeout(r, 1000)); + const fencedframe_loaded = fencedframe.execute(() => {}); + assert_equals(await Promise.any([ + fencedframe_blocked.then(() => "blocked"), + fencedframe_loaded.then(() => "loaded"), + ]), "blocked", "The fenced frame should not be loaded."); + return; + } + + await fencedframe.execute((generator_api) => { + assert_true( + document.featurePolicy.allowsFeature('attribution-reporting'), + "Attribution reporting should be allowed if the fenced " + + "frame loaded using FLEDGE or shared storage."); + + if (generator_api == "fledge") { + assert_false( + document.featurePolicy.allowsFeature('shared-storage'), + "Shared storage should be disallowed if the fenced " + + "frame loaded using FLEDGE."); + } else { + assert_true( + document.featurePolicy.allowsFeature('shared-storage'), + "Shared storage should be allowed if the fenced " + + "frame loaded using shared storage."); + } + }, [generator_api]); +} diff --git a/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html new file mode 100644 index 0000000000..000b1eb6dd --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html @@ -0,0 +1,32 @@ + + + +Fenced frame attribution reporting redirect test + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-redirect.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html new file mode 100644 index 0000000000..e098736528 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html @@ -0,0 +1,21 @@ + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html.headers new file mode 100644 index 0000000000..e52511f18a --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-fencedframe.https.html.headers @@ -0,0 +1,2 @@ +Supports-Loading-Mode: fenced-frame +Permissions-Policy: shared-storage=() diff --git a/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html new file mode 100644 index 0000000000..a3ab056944 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html @@ -0,0 +1,19 @@ + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/default-enabled-features-subframe-iframe.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/download-helper.js b/testing/web-platform/tests/fenced-frame/resources/download-helper.js new file mode 100644 index 0000000000..011d5c867f --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/download-helper.js @@ -0,0 +1,29 @@ +function StreamDownloadFinishDelay() { + return 1000; +} + +function DownloadVerifyDelay() { + return 1000; +} + +async function VerifyDownload(test_obj, token) { + const verifyToken = async (token) => { + const url = `resources/download-stash.py?verify-token&token=${token}`; + const response = await fetch(url); + if (!response.ok) { + throw new Error('An error happened in the server'); + } + const message = await response.text(); + return message === 'TOKEN_SET'; + }; + + return new Promise((resolve) => { + test_obj.step_wait( + async () => { + const result = await verifyToken(token); + resolve(result); + }, + 'Check if the download has finished or not', + StreamDownloadFinishDelay() + DownloadVerifyDelay()); + }); +} diff --git a/testing/web-platform/tests/fenced-frame/resources/download-inner.html b/testing/web-platform/tests/fenced-frame/resources/download-inner.html new file mode 100644 index 0000000000..9bc816cbf3 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/download-inner.html @@ -0,0 +1,34 @@ + + + + + The page triggering download embedded as a Fenced Frame + + + + + + + + + Download + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/download-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/download-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/download-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/download-stash.py b/testing/web-platform/tests/fenced-frame/resources/download-stash.py new file mode 100644 index 0000000000..497f7cb018 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/download-stash.py @@ -0,0 +1,28 @@ +import time + + +def main(request, response): + token = request.GET[b"token"] + response.status = 200 + response.headers.append(b"Content-Type", b"text/html") + if b"verify-token" in request.GET: + if request.server.stash.take(token): + return u'TOKEN_SET' + return u'TOKEN_NOT_SET' + + if b"finish-delay" not in request.GET: + # + request.server.stash.put(token, True) + return + + # navigation to download + response.headers.append(b"Content-Disposition", b"attachment") + response.write_status_headers() + finish_delay = float(request.GET[b"finish-delay"]) / 1E3 + count = 10 + single_delay = finish_delay / count + for i in range(count): # pylint: disable=unused-variable + time.sleep(single_delay) + if not response.writer.write_content(b"\n"): + return + request.server.stash.put(token, True) diff --git a/testing/web-platform/tests/fenced-frame/resources/dummy.html b/testing/web-platform/tests/fenced-frame/resources/dummy.html new file mode 100644 index 0000000000..a0cf50713e --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/dummy.html @@ -0,0 +1,2 @@ + +Dummy page diff --git a/testing/web-platform/tests/fenced-frame/resources/embeddee.html b/testing/web-platform/tests/fenced-frame/resources/embeddee.html new file mode 100644 index 0000000000..3423be9aa4 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/embeddee.html @@ -0,0 +1,7 @@ + + +A page embedded as a Fenced Frame for COEP tests + diff --git a/testing/web-platform/tests/fenced-frame/resources/embeddee.html.headers b/testing/web-platform/tests/fenced-frame/resources/embeddee.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/embeddee.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/embedder-policy.js b/testing/web-platform/tests/fenced-frame/resources/embedder-policy.js new file mode 100644 index 0000000000..8c96afafce --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/embedder-policy.js @@ -0,0 +1,39 @@ +// This file should be loaded alongside with utils.js. +// +// This file is loaded by: +// - embedder-no-coep.https.html +// - embedder-require-corp.https.html + +// Make input list to be used as a wptserve pipe +// (https://web-platform-tests.org/writing-tests/server-pipes.html). +// e.g. +// args: ['content-type,text/plain','Age,0'] +// return: 'header(content-type,text/plain)|header(Age,0)' +function generateHeader(headers) { + return headers.map((h) => { + return 'header(' + h + ')'; + }).join('|'); +} + +// Setup a fenced frame for embedder-* WPTs. +async function setupTest(test_type, uuid, hostname='') { + let headers = ["Supports-Loading-Mode,fenced-frame"]; + switch (test_type) { + case "coep:require-corp": + headers.push("cross-origin-embedder-policy,require-corp"); + headers.push("cross-origin-resource-policy,same-origin"); + break; + case "no coep": + break; + default: + assert_unreachable("unknown test_type:" + test_type); + break; + } + const tmp_url = new URL('resources/embeddee.html', location.href); + if (hostname) { + tmp_url.hostname = hostname; + } + tmp_url.searchParams.append("pipe", generateHeader(headers)); + const url = generateURL(tmp_url.toString(), [uuid]); + return attachFencedFrame(url); +} diff --git a/testing/web-platform/tests/fenced-frame/resources/empty-worker.js b/testing/web-platform/tests/fenced-frame/resources/empty-worker.js new file mode 100644 index 0000000000..49ceb2648a --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/empty-worker.js @@ -0,0 +1 @@ +// Do nothing. diff --git a/testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html new file mode 100644 index 0000000000..f30cd77838 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html @@ -0,0 +1,45 @@ + + + + + +Fenced frame content to report the result of navigator.credentials.get + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fedcm-get-credential-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html new file mode 100644 index 0000000000..814ea78559 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html @@ -0,0 +1,22 @@ + + + +Fenced frame content to test window.fence object + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fence-api-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html new file mode 100644 index 0000000000..0054762783 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html @@ -0,0 +1,13 @@ + + + +Fenced frame loaded + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html.headers b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-loaded.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html new file mode 100644 index 0000000000..9b67be775e --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html @@ -0,0 +1,16 @@ + + +Nested fenced frame named navigation helper + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html.headers b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fenced-frame-set-name-and-report-ready-for-outermost-document-to-navigate.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js new file mode 100644 index 0000000000..1a22bcec3d --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js @@ -0,0 +1,37 @@ +// These functions are used by FLEDGE to determine the logic for the ad buyer. +// For our testing purposes, we only need the minimal amount of boilerplate +// code in place to allow them to be invoked properly and move the FLEDGE +// process along. The tests do not deal with reporting results, so we leave +// `reportWin` empty. See `generateURNFromFledge` in "utils.js" to see how +// these files are used. + +function generateBid(interestGroup, auctionSignals, perBuyerSignals, + trustedBiddingSignals, browserSignals) { + const ad = interestGroup.ads[0]; + + // `auctionSignals` controls whether or not component auctions are allowed. + let allowComponentAuction = + typeof auctionSignals === 'string' && + auctionSignals.includes('bidderAllowsComponentAuction'); + + let result = { + 'ad': ad, + 'bid': 1, + 'render': { url: ad.renderUrl, width: "100px", height: "50px" }, + 'allowComponentAuction': allowComponentAuction + }; + if (interestGroup.adComponents && interestGroup.adComponents.length > 0) + result.adComponents = interestGroup.adComponents.map((component) => { + return { + url: component.renderUrl, + width: "100px", + height: "50px" + }; + }); + return result; +} + +function reportWin( + auctionSignals, perBuyerSignals, sellerSignals, browserSignals) { + return; +} diff --git a/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js.headers b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js.headers new file mode 100644 index 0000000000..776bf2987b --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic-with-size.js.headers @@ -0,0 +1,2 @@ +Content-Type: Application/Javascript +X-Allow-FLEDGE: true \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js new file mode 100644 index 0000000000..ab6685f184 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js @@ -0,0 +1,34 @@ +// These functions are used by FLEDGE to determine the logic for the ad buyer. +// For our testing purposes, we only need the minimal amount of boilerplate +// code in place to allow them to be invoked properly and move the FLEDGE +// process along. The tests do not deal with reporting results, so we leave +// `reportWin` empty. See `generateURNFromFledge` in "utils.js" to see how +// these files are used. + +function generateBid(interestGroup, auctionSignals, perBuyerSignals, + trustedBiddingSignals, browserSignals) { + const ad = interestGroup.ads[0]; + + // `auctionSignals` controls whether or not component auctions are allowed. + let allowComponentAuction = + typeof auctionSignals === 'string' && + auctionSignals.includes('bidderAllowsComponentAuction'); + + let result = {'ad': ad, 'bid': 1, 'render': ad.renderUrl, + 'allowComponentAuction': allowComponentAuction}; + if (interestGroup.adComponents && interestGroup.adComponents.length > 0) + result.adComponents = interestGroup.adComponents.map((component) => { + return component.renderUrl; + }); + return result; +} + +function reportWin( + auctionSignals, perBuyerSignals, sellerSignals, browserSignals) { + registerAdBeacon({ + 'reserved.top_navigation': + browserSignals.interestGroupOwner + + '/fenced-frame/resources/automatic-beacon-store.py' + }); + return; +} diff --git a/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js.headers b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js.headers new file mode 100644 index 0000000000..776bf2987b --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fledge-bidding-logic.js.headers @@ -0,0 +1,2 @@ +Content-Type: Application/Javascript +X-Allow-FLEDGE: true \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js b/testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js new file mode 100644 index 0000000000..dc92f5a5e1 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js @@ -0,0 +1,15 @@ +// These functions are used by FLEDGE to determine the logic for the ad seller. +// For our testing purposes, we only need the minimal amount of boilerplate +// code in place to allow them to be invoked properly and move the FLEDGE +// process along. The tests do not deal with reporting results, so we leave +// `reportResult` empty. See `generateURNFromFledge` in "utils.js" to see how +// these files are used. + +function scoreAd( + adMetadata, bid, auctionConfig, trustedScoringSignals, browserSignals) { + return 2*bid; +} + +function reportResult(auctionConfig, browserSignals) { + return; +} diff --git a/testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js.headers b/testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js.headers new file mode 100644 index 0000000000..776bf2987b --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/fledge-decision-logic.js.headers @@ -0,0 +1,2 @@ +Content-Type: Application/Javascript +X-Allow-FLEDGE: true \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html new file mode 100644 index 0000000000..9a56a3d9fb --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html @@ -0,0 +1,48 @@ + + + + +Test nested fenced frame navigation (by a parent frame setting its src). + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-create-nested.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html new file mode 100644 index 0000000000..643ea48a76 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html @@ -0,0 +1,13 @@ + + + +Test that a fenced frame successfully loaded. + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/frame-navigation-inner-simple.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html b/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html new file mode 100644 index 0000000000..dd36b20399 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html @@ -0,0 +1,29 @@ + + + + +
+ + diff --git a/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html.headers b/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/frame-with-intersection-observer.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html b/testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html new file mode 100644 index 0000000000..3e253e4915 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html @@ -0,0 +1,13 @@ + + +getGamepads should throw an error in a fenced frame + + diff --git a/testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/gamepad-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html new file mode 100644 index 0000000000..a83ba93aa6 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html @@ -0,0 +1,10 @@ + + +Send the results of getNestedConfigs() to the embedder + + diff --git a/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html new file mode 100644 index 0000000000..9bd5d9f492 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html @@ -0,0 +1,10 @@ + + +getGamepads should throw an error in a fenced frame + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html.headers b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/get-nested-configs-nested-iframe.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/get_battery.html b/testing/web-platform/tests/fenced-frame/resources/get_battery.html new file mode 100644 index 0000000000..0532deca4b --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/get_battery.html @@ -0,0 +1,17 @@ + + +getBattery should fail in a fenced frame + + diff --git a/testing/web-platform/tests/fenced-frame/resources/get_battery.html.headers b/testing/web-platform/tests/fenced-frame/resources/get_battery.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/get_battery.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html b/testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html new file mode 100644 index 0000000000..2940dbac8e --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html @@ -0,0 +1,40 @@ + + + +Fenced frame content to report the value of header.referrer + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/header-referrer-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html b/testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html new file mode 100644 index 0000000000..aa3fe9e34c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html @@ -0,0 +1,26 @@ + + + + +Fenced frame content to report the value of `Sec-Fetch-Dest` header + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/header-secFetchDest-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html b/testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html new file mode 100644 index 0000000000..9620249d76 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html @@ -0,0 +1,45 @@ + + + +history-back-and-forward-should-not-work-in-fenced-tree-inner + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/history-back-and-forward-should-not-work-in-fenced-tree-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html b/testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html new file mode 100644 index 0000000000..726fafd65b --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html @@ -0,0 +1,115 @@ + + + +Nested fenced frame named navigation helper + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html b/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html new file mode 100644 index 0000000000..2bdb90ab64 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html @@ -0,0 +1,72 @@ + + +history-length-outer-page-navigation-not-reflected-in-fenced-inner + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/history-length-outer-page-navigation-not-reflected-in-fenced-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html b/testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html new file mode 100644 index 0000000000..4fe496f29c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html @@ -0,0 +1,41 @@ + +child frame with delayed onload event + + + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/ignore-child-fenced-frame-onload-event-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/key-value-store.py b/testing/web-platform/tests/fenced-frame/resources/key-value-store.py new file mode 100644 index 0000000000..c9fd81b2a3 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/key-value-store.py @@ -0,0 +1,46 @@ +"""Key-Value store server. + +The request takes "key=" and "value=" URL parameters. The key must be UUID +generated by token(). + +- When only the "key=" is specified, serves a 200 response whose body contains + the stored value specified by the key. If the stored value doesn't exist, + serves a 200 response with an empty body. +- When both the "key=" and "value=" are specified, stores the pair and serves + a 200 response without body. +""" + + +def main(request, response): + key = request.GET.get(b"key") + value = request.GET.get(b"value") + + # Store the value. + # We have two ways to check the truthiness of `value`: + # 1. `if value` + # 2. `if value != None` + # While (1) is the most intuitive, we actually need (2), which is a looser + # check. We need the looser check so that if the URL contains `&value=` to + # set the value equal to the empty string (a case we need to support), this + # condition still evaluates to true and we enter this branch. + if value != None: + # We opted for (2) above which is the looser of the truthiness tests + # that lets empty strings into this branch. So you might think that when + # the URL contains `&value=`, then the `value` variable here would be + # equal `""`, but instead it equals the empty byte string. If you just + # store that empty byte string into the stash and retrieve it later, you + # actually get because it doesn't recognize the empty byte + # string as a real value, so we instead have to override it to the empty + # normal string, and then we can store it for later use. This is + # because we have to support storage and retrieval of empty strings. + if type(value) is bytes and value == b'': + value = "" + + request.server.stash.put(key, value) + return (200, [], b"") + + # Get the value. + data = request.server.stash.take(key) + if not data and data != "": + return (200, [], b"") + return (200, [], data) diff --git a/testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html new file mode 100644 index 0000000000..3c9411c520 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html @@ -0,0 +1,53 @@ + + + +Fenced frame content to report the value of location.ancestorOrigins + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/location-ancestorOrigins-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html new file mode 100644 index 0000000000..f12849c8ec --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html @@ -0,0 +1,17 @@ + + +Nested fenced frame named navigation helper + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-destination.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html new file mode 100644 index 0000000000..74800b969f --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html @@ -0,0 +1,39 @@ + +Navigate ancestor helper + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-fenced-frame.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html new file mode 100644 index 0000000000..63a0cca8b4 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html @@ -0,0 +1,38 @@ + +Navigate ancestor helper from nested fenced frame + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-from-nested-iframe.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html new file mode 100644 index 0000000000..2cd8fcf786 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html @@ -0,0 +1,33 @@ + +Navigate ancestor helper + + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.js b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.js new file mode 100644 index 0000000000..6178ea78da --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-helper.js @@ -0,0 +1,28 @@ + +async function runNavigateAncestorTest(test_type, ancestor_type) { + // See documentation in `resources/navigate-ancestor-test-runner.https.html`. + // For each test type here, this document opens a new auxiliary window that + // runs the actual test. The tests in some way or another, direct a frame + // *inside* a fenced frame to navigate an ancestor frame via an + //
. We need to run the real test in a new window + // so that if that window ends up navigating unexpectedly (because the fenced + // frame can accidentally navigated its embedder, for example) we can detect + // it from ths page, which never navigates away. + const navigate_ancestor_key = token(); + const navigate_ancestor_from_nested_key = token(); + + const win = window.open(generateURL( + "resources/navigate-ancestor-test-runner.https.html", + [navigate_ancestor_key, navigate_ancestor_from_nested_key])); + await new Promise(resolve => { + win.onload = resolve; + }); + + const unloadPromise = new Promise(resolve => { + win.onunload = resolve; + }); + + await win.runTest(test_type, ancestor_type); + win.close(); + await unloadPromise; +} diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-test-runner.https.html b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-test-runner.https.html new file mode 100644 index 0000000000..d0f2e8d694 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-ancestor-test-runner.https.html @@ -0,0 +1,76 @@ + +Test navigating an ancestor frame from within a fenced frame + + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html new file mode 100644 index 0000000000..c7d7d6f278 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html @@ -0,0 +1,45 @@ + + + +Fenced frame hosting named frames + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html new file mode 100644 index 0000000000..d3bd955697 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html @@ -0,0 +1,34 @@ + + +Navigate reporting helper + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-by-name-reporting-helper.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html b/testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html new file mode 100644 index 0000000000..85c5194c6c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html @@ -0,0 +1,14 @@ + + + +Navigate a fenced frame to a nested config + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigate-nested-config.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html new file mode 100644 index 0000000000..59170c7512 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html @@ -0,0 +1,21 @@ + + +Fenced frame content to report the value of navigator.keyboard.getLayoutMap + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-layout-map-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html new file mode 100644 index 0000000000..105166c7ad --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html @@ -0,0 +1,21 @@ + + +Fenced frame content to report the value of navigator.keyboard.lock + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/navigator-keyboard-lock-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/notification-sw.js b/testing/web-platform/tests/fenced-frame/resources/notification-sw.js new file mode 100644 index 0000000000..e9b1e2b9dd --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/notification-sw.js @@ -0,0 +1,20 @@ +self.addEventListener('install', e => e.waitUntil(skipWaiting())); +self.addEventListener('activate', e => e.waitUntil(clients.claim())); + +self.addEventListener('message', async event => { + const method = event.data; + + if (method === 'constructor') { + try { + new Notification('test'); + } catch (e) { + event.source.postMessage(e.message); + } + } else if (method === 'showNotification') { + try { + await self.registration.showNotification('test', {body: 'test'}); + } catch (e) { + event.source.postMessage(e.message); + } + } +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/opaque-ad-sizes-utils.js b/testing/web-platform/tests/fenced-frame/resources/opaque-ad-sizes-utils.js new file mode 100644 index 0000000000..edf8640f20 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/opaque-ad-sizes-utils.js @@ -0,0 +1,47 @@ +async function runOpaqueAdSizesTest(input_width, input_height, output_width, output_height) { + // Attach a FLEDGE fenced frame whose outer container has dimensions + // `input_width` by `input_height`. + const frame = await attachFencedFrameContext({ + generator_api: "fledge", resolve_to_config: true, attributes: [ + ["width", input_width], ["height", input_height]]}); + + const assert_dimensions = + (label, input_width, input_height, output_width, output_height) => { + assert_equals(getComputedStyle(document.documentElement).width, + output_width+"px", + label + " the computed width coerces to " + output_width); + assert_equals(window.innerWidth, output_width, + label + " the innerWidth " + input_width + " coerces to " + output_width); + assert_equals(window.innerHeight, output_height, + label + " the innerHeight " + input_height + " coerces to " + output_height); + } + + // Assert that the fenced frame sees its dimensions rounded to the nearest + // ad size. + await frame.execute(assert_dimensions, + ["After navigation", input_width, input_height, output_width, output_height]); + + // Assert that the embedder sees the fenced frame's original dimensions. + assert_equals(frame.width, input_width.toString(), + "The outer container width is the requested width."); + assert_equals(frame.height, input_height.toString(), + "The outer container height is the requested height."); + + // Resize the fenced frame's outer container. + const new_size_x = 320; + const new_size_y = 50; + frame.width = new_size_x; + frame.height = new_size_y; + + // Refresh the fenced frame. + await frame.execute(() => { + window.executor.suspend(() => { + location.href = location.href; + }); + }); + + // Observe that navigations after the first don't change the fenced frame's + // inner dimensions. + await frame.execute(assert_dimensions, + ["After resizing", input_width, input_height, output_width, output_height]); +} diff --git a/testing/web-platform/tests/fenced-frame/resources/payment-handler-sw.js b/testing/web-platform/tests/fenced-frame/resources/payment-handler-sw.js new file mode 100644 index 0000000000..8b5e83cddf --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/payment-handler-sw.js @@ -0,0 +1,10 @@ +self.addEventListener('install', e => e.waitUntil(skipWaiting())); +self.addEventListener('activate', e => e.waitUntil(clients.claim())); + +self.addEventListener('message', event => { + try { + self.registration.paymentManager; + } catch (e) { + event.source.postMessage(e); + } +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html b/testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html new file mode 100644 index 0000000000..06724ac061 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html @@ -0,0 +1,15 @@ + + +Fenced frame content to report the result of navigator.permissions.query + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/permission-api-denied-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html b/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html new file mode 100644 index 0000000000..07c3e662bf --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html @@ -0,0 +1,16 @@ + + +Fenced frame content to report the result of navigator.geolocation.getCurrentPosition() + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-test-runner.html b/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-test-runner.html new file mode 100644 index 0000000000..724a35ce9a --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/permission-geolocation-test-runner.html @@ -0,0 +1,24 @@ + +Fenced frame content to report the result of navigator.geolocation.getCurrentPosition() + + + + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html b/testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html new file mode 100644 index 0000000000..d01d10034c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html @@ -0,0 +1,13 @@ + + +Fenced frame content to report the result of Notification.requestPermission + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/permission-notification-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/popup-noopener-destination.html b/testing/web-platform/tests/fenced-frame/resources/popup-noopener-destination.html new file mode 100644 index 0000000000..30cc21f22c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/popup-noopener-destination.html @@ -0,0 +1,20 @@ + + +Destination page opened by a frame in a Fenced Frame tree + diff --git a/testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html b/testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html new file mode 100644 index 0000000000..6a79fd21b2 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html @@ -0,0 +1,48 @@ + + + +Fenced frame creating popups + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/prerender-inner.html b/testing/web-platform/tests/fenced-frame/resources/prerender-inner.html new file mode 100644 index 0000000000..a523ef31c1 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/prerender-inner.html @@ -0,0 +1,20 @@ + + +Fenced frame content to report the result of prerendering + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/prerender-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/prerender-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/prerender-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html b/testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html new file mode 100644 index 0000000000..2e170dd91b --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html @@ -0,0 +1,17 @@ + + +Fenced frame content to report the result of navigator.presentation.receiver + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/presentation-receiver-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/remote-context-executor.https.html b/testing/web-platform/tests/fenced-frame/resources/remote-context-executor.https.html new file mode 100644 index 0000000000..6b2f5ccc00 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/remote-context-executor.https.html @@ -0,0 +1,29 @@ + + + + + + + + + +Script to wait for instructions from RemoteContext. + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/report-url.html b/testing/web-platform/tests/fenced-frame/resources/report-url.html new file mode 100644 index 0000000000..e0b7d0982a --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/report-url.html @@ -0,0 +1,7 @@ + + +A page embedded as a fenced frame that reports the document URL + diff --git a/testing/web-platform/tests/fenced-frame/resources/report-url.html.headers b/testing/web-platform/tests/fenced-frame/resources/report-url.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/report-url.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html new file mode 100644 index 0000000000..cb17789b45 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html @@ -0,0 +1,43 @@ + + + Fenced frame content to report any changes in inner dimensions + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html.headers b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner-input.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html new file mode 100644 index 0000000000..fbaf436330 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html @@ -0,0 +1,23 @@ + + + Fenced frame content to report any changes in inner dimensions + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/resize-lock-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/response-204.py b/testing/web-platform/tests/fenced-frame/resources/response-204.py new file mode 100644 index 0000000000..e6cf8d4ac9 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/response-204.py @@ -0,0 +1,4 @@ +def main(request, response): + response_headers = [] + body = "No content" + return (204, response_headers, body) \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-iframe.sub.html b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-iframe.sub.html new file mode 100644 index 0000000000..7ee8b7d98f --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-iframe.sub.html @@ -0,0 +1,13 @@ + +Iframe content to load a fenced frame and report a value to the server + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html new file mode 100644 index 0000000000..5f400b5bde --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html @@ -0,0 +1,6 @@ + +Fenced frame content to report a value to the server + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html.headers b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-inner.sub.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-looser-restriction.sub.html b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-looser-restriction.sub.html new file mode 100644 index 0000000000..0ad64c1a5c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandbox-mandatory-flags-looser-restriction.sub.html @@ -0,0 +1,14 @@ + +Iframe content to load a nested sandboxed iframe with all mandatory allow-* flags + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html new file mode 100644 index 0000000000..f3bcbc8ba1 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html @@ -0,0 +1,20 @@ + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html.headers b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-inner.sub.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html new file mode 100644 index 0000000000..44584440e1 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html.headers b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features-looser-restriction.sub.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/sandboxed-features.js b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features.js new file mode 100644 index 0000000000..1cbd4a48f3 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/sandboxed-features.js @@ -0,0 +1,126 @@ +const run_in_fenced_frame = (func_name, description, is_nested) => { + promise_test(async test => { + const key = token(); + const url = is_nested ? + 'resources/sandboxed-features-looser-restriction.sub.html?' : + 'resources/sandboxed-features-inner.sub.html?'; + let params = new URLSearchParams(); + params.set('key', key); + params.set('test_func', func_name); + const frame = document.createElement('fencedframe'); + const frame_url = 'resources/sandboxed-features-inner.sub.html?' + + params.toString(); + const config = new FencedFrameConfig(generateURL(frame_url, [])); + frame.config = config; + test.add_cleanup(() => { + frame.remove(); + }); + document.body.appendChild(frame); + assert_equals(await nextValueFromServer(key), 'done'); + }, description); +}; + +const run_sanboxed_feature_test = (func_name, description) => { + run_in_fenced_frame(func_name, description, false); + run_in_fenced_frame(func_name, description + '[looser sandboxed]', true); +}; + +async function test_prompt() { + assert_equals( + window.prompt('Test prompt'), + null, + 'window.prompt() must synchronously return null in a fenced frame without' + + ' blocking on user input.'); +} + +async function test_alert() { + assert_equals( + window.alert('Test alert'), + undefined, + 'window.alert() must synchronously return undefined in a fenced frame' + + ' without blocking on user input.'); +} + +async function test_confirm() { + assert_equals( + window.confirm('Test confirm'), + false, + 'window.confirm() must synchronously return false in a fenced frame' + + ' without blocking on user input.'); +} + +async function test_print() { + assert_equals( + window.print(), + undefined, + 'window.print() must synchronously return undefined in a fenced frame' + + ' without blocking on user input.'); + + assert_equals( + document.execCommand('print', false, null), + false, + 'execCommand(\'print\') must synchronously return false in a fenced frame' + + ' without blocking on user input.'); +} + +async function test_document_domain() { + assert_throws_dom('SecurityError', () => { + document.domain = 'example.test'; + }); + assert_throws_dom('SecurityError', () => { + document.domain = document.domain; + }); + assert_throws_dom('SecurityError', () => { + (new Document).domain = document.domain; + }); + assert_throws_dom('SecurityError', () => { + document.implementation.createHTMLDocument().domain = document.domain; + }); + assert_throws_dom('SecurityError', () => { + document.implementation.createDocument(null, '').domain = document.domain; + }); + assert_throws_dom('SecurityError', () => { + document.createElement('template').content.ownerDocument.domain = + document.domain; + }); +} + +async function test_presentation_request() { + assert_throws_dom('SecurityError', () => { + new PresentationRequest([location.href]); + }); +} + +async function test_screen_orientation_lock() { + try { + await screen.orientation.lock('portrait'); + } catch (e) { + assert_equals( + e.name, + 'SecurityError', + 'orientation.lock() must throw a SecurityError in a fenced frame.'); + return; + } + assert_unreached('orientation.lock() must throw an error'); +} + +async function test_pointer_lock() { + await simulateGesture(); + + const canvas = document.createElement('canvas'); + document.body.appendChild(canvas); + const pointerlockerror_promise = new Promise(resolve => { + document.addEventListener('pointerlockerror', resolve); + }); + try { + await canvas.requestPointerLock(); + } catch (e) { + assert_equals( + e.name, + 'SecurityError', + 'orientation.lock() must throws a SecurityError in a fenced frame.'); + await pointerlockerror_promise; + return; + } + assert_unreached('requestPointerLock() must fail in a fenced frame'); +} diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html new file mode 100644 index 0000000000..02f28bd82e --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html @@ -0,0 +1,28 @@ + + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js new file mode 100644 index 0000000000..027995a218 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js @@ -0,0 +1,18 @@ +self.addEventListener('fetch', async (e) => { + if (e.request.url.includes('fenced_frame_dedicated_worker_test')) { + e.respondWith(new Response('OK')); + return; + } + + e.respondWith(fetch(e.request).catch(() => { + return new Response('not found'); + })); +}) + +self.addEventListener('install', () => { + return self.skipWaiting(); +}); + +self.addEventListener('activate', () => { + return self.clients.claim(); +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js.headers b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js.headers new file mode 100644 index 0000000000..d0b9633bb0 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker-sw.js.headers @@ -0,0 +1 @@ +Service-Worker-Allowed: / diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker.js b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker.js new file mode 100644 index 0000000000..8a9fa5ef36 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-dedicated-worker.js @@ -0,0 +1,8 @@ +self.addEventListener('message', async (e) => { + if (e.data === 'fetch') { + // Send a request to non-existing URL but handled by SW. + const res = await fetch('./fenced_frame_dedicated_worker_test'); + const data = res.ok ? await res.text() : res.statusText; + self.postMessage(data); + } +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html new file mode 100644 index 0000000000..103236e52a --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html @@ -0,0 +1,37 @@ + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html new file mode 100644 index 0000000000..10bb7ff8bd --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html.headers b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType-nested.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType.js b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType.js new file mode 100644 index 0000000000..91003fc131 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-frameType.js @@ -0,0 +1,19 @@ +self.onmessage = function(e) { + var port = e.data.port; + var url = e.data.url; + + e.waitUntil(self.clients.matchAll({includeUncontrolled: true}) + .then(function(clients) { + var frame_type = "none"; + for (client of clients) { + if (client.url === url) { + frame_type = client.frameType; + break; + } + } + port.postMessage(frame_type); + }) + .catch(e => { + port.postMessage('clients.matchAll() rejected: ' + e); + })); +}; \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html new file mode 100644 index 0000000000..4d77d9e9a6 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html @@ -0,0 +1,11 @@ + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html.headers b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner-success.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html new file mode 100644 index 0000000000..aaf330f4f6 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html @@ -0,0 +1,16 @@ + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate.js b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate.js new file mode 100644 index 0000000000..a7a4db52ee --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate.js @@ -0,0 +1,18 @@ +self.importScripts('utils.js'); + +self.onmessage = function(e) { + var key = e.data.key; + var url = e.data.url; + + e.waitUntil(self.clients.claim().then(() => { + return self.clients.matchAll({type: 'window'}); + }).then(clients => { + return clients.map(client => { + // Check to make sure WindowClient.navigate() is supported. + if (client.url === url) { + return client.navigate(generateURL('serviceWorker-navigate-inner-success.html', + [key])); + } + }); + })); +}; diff --git a/testing/web-platform/tests/fenced-frame/resources/serviceWorker-push-sw.js b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-push-sw.js new file mode 100644 index 0000000000..e344b45fd8 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/serviceWorker-push-sw.js @@ -0,0 +1,19 @@ +self.addEventListener('install', e => e.waitUntil(skipWaiting())); +self.addEventListener('activate', e => e.waitUntil(clients.claim())); + +self.addEventListener('message', async e => { + const method = e.data; + + const promise = method === 'subscribe' ? + self.registration.pushManager.subscribe({userVisibleOnly: true}) : + Promise.resolve(); + const message = await promise + .then(() => { + return `${method}: Unexpectedly started`; + }) + .catch((e) => { + return e.message; + }); + + e.source.postMessage(message); +}); diff --git a/testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html new file mode 100644 index 0000000000..1cf3fc8680 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html @@ -0,0 +1,42 @@ + + + +Fenced frame accessing cookies + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html.headers new file mode 100644 index 0000000000..e2b453f463 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/unique-cookie-partition-inner.https.html.headers @@ -0,0 +1,2 @@ +Supports-Loading-Mode: fenced-frame +Set-Cookie: F=fenced; SameSite=Lax diff --git a/testing/web-platform/tests/fenced-frame/resources/utils.js b/testing/web-platform/tests/fenced-frame/resources/utils.js new file mode 100644 index 0000000000..4638f37cbb --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/utils.js @@ -0,0 +1,501 @@ +const STORE_URL = '/fenced-frame/resources/key-value-store.py'; +const BEACON_URL = '/fenced-frame/resources/automatic-beacon-store.py'; +const REMOTE_EXECUTOR_URL = '/fenced-frame/resources/remote-context-executor.https.html'; +const FLEDGE_BIDDING_URL = '/fenced-frame/resources/fledge-bidding-logic.js'; +const FLEDGE_BIDDING_WITH_SIZE_URL = '/fenced-frame/resources/fledge-bidding-logic-with-size.js'; +const FLEDGE_DECISION_URL = '/fenced-frame/resources/fledge-decision-logic.js'; + +// Creates a URL that includes a list of stash key UUIDs that are being used +// in the test. This allows us to generate UUIDs on the fly and let anything +// (iframes, fenced frames, pop-ups, etc...) that wouldn't have access to the +// original UUID variable know what the UUIDs are. +// @param {string} href - The base url of the page being navigated to +// @param {string list} keylist - The list of key UUIDs to be used. Note that +// order matters when extracting the keys +function generateURL(href, keylist) { + const ret_url = new URL(href, location.href); + ret_url.searchParams.append("keylist", keylist.join(',')); + return ret_url; +} + +function getRemoteContextURL(origin) { + return new URL(REMOTE_EXECUTOR_URL, origin); +} + +async function runSelectRawURL(href, resolve_to_config = false) { + try { + await sharedStorage.worklet.addModule( + "/shared-storage/resources/simple-module.js"); + } catch (e) { + // Shared Storage needs to have a module added before we can operate on it. + // It is generated on the fly with this call, and since there's no way to + // tell through the API if a module already exists, wrap the addModule call + // in a try/catch so that if it runs a second time in a test, it will + // gracefully fail rather than bring the whole test down. + } + return await sharedStorage.selectURL( + 'test-url-selection-operation', [{url: href}], { + data: {'mockResult': 0}, + resolveToConfig: resolve_to_config, + keepAlive: true + }); +} + +// Similar to generateURL, but creates +// 1. An urn:uuid if `resolve_to_config` is false. +// 2. A fenced frame config object if `resolve_to_config` is true. +// This relies on a mock Shared Storage auction, since it is the simplest +// WP-exposed way to turn a url into an urn:uuid or a fenced frame config. +// Note: this function, unlike generateURL, is asynchronous and needs to be +// called with an await operator. +// @param {string} href - The base url of the page being navigated to +// @param {string list} keylist - The list of key UUIDs to be used. Note that +// order matters when extracting the keys +// @param {boolean} [resolve_to_config = false] - Determines whether the result +// of `sharedStorage.selectURL()` +// is an urn:uuid or a fenced +// frame config. +// Note: +// 1. There is a limit of 3 calls per origin per pageload for +// `sharedStorage.selectURL()`, so `runSelectURL()` must also respect this +// limit. +// 2. If `resolve_to_config` is true, blink feature `FencedFramesAPIChanges` +// needs to be enabled for `selectURL()` to return a fenced frame config. +// Otherwise `selectURL()` will fall back to the old behavior that returns an +// urn:uuid. +async function runSelectURL(href, keylist = [], resolve_to_config = false) { + const full_url = generateURL(href, keylist); + return await runSelectRawURL(full_url, resolve_to_config); +} + +async function generateURNFromFledgeRawURL(href, + nested_urls, + resolve_to_config = false, + ad_with_size = false, + requested_size = null) { + const bidding_token = token(); + const seller_token = token(); + + const ad_components_list = nested_urls.map((url) => { + return ad_with_size ? + { renderUrl: url, sizeGroup: "group1" } : + { renderUrl: url } + }); + + const interestGroup = ad_with_size ? + { + name: 'testAd1', + owner: location.origin, + biddingLogicUrl: new URL(FLEDGE_BIDDING_WITH_SIZE_URL, location.origin), + ads: [{ renderUrl: href, sizeGroup: "group1", bid: 1 }], + userBiddingSignals: { biddingToken: bidding_token }, + trustedBiddingSignalsKeys: ['key1'], + adComponents: ad_components_list, + adSizes: { "size1": { width: "100px", height: "50px" } }, + sizeGroups: { "group1": ["size1"] } + } : + { + name: 'testAd1', + owner: location.origin, + biddingLogicUrl: new URL(FLEDGE_BIDDING_URL, location.origin), + ads: [{ renderUrl: href, bid: 1 }], + userBiddingSignals: { biddingToken: bidding_token }, + trustedBiddingSignalsKeys: ['key1'], + adComponents: ad_components_list, + }; + + // Pick an arbitrarily high duration to guarantee that we never leave the + // ad interest group while the test runs. + navigator.joinAdInterestGroup(interestGroup, /*durationSeconds=*/3000000); + + let auctionConfig = { + seller: location.origin, + interestGroupBuyers: [location.origin], + decisionLogicUrl: new URL(FLEDGE_DECISION_URL, location.origin), + auctionSignals: {biddingToken: bidding_token, sellerToken: seller_token}, + resolveToConfig: resolve_to_config + }; + if (requested_size) { + auctionConfig['requestedSize'] = {width: requested_size[0], height: requested_size[1]}; + } + return navigator.runAdAuction(auctionConfig); +} + +// Similar to runSelectURL, but uses FLEDGE instead of Shared Storage as the +// auctioning tool. +// Note: this function, unlike generateURL, is asynchronous and needs to be +// called with an await operator. @param {string} href - The base url of the +// page being navigated to @param {string list} keylist - The list of key UUIDs +// to be used. Note that order matters when extracting the keys +// @param {string} href - The base url of the page being navigated to +// @param {string list} keylist - The list of key UUIDs to be used. Note that +// order matters when extracting the keys +// @param {string list} nested_urls - A list of urls that will eventually become +// the nested configs/ad components +// @param {boolean} [resolve_to_config = false] - Determines whether the result +// of `navigator.runAdAuction()` +// is an urn:uuid or a fenced +// frame config. +// @param {boolean} [ad_with_size = false] - Determines whether the auction is +// run with ad sizes specified. +async function generateURNFromFledge(href, keylist, nested_urls=[], resolve_to_config = false, ad_with_size = false, requested_size = null) { + const full_url = generateURL(href, keylist); + return generateURNFromFledgeRawURL(full_url, nested_urls, resolve_to_config, ad_with_size, requested_size); +} + +// Extracts a list of UUIDs from the from the current page's URL. +// @returns {string list} - The list of UUIDs extracted from the page. This can +// be read into multiple variables using the +// [key1, key2, etc...] = parseKeyList(); pattern. +function parseKeylist() { + const url = new URL(location.href); + const keylist = url.searchParams.get("keylist"); + return keylist.split(','); +} + +// Converts a same-origin URL to a cross-origin URL +// @param {URL} url - The URL object whose origin is being converted +// @param {boolean} [https=true] - Whether or not to use the HTTPS origin +// +// @returns {URL} The new cross-origin URL +function getRemoteOriginURL(url, https=true) { + const same_origin = location.origin; + const cross_origin = https ? get_host_info().HTTPS_REMOTE_ORIGIN + : get_host_info().HTTP_REMOTE_ORIGIN; + return new URL(url.toString().replace(same_origin, cross_origin)); +} + +// Builds a URL to be used as a remote context executor. +function generateRemoteContextURL(headers, origin) { + // Generate the unique id for the parent/child channel. + const uuid = token(); + + // Use the absolute path of the remote context executor source file, so that + // nested contexts will work. + const url = getRemoteContextURL(origin ? origin : location.origin); + url.searchParams.append('uuid', uuid); + + // Add the header to allow loading in a fenced frame. + headers.push(["Supports-Loading-Mode", "fenced-frame"]); + + // Transform the headers into the expected format. + // https://web-platform-tests.org/writing-tests/server-pipes.html#headers + function escape(s) { + return s.replace('(', '\\(').replace(')', '\\)'); + } + const formatted_headers = headers.map((header) => { + return `header(${escape(header[0])}, ${escape(header[1])})`; + }); + url.searchParams.append('pipe', formatted_headers.join('|')); + + return [uuid, url]; +} + +function buildRemoteContextForObject(object, uuid, html) { + // https://github.com/web-platform-tests/wpt/blob/master/common/dispatcher/README.md + const context = new RemoteContext(uuid); + if (html) { + context.execute_script( + (html_source) => { + document.body.insertAdjacentHTML('beforebegin', html_source); + }, + [html]); + } + + // We need a little bit of boilerplate in the handlers because Proxy doesn't + // work so nicely with HTML elements. + const handler = { + get: (target, key) => { + if (key == "execute") { + return context.execute_script; + } + if (key == "element") { + return object; + } + if (key in target) { + return target[key]; + } + return context[key]; + }, + set: (target, key, value) => { + target[key] = value; + return value; + } + }; + + const proxy = new Proxy(object, handler); + return proxy; +} + +// Attaches an object that waits for scripts to execute from RemoteContext. +// (In practice, this is either a frame or a window.) +// Returns a proxy for the object that first resolves to the object itself, +// then resolves to the RemoteContext if the property isn't found. +// The proxy also has an extra attribute `execute`, which is an alias for the +// remote context's `execute_script(fn, args=[])`. +function attachContext(object_constructor, html, headers, origin) { + const [uuid, url] = generateRemoteContextURL(headers, origin); + const object = object_constructor(url); + return buildRemoteContextForObject(object, uuid, html); +} + +// TODO(crbug.com/1347953): Update this function to also test +// `sharedStorage.selectURL()` that returns a fenced frame config object. +// This should be done after fixing the following flaky tests that use this +// function. +// 1. crbug.com/1372536: resize-lock-input.https.html +// 2. crbug.com/1394559: unfenced-top.https.html +async function attachOpaqueContext(generator_api, resolve_to_config, ad_with_size, requested_size, object_constructor, html, headers, origin) { + const [uuid, url] = generateRemoteContextURL(headers, origin); + const id = await (generator_api == 'fledge' ? generateURNFromFledge(url, [], [], resolve_to_config, ad_with_size, requested_size) : runSelectURL(url, [], resolve_to_config)); + const object = object_constructor(id); + return buildRemoteContextForObject(object, uuid, html); +} + +function attachPotentiallyOpaqueContext(generator_api, resolve_to_config, ad_with_size, requested_size, frame_constructor, html, headers, origin) { + generator_api = generator_api.toLowerCase(); + if (generator_api == 'fledge' || generator_api == 'sharedstorage') { + return attachOpaqueContext(generator_api, resolve_to_config, ad_with_size, requested_size, frame_constructor, html, headers, origin); + } else { + return attachContext(frame_constructor, html, headers, origin); + } +} + +function attachFrameContext(element_name, generator_api, resolve_to_config, ad_with_size, requested_size, html, headers, attributes, origin) { + frame_constructor = (id) => { + frame = document.createElement(element_name); + attributes.forEach(attribute => { + frame.setAttribute(attribute[0], attribute[1]); + }); + if (element_name == "iframe") { + frame.src = id; + } else if (id instanceof FencedFrameConfig) { + frame.config = id; + } else { + const config = new FencedFrameConfig(id); + frame.config = config; + } + document.body.append(frame); + return frame; + }; + return attachPotentiallyOpaqueContext(generator_api, resolve_to_config, ad_with_size, requested_size, frame_constructor, html, headers, origin); +} + +function replaceFrameContext(frame_proxy, {generator_api="", resolve_to_config=false, ad_with_size=false, requested_size=null, html="", headers=[], origin=""}={}) { + frame_constructor = (id) => { + if (frame_proxy.element.nodeName == "IFRAME") { + frame_proxy.element.src = id; + } else if (id instanceof FencedFrameConfig) { + frame_proxy.element.config = id; + } else { + const config = new FencedFrameConfig(id); + frame_proxy.element.config = config; + } + return frame_proxy.element; + }; + return attachPotentiallyOpaqueContext(generator_api, resolve_to_config, ad_with_size, requested_size, frame_constructor, html, headers, origin); +} + +// Attach a fenced frame that waits for scripts to execute. +// Takes as input a(n optional) dictionary of configs: +// - generator_api: the name of the API that should generate the urn/config. +// Supports (case-insensitive) "fledge" and "sharedstorage", or any other +// value as a default. +// If you generate a urn, then you need to await the result of this function. +// - resolve_to_config: whether a config should be used. (currently only works +// for FLEDGE and sharedStorage generator_api) +// - ad_with_size: whether an ad auction is run with size specified for the ads +// and ad components. (currently only works for FLEDGE) +// - requested_size: A 2-element list with the width and height for +// requestedSize in the FLEDGE auction config. +// - html: extra HTML source code to inject into the loaded frame +// - headers: an array of header pairs [[key, value], ...] +// - attributes: an array of attribute pairs to set on the frame [[key, value], ...] +// - origin: origin of the url, default to location.origin if not set +// Returns a proxy that acts like the frame HTML element, but with an extra +// function `execute`. See `attachFrameContext` or the README for more details. +function attachFencedFrameContext({generator_api="", resolve_to_config=false, ad_with_size=false, requested_size=null, html = "", headers=[], attributes=[], origin=""}={}) { + return attachFrameContext('fencedframe', generator_api, resolve_to_config, ad_with_size, requested_size, html, headers, attributes, origin); +} + +// Attach an iframe that waits for scripts to execute. +// See `attachFencedFrameContext` for more details. +function attachIFrameContext({generator_api="", html="", headers=[], attributes=[], origin=""}={}) { + return attachFrameContext('iframe', generator_api, resolve_to_config=false, ad_with_size=false, requested_size=null, html, headers, attributes, origin); +} + +// Open a window that waits for scripts to execute. +// Returns a proxy that acts like the window object, but with an extra +// function `execute`. See `attachContext` for more details. +function attachWindowContext({target="_blank", html="", headers=[], origin=""}={}) { + window_constructor = (url) => { + return window.open(url, target); + } + + return attachContext(window_constructor, html, headers, origin); +} + +// Converts a key string into a key uuid using a cryptographic hash function. +// This function only works in secure contexts (HTTPS). +async function stringToStashKey(string) { + // Compute a SHA-256 hash of the input string, and convert it to hex. + const data = new TextEncoder().encode(string); + const digest = await crypto.subtle.digest('SHA-256', data); + const digest_array = Array.from(new Uint8Array(digest)); + const digest_as_hex = digest_array.map(b => b.toString(16).padStart(2, '0')).join(''); + + // UUIDs are structured as 8X-4X-4X-4X-12X. + // Use the first 32 hex digits and ignore the rest. + const digest_slices = [digest_as_hex.slice(0,8), + digest_as_hex.slice(8,12), + digest_as_hex.slice(12,16), + digest_as_hex.slice(16,20), + digest_as_hex.slice(20,32)]; + return digest_slices.join('-'); +} + +// Create a fenced frame. Then navigate it using the given `target`, which can +// be either an urn:uuid or a fenced frame config object. +function attachFencedFrame(target) { + assert_implements( + window.HTMLFencedFrameElement, + 'The HTMLFencedFrameElement should be exposed on the window object'); + + const fenced_frame = document.createElement('fencedframe'); + + if (target instanceof FencedFrameConfig) { + fenced_frame.config = target; + } else { + const config = new FencedFrameConfig(target); + fenced_frame.config = config; + } + + document.body.append(fenced_frame); + return fenced_frame; +} + +function attachIFrame(url) { + const iframe = document.createElement('iframe'); + iframe.src = url; + document.body.append(iframe); + return iframe; +} + +// Reads the value specified by `key` from the key-value store on the server. +async function readValueFromServer(key) { + // Resolve the key if it is a Promise. + key = await key; + + const serverUrl = `${STORE_URL}?key=${key}`; + const response = await fetch(serverUrl); + if (!response.ok) + throw new Error('An error happened in the server'); + const value = await response.text(); + + // The value is not stored in the server. + if (value === "") + return { status: false }; + + return { status: true, value: value }; +} + +// Convenience wrapper around the above getter that will wait until a value is +// available on the server. +async function nextValueFromServer(key) { + // Resolve the key if it is a Promise. + key = await key; + + while (true) { + // Fetches the test result from the server. + const { status, value } = await readValueFromServer(key); + if (!status) { + // The test result has not been stored yet. Retry after a while. + await new Promise(resolve => setTimeout(resolve, 20)); + continue; + } + + return value; + } +} + +// Reads the data from the latest automatic beacon sent to the server. +async function readAutomaticBeaconDataFromServer() { + const serverUrl = `${BEACON_URL}`; + const response = await fetch(serverUrl); + if (!response.ok) + throw new Error('An error happened in the server'); + const value = await response.text(); + + // The value is not stored in the server. + if (value === "") + return { status: false }; + + return { status: true, value: value }; +} + +// Convenience wrapper around the above getter that will wait until a value is +// available on the server. +async function nextAutomaticBeacon() { + while (true) { + // Fetches the test result from the server. + const { status, value } = await readAutomaticBeaconDataFromServer(); + if (!status) { + // The test result has not been stored yet. Retry after a while. + await new Promise(resolve => setTimeout(resolve, 20)); + continue; + } + + return value; + } +} + +// Writes `value` for `key` in the key-value store on the server. +async function writeValueToServer(key, value, origin = '') { + // Resolve the key if it is a Promise. + key = await key; + + const serverUrl = `${origin}${STORE_URL}?key=${key}&value=${value}`; + await fetch(serverUrl, {"mode": "no-cors"}); +} + +// Simulates a user gesture. +async function simulateGesture() { + // Wait until the window size is initialized. + while (window.innerWidth == 0) { + await new Promise(resolve => requestAnimationFrame(resolve)); + } + await test_driver.bless('simulate gesture'); +} + +// Fenced frames are always put in the public IP address space which is the +// least privileged. In case a navigation to a local data: URL or blob: URL +// resource is allowed, they would only be able to fetch things that are *also* +// in the public IP address space. So for the document described by these local +// URLs, we'll set them up to only communicate back to the outer page via +// resources obtained in the public address space. +function createLocalSource(key, url) { + return ` + + + + + +Fenced frame content to test Web Bluetooth + + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/web-bluetooth-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/web-bluetooth-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/web-bluetooth-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html b/testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html new file mode 100644 index 0000000000..682805d5d2 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html @@ -0,0 +1,23 @@ + + +Fenced frame content to report the value of Web NFC API + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html.headers b/testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/web-nfc-inner.https.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/web-share-inner.html b/testing/web-platform/tests/fenced-frame/resources/web-share-inner.html new file mode 100644 index 0000000000..aada6f04e1 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/web-share-inner.html @@ -0,0 +1,21 @@ + + + + + +Fenced frame content to test Web Share + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/web-share-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/web-share-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/web-share-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html b/testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html new file mode 100644 index 0000000000..897d9a0d59 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html @@ -0,0 +1,14 @@ + + +Fenced frame content to report the value of window.frameElement + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-frameElement-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html b/testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html new file mode 100644 index 0000000000..e5e5adef1d --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html @@ -0,0 +1,23 @@ + + + + +Fenced frame content to report the value of window.navigation + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html.headers new file mode 100644 index 0000000000..1b63235b7c --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-navigation-204-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame diff --git a/testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html b/testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html new file mode 100644 index 0000000000..81dee800fc --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html @@ -0,0 +1,36 @@ + + +Fenced frame content to report the result of prerendering + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-outer-dimensions-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html b/testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html new file mode 100644 index 0000000000..9008d7d923 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html @@ -0,0 +1,64 @@ + + + +Fenced frame content to report the value of window.parent + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-parent-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file diff --git a/testing/web-platform/tests/fenced-frame/resources/window-top-inner.html b/testing/web-platform/tests/fenced-frame/resources/window-top-inner.html new file mode 100644 index 0000000000..ddc30bf71b --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-top-inner.html @@ -0,0 +1,63 @@ + + + +Fenced frame content to report the value of window.top + + + + diff --git a/testing/web-platform/tests/fenced-frame/resources/window-top-inner.html.headers b/testing/web-platform/tests/fenced-frame/resources/window-top-inner.html.headers new file mode 100644 index 0000000000..6247f6d632 --- /dev/null +++ b/testing/web-platform/tests/fenced-frame/resources/window-top-inner.html.headers @@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file -- cgit v1.2.3