From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/feature-policy/META.yml | 4 + .../web-platform/tests/feature-policy/README.md | 59 +++ ...without-user-activation-disabled-tentative.html | 51 +++ ...hout-user-activation-enabled-tentative.sub.html | 51 +++ .../experimental-features/resources/common.js | 94 +++++ .../feature-policy-trust-token-redemption.html | 55 +++ ...s-without-user-activation-iframe-tentative.html | 47 +++ .../resources/lazyload-contents.html | 13 + .../experimental-features/resources/lazyload.png | Bin 0 -> 20819 bytes .../vertical-scroll-scrollable-content.html | 16 + .../resources/vertical-scroll-scrollbar-ref.html | 13 + .../resources/vertical-scroll-scrollintoview.html | 45 ++ .../resources/vertical-scroll-touch-action.html | 14 + .../resources/vertical-scroll-touch-block.html | 42 ++ .../resources/vertical-scroll-wheel-block.html | 22 + .../resources/vertical-scroll.js | 25 ++ ...default-feature-policy.tentative.https.sub.html | 62 +++ ...tion-supported-by-feature-policy.tentative.html | 9 + ...-disabled-frame-no-scroll-manual.tentative.html | 113 +++++ ...rtical-scroll-disabled-scrollbar-tentative.html | 4 + ...ertical-scroll-main-frame-manual.tentative.html | 46 +++ ...scroll-main-frame-manual.tentative.html.headers | 1 + .../vertical-scroll-scrollintoview.tentative.html | 117 ++++++ ...tical-scroll-touch-action-manual.tentative.html | 103 +++++ ...rtical-scroll-touch-block-manual.tentative.html | 237 +++++++++++ ...rtical-scroll-wheel-block-manual.tentative.html | 145 +++++++ ...icy-frame-policy-allowed-for-all.https.sub.html | 184 +++++++++ ...licy-allowed-for-all.https.sub.html.sub.headers | 1 + ...cy-frame-policy-allowed-for-self.https.sub.html | 186 +++++++++ ...icy-allowed-for-self.https.sub.html.sub.headers | 1 + ...policy-allowed-for-some-override.https.sub.html | 83 ++++ ...ed-for-some-override.https.sub.html.sub.headers | 1 + ...cy-frame-policy-allowed-for-some.https.sub.html | 136 ++++++ ...icy-allowed-for-some.https.sub.html.sub.headers | 1 + ...-frame-policy-disallowed-for-all.https.sub.html | 150 +++++++ ...y-disallowed-for-all.https.sub.html.sub.headers | 1 + ...rame-policy-timing-iframe-camera.https.sub.html | 15 + ...ature-policy-frame-policy-timing.https.sub.html | 69 ++++ ...cy-header-policy-allowed-for-all.https.sub.html | 61 +++ ...licy-allowed-for-all.https.sub.html.sub.headers | 1 + ...y-header-policy-allowed-for-self.https.sub.html | 45 ++ ...icy-allowed-for-self.https.sub.html.sub.headers | 1 + ...y-header-policy-allowed-for-some.https.sub.html | 76 ++++ ...icy-allowed-for-some.https.sub.html.sub.headers | 1 + ...re-policy-header-policy-declined.https.sub.html | 75 ++++ ...ader-policy-declined.https.sub.html.sub.headers | 1 + ...header-policy-disallowed-for-all.https.sub.html | 46 +++ ...y-disallowed-for-all.https.sub.html.sub.headers | 2 + ...ed-header-policy-allowed-for-all.https.sub.html | 66 +++ ...licy-allowed-for-all.https.sub.html.sub.headers | 1 + ...d-header-policy-allowed-for-self.https.sub.html | 63 +++ ...icy-allowed-for-self.https.sub.html.sub.headers | 1 + ...header-policy-disallowed-for-all.https.sub.html | 51 +++ ...y-disallowed-for-all.https.sub.html.sub.headers | 1 + ...olicy-attribute-redirect-on-load.https.sub.html | 28 ++ ...owed-by-feature-policy-attribute.https.sub.html | 26 ++ ...ayment-allowed-by-feature-policy.https.sub.html | 41 ++ ...llowed-by-feature-policy.https.sub.html.headers | 1 + .../payment-default-feature-policy.https.sub.html | 36 ++ ...yment-disabled-by-feature-policy.https.sub.html | 34 ++ ...sabled-by-feature-policy.https.sub.html.headers | 1 + ...ment-supported-by-feature-policy.tentative.html | 11 + ...ssions-policy-feature-policy-coexist.https.html | 25 ++ ...olicy-feature-policy-coexist.https.html.headers | 2 + ...y-header-policy-allowed-for-self.https.sub.html | 45 ++ ...icy-allowed-for-self.https.sub.html.sub.headers | 1 + ...olicy-attribute-redirect-on-load.https.sub.html | 31 ++ ...owed-by-feature-policy-attribute.https.sub.html | 30 ++ ...icture-allowed-by-feature-policy.https.sub.html | 33 ++ ...llowed-by-feature-policy.https.sub.html.headers | 1 + ...n-picture-default-feature-policy.https.sub.html | 34 ++ ...cture-disabled-by-feature-policy.https.sub.html | 33 ++ ...sabled-by-feature-policy.https.sub.html.headers | 1 + ...ure-in-picture-supported-by-feature-policy.html | 11 + .../feature-policy/policy-extends-to-sandbox.html | 26 ++ .../reporting/camera-reporting.https.html | 34 ++ .../reporting/camera-reporting.https.html.headers | 1 + .../reporting/encrypted-media-reporting.https.html | 37 ++ .../encrypted-media-reporting.https.html.headers | 1 + .../reporting/fullscreen-reporting.html | 45 ++ .../reporting/fullscreen-reporting.html.headers | 1 + .../reporting/generic-sensor-reporting.https.html | 55 +++ .../generic-sensor-reporting.https.html.headers | 1 + .../reporting/geolocation-reporting.https.html | 30 ++ .../geolocation-reporting.https.html.headers | 1 + .../tests/feature-policy/reporting/image.bmp | Bin 0 -> 6538 bytes .../reporting/microphone-reporting.https.html | 34 ++ .../microphone-reporting.https.html.headers | 1 + .../reporting/midi-reporting.https.html | 32 ++ .../reporting/midi-reporting.https.html.headers | 1 + .../reporting/payment-reporting.https.html | 37 ++ .../reporting/payment-reporting.https.html.headers | 1 + .../reporting/picture-in-picture-reporting.html | 46 +++ .../picture-in-picture-reporting.html.headers | 1 + .../reporting/serial-reporting.https.html | 54 +++ .../reporting/serial-reporting.https.html.headers | 1 + .../reporting/sync-xhr-reporting.html | 36 ++ .../reporting/sync-xhr-reporting.html.headers | 1 + .../reporting/usb-reporting.https.html | 30 ++ .../reporting/usb-reporting.https.html.headers | 1 + .../reporting/vr-report-only.https.html | 30 ++ .../reporting/vr-report-only.https.html.headers | 1 + .../reporting/vr-reporting.https.html | 32 ++ .../reporting/vr-reporting.https.html.headers | 1 + .../reporting/xr-reporting.https.html | 33 ++ .../reporting/xr-reporting.https.html.headers | 1 + .../tests/feature-policy/resources/autoplay.js | 28 ++ .../resources/feature-policy-allowedfeatures.html | 7 + .../resources/feature-policy-autoplay.html | 11 + .../resources/feature-policy-clipboard-read.html | 20 + .../resources/feature-policy-clipboard-write.html | 20 + .../resources/feature-policy-generic-sensor.html | 11 + ...re-policy-nested-subframe-policy.https.sub.html | 57 +++ .../resources/feature-policy-payment.html | 16 + .../feature-policy-picture-in-picture.html | 11 + .../resources/feature-policy-report-json.js | 20 + .../resources/feature-policy-webvr.html | 9 + .../feature-policy/resources/featurepolicy.js | 454 +++++++++++++++++++++ .../feature-policy/resources/nested-sandbox.html | 8 + .../feature-policy/resources/picture-in-picture.js | 30 ++ .../feature-policy/resources/redirect-on-load.html | 11 + .../feature-policy/resources/sandbox-self.html | 23 ++ .../resources/sandbox-self.html.headers | 1 + 123 files changed, 4476 insertions(+) create mode 100644 testing/web-platform/tests/feature-policy/META.yml create mode 100644 testing/web-platform/tests/feature-policy/README.md create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-disabled-tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-enabled-tentative.sub.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/common.js create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/feature-policy-trust-token-redemption.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/focus-without-user-activation-iframe-tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/lazyload-contents.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/lazyload.png create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-scrollable-content.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-scrollbar-ref.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-scrollintoview.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-action.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-block.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-wheel-block.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll.js create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-default-feature-policy.tentative.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-supported-by-feature-policy.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-frame-no-scroll-manual.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-scrollbar-tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html.headers create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-scrollintoview.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-action-manual.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-wheel-block-manual.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing-iframe-camera.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers create mode 100644 testing/web-platform/tests/feature-policy/payment-default-feature-policy.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers create mode 100644 testing/web-platform/tests/feature-policy/payment-supported-by-feature-policy.tentative.html create mode 100644 testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html create mode 100644 testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html.sub.headers create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html.headers create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html.headers create mode 100644 testing/web-platform/tests/feature-policy/picture-in-picture-supported-by-feature-policy.html create mode 100644 testing/web-platform/tests/feature-policy/policy-extends-to-sandbox.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/image.bmp create mode 100644 testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html create mode 100644 testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers create mode 100644 testing/web-platform/tests/feature-policy/resources/autoplay.js create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-allowedfeatures.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-autoplay.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-read.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-write.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-generic-sensor.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-nested-subframe-policy.https.sub.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-payment.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-picture-in-picture.html create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-report-json.js create mode 100644 testing/web-platform/tests/feature-policy/resources/feature-policy-webvr.html create mode 100644 testing/web-platform/tests/feature-policy/resources/featurepolicy.js create mode 100644 testing/web-platform/tests/feature-policy/resources/nested-sandbox.html create mode 100644 testing/web-platform/tests/feature-policy/resources/picture-in-picture.js create mode 100644 testing/web-platform/tests/feature-policy/resources/redirect-on-load.html create mode 100644 testing/web-platform/tests/feature-policy/resources/sandbox-self.html create mode 100644 testing/web-platform/tests/feature-policy/resources/sandbox-self.html.headers (limited to 'testing/web-platform/tests/feature-policy') diff --git a/testing/web-platform/tests/feature-policy/META.yml b/testing/web-platform/tests/feature-policy/META.yml new file mode 100644 index 0000000000..5fb6249c67 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/META.yml @@ -0,0 +1,4 @@ +spec: https://wicg.github.io/feature-policy/ +suggested_reviewers: + - bakulf + - clelland diff --git a/testing/web-platform/tests/feature-policy/README.md b/testing/web-platform/tests/feature-policy/README.md new file mode 100644 index 0000000000..646fc1e0be --- /dev/null +++ b/testing/web-platform/tests/feature-policy/README.md @@ -0,0 +1,59 @@ +# Feature Policy Guide +## How to Test a New Feature with Feature Policy + +This directory contains a framework to test features with feature policy. + +When adding a new feature to feature policy, the following cases should be tested: +* feature enabled by header policy [HTTP tests] + + test when feature is enabled by feature policy HTTP header; +* feature disabled by header policy [HTTP tests] + + test when feature is disabled by feature policy HTTP header; +* feature enabled on self origin by header policy [HTTP tests] + + test when feature is enabled only on self origin by feature policy HTTP + header. +* feature allowed by container policy (iframe "allow" attribute); + + test when feature is enabled by iframe "allow" attribute on self and cross + origins. +* feature allowed by container policy, redirect on load. + + test when feature is enabled by iframe "allow" attribute when the iframe + is being redirected to a new origin upon loading + +### How to Use the Test Framework +Use `test_feature_availability()` defined in +`/feature-policy/resources/featurepolicy.js`. Please refer to the comments +in `/feature-policy/resources/featurepolicy.js` for how this function works. + +### How to Write Header Policy Tests +HTTP tests are used to test features with header policy. + +* Define the header policy in `--by-feature-policy.https.sub.html.headers`. Example: + + Feature-Policy: feature-name * + + +* In `--by-feature-policy.https.sub.html`: +* test if feature is enabled / disabled in the main frame; +* test if feature is enabled / disabled in a same-origin iframe; +* test if feature is enabled / disabled in a cross-origin iframe. + +Examples: +`/feature-policy/payment-disabled-by-feature-policy.https.sub.html` +`/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers` + +### How to Write Container Policy Tests +Simply use `test_feature_availability()` with the optional argument +`feature_name` specified to test if: +* feature is enabled / disabled in a same-origin iframe; +* feature is enabled / disabled in a cross-origin iframe. + +Example: +`/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html` + +### How to Write Container Policy Tests with Redirect +Similar to the section above, append +`/feature-policy/resources/redirect-on-load.html#` to the argument `src` +passed to `test_feature_availability()`. + +Example: +`/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html` + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-disabled-tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-disabled-tentative.html new file mode 100644 index 0000000000..c4413f7804 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-disabled-tentative.html @@ -0,0 +1,51 @@ + + + + + 'focus-without-user-activation' Policy : Correctly block automatic focus when policy disabled + + + + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-enabled-tentative.sub.html b/testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-enabled-tentative.sub.html new file mode 100644 index 0000000000..411e4f2fa0 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/focus-without-user-activation-enabled-tentative.sub.html @@ -0,0 +1,51 @@ + + + + + 'focus-without-user-activation' Policy : Correctly block automatic focus when policy disabled + + + + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/resources/common.js b/testing/web-platform/tests/feature-policy/experimental-features/resources/common.js new file mode 100644 index 0000000000..4266e39495 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/resources/common.js @@ -0,0 +1,94 @@ +const url_base = "/feature-policy/experimental-features/resources/"; +window.messageResponseCallback = null; + +function setFeatureState(iframe, feature, origins) { + iframe.setAttribute("allow", `${feature} ${origins};`); +} + +// Returns a promise which is resolved when the + + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-scrollintoview.html b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-scrollintoview.html new file mode 100644 index 0000000000..7bed27c260 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-scrollintoview.html @@ -0,0 +1,45 @@ + + +
+
+ +
+ diff --git a/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-action.html b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-action.html new file mode 100644 index 0000000000..51b715f30a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-action.html @@ -0,0 +1,14 @@ + + + +

This page blocks all 'touch-action'.

+ diff --git a/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-block.html b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-block.html new file mode 100644 index 0000000000..4c204055af --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-touch-block.html @@ -0,0 +1,42 @@ + + + +
+

This page blocks 'touchstart' and 'touchmove'.

+
+ + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-wheel-block.html b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-wheel-block.html new file mode 100644 index 0000000000..21fc2b9b39 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll-wheel-block.html @@ -0,0 +1,22 @@ + + + +

This page blocks all 'mouse-wheel'.

+ + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll.js b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll.js new file mode 100644 index 0000000000..88835cc602 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/resources/vertical-scroll.js @@ -0,0 +1,25 @@ +function rectMaxY(rect) { + return rect.height + rect.y; +} + +function rectMaxX(rect) { + return rect.width + rect.x; +} + +function isEmptyRect(rect) { + return !rect.width || !rect.height; +} + +// Returns true if the given rectangles intersect. +function rects_intersect(rect1, rect2) { + if (isEmptyRect(rect1) || isEmptyRect(rect2)) + return false; + return rect1.x < rectMaxX(rect2) && + rect2.x < rectMaxX(rect1) && + rect1.y < rectMaxY(rect2) && + rect2.y < rectMaxY(rect1); +} + +function rectToString(rect) { + return `Location: (${rect.x}, ${rect.y}) Size: (${rect.width}, ${rect.height})`; +} diff --git a/testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-default-feature-policy.tentative.https.sub.html b/testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-default-feature-policy.tentative.https.sub.html new file mode 100644 index 0000000000..134ccc084d --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-default-feature-policy.tentative.https.sub.html @@ -0,0 +1,62 @@ + +Test that trust token redemption is enabled/disabled according to the feature policy + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-supported-by-feature-policy.tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-supported-by-feature-policy.tentative.html new file mode 100644 index 0000000000..e349eadc5d --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/trust-token-redemption-supported-by-feature-policy.tentative.html @@ -0,0 +1,9 @@ + +Test that trust token redemption is advertised in the feature list + + + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-frame-no-scroll-manual.tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-frame-no-scroll-manual.tentative.html new file mode 100644 index 0000000000..6f827c919a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-frame-no-scroll-manual.tentative.html @@ -0,0 +1,113 @@ + + +vertical-scroll test for touch-action + + + + + + +
+

Spacers below to make page scrollable

+
+
+
+

EOF

+ + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-scrollbar-tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-scrollbar-tentative.html new file mode 100644 index 0000000000..6036234de1 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-disabled-scrollbar-tentative.html @@ -0,0 +1,4 @@ + +vertical-scroll test for vertical scrollbar + + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html new file mode 100644 index 0000000000..34cf142d45 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html @@ -0,0 +1,46 @@ + +Ensure 'vertical-scroll' does not affect main frame + + + + + +

Making sure there is room for vertical scroll

+
+
+

EOP

+ diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html.headers b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html.headers new file mode 100644 index 0000000000..44072fce56 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-main-frame-manual.tentative.html.headers @@ -0,0 +1 @@ +Feature-Policy: vertical-scroll 'none' diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-scrollintoview.tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-scrollintoview.tentative.html new file mode 100644 index 0000000000..689685a497 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-scrollintoview.tentative.html @@ -0,0 +1,117 @@ + + + + + + +

An <iframe> further below which is not allowed to block scroll.

+
+ +

Making sure there is room for vertical scroll

+ diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-action-manual.tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-action-manual.tentative.html new file mode 100644 index 0000000000..c1b5f1d076 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-action-manual.tentative.html @@ -0,0 +1,103 @@ + + +vertical-scroll test for touch-action + + + + + + +
+

Spacers below to make page scrollable

+
+
+
+

EOF

+ + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html new file mode 100644 index 0000000000..82f6ca527f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html @@ -0,0 +1,237 @@ + +vertical-scroll test for touch-action + + + + + + +
+

Spacers below to make page scrollable

+
+
+
+

EOF

+ + diff --git a/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-wheel-block-manual.tentative.html b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-wheel-block-manual.tentative.html new file mode 100644 index 0000000000..398aa1f5af --- /dev/null +++ b/testing/web-platform/tests/feature-policy/experimental-features/vertical-scroll-wheel-block-manual.tentative.html @@ -0,0 +1,145 @@ + +vertical-scroll test for 'mousewheel' + + + + + + +
+

Spacers below to make page scrollable

+
+
+
+

EOF

+ diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html new file mode 100644 index 0000000000..63cd9853dc --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html @@ -0,0 +1,184 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html.sub.headers new file mode 100644 index 0000000000..111121a52f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-all.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen *; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html new file mode 100644 index 0000000000..9cf56ec798 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html @@ -0,0 +1,186 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html.sub.headers new file mode 100644 index 0000000000..0cc259b24f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-self.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'self'; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html new file mode 100644 index 0000000000..744c950248 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html @@ -0,0 +1,83 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html.sub.headers new file mode 100644 index 0000000000..c2493a0890 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some-override.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'self' https://{{domains[www]}}:{{ports[https][0]}} https://www.example.com; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html new file mode 100644 index 0000000000..5dfd8430d2 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html @@ -0,0 +1,136 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html.sub.headers new file mode 100644 index 0000000000..c2493a0890 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-allowed-for-some.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'self' https://{{domains[www]}}:{{ports[https][0]}} https://www.example.com; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html new file mode 100644 index 0000000000..7ac821d885 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html @@ -0,0 +1,150 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html.sub.headers new file mode 100644 index 0000000000..961d40336a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-disallowed-for-all.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'none'; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing-iframe-camera.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing-iframe-camera.https.sub.html new file mode 100644 index 0000000000..995ac2134e --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing-iframe-camera.https.sub.html @@ -0,0 +1,15 @@ + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing.https.sub.html new file mode 100644 index 0000000000..c78d16132b --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-frame-policy-timing.https.sub.html @@ -0,0 +1,69 @@ + + +
+ allow/sandbox attr changed after document creation, before response + + + +
+ +
+ + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html new file mode 100644 index 0000000000..a036859451 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html @@ -0,0 +1,61 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html.sub.headers new file mode 100644 index 0000000000..111121a52f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-all.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen *; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html new file mode 100644 index 0000000000..b6fbdd2cc2 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html.sub.headers new file mode 100644 index 0000000000..0cc259b24f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-self.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'self'; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html new file mode 100644 index 0000000000..5eda8baa08 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html @@ -0,0 +1,76 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html.sub.headers new file mode 100644 index 0000000000..c2493a0890 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'self' https://{{domains[www]}}:{{ports[https][0]}} https://www.example.com; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html new file mode 100644 index 0000000000..17378e3e13 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html @@ -0,0 +1,75 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html.sub.headers new file mode 100644 index 0000000000..4ac2a4a588 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen https://{{domains[www]}}:{{ports[https][0]}} https://www.example.com; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html new file mode 100644 index 0000000000..936f261937 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html.sub.headers new file mode 100644 index 0000000000..04d160ae10 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-header-policy-disallowed-for-all.https.sub.html.sub.headers @@ -0,0 +1,2 @@ +Feature-Policy: fullscreen 'none'; + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html new file mode 100644 index 0000000000..184cd01342 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html.sub.headers new file mode 100644 index 0000000000..111121a52f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-all.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen *; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html new file mode 100644 index 0000000000..fe857c916c --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html @@ -0,0 +1,63 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html.sub.headers new file mode 100644 index 0000000000..0cc259b24f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-allowed-for-self.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'self'; diff --git a/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html new file mode 100644 index 0000000000..6194a33b1d --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html @@ -0,0 +1,51 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html.sub.headers new file mode 100644 index 0000000000..961d40336a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/feature-policy-nested-header-policy-disallowed-for-all.https.sub.html.sub.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'none'; diff --git a/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html new file mode 100644 index 0000000000..df53af2236 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html @@ -0,0 +1,28 @@ + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html new file mode 100644 index 0000000000..eeebe399ac --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html @@ -0,0 +1,26 @@ + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html new file mode 100644 index 0000000000..b69fa62c05 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html @@ -0,0 +1,41 @@ + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers new file mode 100644 index 0000000000..a5c010bd68 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers @@ -0,0 +1 @@ +Feature-Policy: payment * diff --git a/testing/web-platform/tests/feature-policy/payment-default-feature-policy.https.sub.html b/testing/web-platform/tests/feature-policy/payment-default-feature-policy.https.sub.html new file mode 100644 index 0000000000..f73ac82ab7 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-default-feature-policy.https.sub.html @@ -0,0 +1,36 @@ + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html b/testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html new file mode 100644 index 0000000000..0e479fd2a3 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html @@ -0,0 +1,34 @@ + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers b/testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers new file mode 100644 index 0000000000..a2836778bc --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers @@ -0,0 +1 @@ +Feature-Policy: payment 'none' diff --git a/testing/web-platform/tests/feature-policy/payment-supported-by-feature-policy.tentative.html b/testing/web-platform/tests/feature-policy/payment-supported-by-feature-policy.tentative.html new file mode 100644 index 0000000000..07dec70176 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/payment-supported-by-feature-policy.tentative.html @@ -0,0 +1,11 @@ + +Test that payment is advertised in the feature list + + + + + diff --git a/testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html b/testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html new file mode 100644 index 0000000000..72836b0d1f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html @@ -0,0 +1,25 @@ + + + + +
+ This is a page with following headers:
+
+ Feature-Policy: geolocation 'none', fullscreen 'none'
+ Permissions-Policy: geolocation=self, payment=() +
+
+ + diff --git a/testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html.headers b/testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html.headers new file mode 100644 index 0000000000..100e68e9ad --- /dev/null +++ b/testing/web-platform/tests/feature-policy/permissions-policy-feature-policy-coexist.https.html.headers @@ -0,0 +1,2 @@ +Feature-Policy: geolocation 'none', fullscreen 'none' +Permissions-Policy: geolocation=self, payment=() diff --git a/testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html b/testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html new file mode 100644 index 0000000000..32df2b71c3 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html.sub.headers b/testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html.sub.headers new file mode 100644 index 0000000000..ff7ae41353 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/permissions-policy-header-policy-allowed-for-self.https.sub.html.sub.headers @@ -0,0 +1 @@ +Permissions-Policy: fullscreen=self diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html new file mode 100644 index 0000000000..a5ea5139a9 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute.https.sub.html b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute.https.sub.html new file mode 100644 index 0000000000..b0e160e938 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute.https.sub.html @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html new file mode 100644 index 0000000000..b09335a6de --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html.headers b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html.headers new file mode 100644 index 0000000000..0204b73b18 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html.headers @@ -0,0 +1 @@ +Feature-Policy: picture-in-picture * diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html b/testing/web-platform/tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html new file mode 100644 index 0000000000..477cf7ba51 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html b/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html new file mode 100644 index 0000000000..513d04c2fa --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html.headers b/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html.headers new file mode 100644 index 0000000000..1759381fdc --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html.headers @@ -0,0 +1 @@ +Feature-Policy: picture-in-picture 'none' diff --git a/testing/web-platform/tests/feature-policy/picture-in-picture-supported-by-feature-policy.html b/testing/web-platform/tests/feature-policy/picture-in-picture-supported-by-feature-policy.html new file mode 100644 index 0000000000..a65c682a6a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/picture-in-picture-supported-by-feature-policy.html @@ -0,0 +1,11 @@ + +Test that picture-in-picture is advertised in the feature list + + + + + diff --git a/testing/web-platform/tests/feature-policy/policy-extends-to-sandbox.html b/testing/web-platform/tests/feature-policy/policy-extends-to-sandbox.html new file mode 100644 index 0000000000..d45e64f49b --- /dev/null +++ b/testing/web-platform/tests/feature-policy/policy-extends-to-sandbox.html @@ -0,0 +1,26 @@ + +Feature policy treats opaque origins correctly + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html new file mode 100644 index 0000000000..708d3fa525 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html.headers new file mode 100644 index 0000000000..2adc5e237f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/camera-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: camera 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html new file mode 100644 index 0000000000..32a5a2cc48 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html @@ -0,0 +1,37 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html.headers new file mode 100644 index 0000000000..73753a2e41 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: encrypted-media 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html b/testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html new file mode 100644 index 0000000000..d7b905744d --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html @@ -0,0 +1,45 @@ + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html.headers b/testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html.headers new file mode 100644 index 0000000000..d35e48ba40 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/fullscreen-reporting.html.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html new file mode 100644 index 0000000000..c29c069ee3 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html @@ -0,0 +1,55 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html.headers new file mode 100644 index 0000000000..80cc027530 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/generic-sensor-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: ambient-light-sensor 'none'; accelerometer 'none'; gyroscope 'none'; magnetometer 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html new file mode 100644 index 0000000000..e0eb275bcc --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html.headers new file mode 100644 index 0000000000..7e75481ea6 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/geolocation-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: geolocation 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/image.bmp b/testing/web-platform/tests/feature-policy/reporting/image.bmp new file mode 100644 index 0000000000..f2b88690fc Binary files /dev/null and b/testing/web-platform/tests/feature-policy/reporting/image.bmp differ diff --git a/testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html new file mode 100644 index 0000000000..14ae976cde --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html.headers new file mode 100644 index 0000000000..a86e0a0778 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/microphone-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: microphone 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html new file mode 100644 index 0000000000..6cc07f5371 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html.headers new file mode 100644 index 0000000000..0e145978a0 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: midi 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html new file mode 100644 index 0000000000..3c04db864d --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html @@ -0,0 +1,37 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html.headers new file mode 100644 index 0000000000..a2836778bc --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: payment 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html b/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html new file mode 100644 index 0000000000..177e4d5c02 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html.headers b/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html.headers new file mode 100644 index 0000000000..1759381fdc --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html.headers @@ -0,0 +1 @@ +Feature-Policy: picture-in-picture 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html new file mode 100644 index 0000000000..c96d8f878a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html.headers new file mode 100644 index 0000000000..be3e6afd42 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/serial-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: serial 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html b/testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html new file mode 100644 index 0000000000..416edf0cbb --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html.headers b/testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html.headers new file mode 100644 index 0000000000..21a909e1fb --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/sync-xhr-reporting.html.headers @@ -0,0 +1 @@ +Feature-Policy: sync-xhr 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html new file mode 100644 index 0000000000..1ec5ba4370 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html.headers new file mode 100644 index 0000000000..4fd1e26936 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/usb-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: usb 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html b/testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html new file mode 100644 index 0000000000..b64a2015f7 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html.headers new file mode 100644 index 0000000000..0761021f45 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/vr-report-only.https.html.headers @@ -0,0 +1 @@ +Feature-Policy-Report-Only: vr 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html new file mode 100644 index 0000000000..b47f7e187e --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html.headers new file mode 100644 index 0000000000..d021af7563 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: vr 'none' diff --git a/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html new file mode 100644 index 0000000000..d87d4fb028 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers new file mode 100644 index 0000000000..2c75896233 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: xr-spatial-tracking 'none' diff --git a/testing/web-platform/tests/feature-policy/resources/autoplay.js b/testing/web-platform/tests/feature-policy/resources/autoplay.js new file mode 100644 index 0000000000..56780cf6dc --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/autoplay.js @@ -0,0 +1,28 @@ + + +function simulateGesture(t, callback) { + // Get or create the target element. + let target = document.getElementById('target'); + if (!target) { + target = document.createElement('button'); + target.setAttribute('id', 'target'); + document.body.appendChild(target); + } + + // Simulate a gesture in the top frame to remove any gesture based autoplay + // restrictions. + test_driver.click(target).then(callback, t.unreached_func('click failed')); +} + +function isAutoplayAllowed() { + return new Promise((resolve, reject) => { + const video = document.createElement('video'); + video.src = getVideoURI('/media/A4'); + video.play().then(() => resolve(true), (e) => { + if (e.name == 'NotAllowedError') + resolve(false); + else + resolve(true); + }); + }); +} diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-allowedfeatures.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-allowedfeatures.html new file mode 100644 index 0000000000..f4b020273f --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-allowedfeatures.html @@ -0,0 +1,7 @@ + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-autoplay.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-autoplay.html new file mode 100644 index 0000000000..79f8eefb9d --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-autoplay.html @@ -0,0 +1,11 @@ + + + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-read.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-read.html new file mode 100644 index 0000000000..10fc45fd93 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-read.html @@ -0,0 +1,20 @@ + + + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-write.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-write.html new file mode 100644 index 0000000000..7eb96e3db0 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-clipboard-write.html @@ -0,0 +1,20 @@ + + + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-generic-sensor.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-generic-sensor.html new file mode 100644 index 0000000000..59652e2e7a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-generic-sensor.html @@ -0,0 +1,11 @@ + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-nested-subframe-policy.https.sub.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-nested-subframe-policy.https.sub.html new file mode 100644 index 0000000000..30525d8a3c --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-nested-subframe-policy.https.sub.html @@ -0,0 +1,57 @@ + + + + + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-payment.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-payment.html new file mode 100644 index 0000000000..401a86eb23 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-payment.html @@ -0,0 +1,16 @@ + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-picture-in-picture.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-picture-in-picture.html new file mode 100644 index 0000000000..2f33c44953 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-picture-in-picture.html @@ -0,0 +1,11 @@ + + + diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-report-json.js b/testing/web-platform/tests/feature-policy/resources/feature-policy-report-json.js new file mode 100644 index 0000000000..08a0ecaded --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-report-json.js @@ -0,0 +1,20 @@ +/** + * @fileoverview functions for ensuring feature policy report is serializable + */ + +const check_report_json = (report) => { + // Ensures toJSON method exists on report. + assert_equals(typeof report.toJSON, "function"); + const report_json = report.toJSON(); + // Ensures toJSON() call is successful. + assert_equals(report.type, report_json.type); + assert_equals(report.url, report_json.url); + assert_equals(report.body.featureId, report_json.body.featureId); + assert_equals(report.body.disposition, report_json.body.disposition); + assert_equals(report.body.sourceFile, report_json.body.sourceFile); + assert_equals(report.body.lineNumber, report_json.body.lineNumber); + assert_equals(report.body.columnNumber, report_json.body.columnNumber); + // Ensures JSON.stringify() serializes the report correctly. + assert_false(JSON.stringify(report) === "{}"); + assert_equals(JSON.stringify(report), JSON.stringify(report_json)); +} \ No newline at end of file diff --git a/testing/web-platform/tests/feature-policy/resources/feature-policy-webvr.html b/testing/web-platform/tests/feature-policy/resources/feature-policy-webvr.html new file mode 100644 index 0000000000..64a152bf1c --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-webvr.html @@ -0,0 +1,9 @@ + diff --git a/testing/web-platform/tests/feature-policy/resources/featurepolicy.js b/testing/web-platform/tests/feature-policy/resources/featurepolicy.js new file mode 100644 index 0000000000..864c434c66 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/featurepolicy.js @@ -0,0 +1,454 @@ +// Feature test to avoid timeouts +function assert_feature_policy_supported() { + assert_not_equals(document.featurePolicy, undefined, + 'Feature Policy is supported'); +} +// Tests whether a feature that is enabled/disabled by feature policy works +// as expected. +// Arguments: +// feature_description: a short string describing what feature is being +// tested. Examples: "usb.GetDevices()", "PaymentRequest()". +// test: test created by testharness. Examples: async_test, promise_test. +// src: URL where a feature's availability is checked. Examples: +// "/feature-policy/resources/feature-policy-payment.html", +// "/feature-policy/resources/feature-policy-usb.html". +// expect_feature_available: a callback(data, feature_description) to +// verify if a feature is available or unavailable as expected. +// The file under the path "src" defines what "data" is sent back as a +// postMessage. Inside the callback, some tests (e.g., EXPECT_EQ, +// EXPECT_TRUE, etc) are run accordingly to test a feature's +// availability. +// Example: expect_feature_available_default(data, feature_description). +// feature_name: Optional argument, only provided when testing iframe allow +// attribute. "feature_name" is the feature name of a policy controlled +// feature (https://wicg.github.io/feature-policy/#features). +// See examples at: +// https://github.com/WICG/feature-policy/blob/master/features.md +// allow_attribute: Optional argument, only used for testing fullscreen: +// "allowfullscreen" +function test_feature_availability( + feature_description, test, src, expect_feature_available, feature_name, + allow_attribute) { + let frame = document.createElement('iframe'); + frame.src = src; + + if (typeof feature_name !== 'undefined') { + frame.allow = frame.allow.concat(";" + feature_name); + } + + if (typeof allow_attribute !== 'undefined') { + frame.setAttribute(allow_attribute, true); + } + + window.addEventListener('message', test.step_func(function handler(evt) { + if (evt.source === frame.contentWindow) { + expect_feature_available(evt.data, feature_description); + document.body.removeChild(frame); + window.removeEventListener('message', handler); + test.done(); + } + })); + + document.body.appendChild(frame); +} + +// Default helper functions to test a feature's availability: +function expect_feature_available_default(data, feature_description) { + assert_true(data.enabled, feature_description); +} + +function expect_feature_unavailable_default(data, feature_description) { + assert_false(data.enabled, feature_description); +} + +// This is the same as test_feature_availability() but instead of passing in a +// function to check the result of the message sent back from an iframe, instead +// just compares the result to an expected result passed in. +// Arguments: +// test: test created by testharness. Examples: async_test, promise_test. +// src: the URL to load in an iframe in which to test the feature. +// expected_result: the expected value to compare to the data passed back +// from the src page by postMessage. +// allow_attribute: Optional argument, only provided when an allow +// attribute should be specified on the iframe. +function test_feature_availability_with_post_message_result( + test, src, expected_result, allow_attribute) { + var test_result = function(data, feature_description) { + assert_equals(data, expected_result); + }; + test_feature_availability(null, test, src, test_result, allow_attribute); +} + +// If this page is intended to test the named feature (according to the URL), +// tests the feature availability and posts the result back to the parent. +// Otherwise, does nothing. +function test_feature_in_iframe(feature_name, feature_promise_factory) { + if (location.hash.endsWith(`#${feature_name}`)) { + feature_promise_factory().then( + () => window.parent.postMessage('#OK', '*'), + (e) => window.parent.postMessage('#' + e.name, '*')); + } +} + +// Returns true if the URL for this page indicates that it is embedded in an +// iframe. +function page_loaded_in_iframe() { + return location.hash.startsWith('#iframe'); +} + +// Returns a same-origin (relative) URL suitable for embedding in an iframe for +// testing the availability of the feature. +function same_origin_url(feature_name) { + // Append #iframe to the URL so we can detect the iframe'd version of the + // page. + return location.pathname + '#iframe#' + feature_name; +} + +// Returns a cross-origin (absolute) URL suitable for embedding in an iframe for +// testing the availability of the feature. +function cross_origin_url(base_url, feature_name) { + return base_url + same_origin_url(feature_name); +} + +// This function runs all feature policy tests for a particular feature that +// has a default policy of "self". This includes testing: +// 1. Feature usage succeeds by default in the top level frame. +// 2. Feature usage succeeds by default in a same-origin iframe. +// 3. Feature usage fails by default in a cross-origin iframe. +// 4. Feature usage suceeds when an allow attribute is specified on a +// cross-origin iframe. +// +// The same page which called this function will be loaded in the iframe in +// order to test feature usage there. When this function is called in that +// context it will simply run the feature and return a result back via +// postMessage. +// +// Arguments: +// cross_origin: A cross-origin URL base to be used to load the page which +// called into this function. +// feature_name: The name of the feature as it should be specified in an +// allow attribute. +// error_name: If feature usage does not succeed, this is the string +// representation of the error that will be passed in the rejected +// promise. +// feature_promise_factory: A function which returns a promise which tests +// feature usage. If usage succeeds, the promise should resolve. If it +// fails, the promise should reject with an error that can be +// represented as a string. +function run_all_fp_tests_allow_self( + cross_origin, feature_name, error_name, feature_promise_factory) { + // This may be the version of the page loaded up in an iframe. If so, just + // post the result of running the feature promise back to the parent. + if (page_loaded_in_iframe()) { + test_feature_in_iframe(feature_name, feature_promise_factory); + return; + } + + // Run the various tests. + // 1. Allowed in top-level frame. + promise_test( + () => feature_promise_factory(), + 'Default "' + feature_name + + '" feature policy ["self"] allows the top-level document.'); + + // 2. Allowed in same-origin iframe. + const same_origin_frame_pathname = same_origin_url(feature_name); + async_test( + t => { + test_feature_availability_with_post_message_result( + t, same_origin_frame_pathname, '#OK'); + }, + 'Default "' + feature_name + + '" feature policy ["self"] allows same-origin iframes.'); + + // 3. Blocked in cross-origin iframe. + const cross_origin_frame_url = cross_origin_url(cross_origin, feature_name); + async_test( + t => { + test_feature_availability_with_post_message_result( + t, cross_origin_frame_url, '#' + error_name); + }, + 'Default "' + feature_name + + '" feature policy ["self"] disallows cross-origin iframes.'); + + // 4. Allowed in cross-origin iframe with "allow" attribute. + async_test( + t => { + test_feature_availability_with_post_message_result( + t, cross_origin_frame_url, '#OK', feature_name); + }, + 'Feature policy "' + feature_name + + '" can be enabled in cross-origin iframes using "allow" attribute.'); +} + +// This function runs all feature policy tests for a particular feature that +// has a default policy of "*". This includes testing: +// 1. Feature usage succeeds by default in the top level frame. +// 2. Feature usage succeeds by default in a same-origin iframe. +// 3. Feature usage succeeds by default in a cross-origin iframe. +// 4. Feature usage fails when an allow attribute is specified on a +// cross-origin iframe with a value of "feature-name 'none'". +// +// The same page which called this function will be loaded in the iframe in +// order to test feature usage there. When this function is called in that +// context it will simply run the feature and return a result back via +// postMessage. +// +// Arguments: +// cross_origin: A cross-origin URL base to be used to load the page which +// called into this function. +// feature_name: The name of the feature as it should be specified in an +// allow attribute. +// error_name: If feature usage does not succeed, this is the string +// representation of the error that will be passed in the rejected +// promise. +// feature_promise_factory: A function which returns a promise which tests +// feature usage. If usage succeeds, the promise should resolve. If it +// fails, the promise should reject with an error that can be +// represented as a string. +function run_all_fp_tests_allow_all( + cross_origin, feature_name, error_name, feature_promise_factory) { + // This may be the version of the page loaded up in an iframe. If so, just + // post the result of running the feature promise back to the parent. + if (page_loaded_in_iframe()) { + test_feature_in_iframe(feature_name, feature_promise_factory); + return; + } + + // Run the various tests. + // 1. Allowed in top-level frame. + promise_test( + () => feature_promise_factory(), + 'Default "' + feature_name + + '" feature policy ["*"] allows the top-level document.'); + + // 2. Allowed in same-origin iframe. + const same_origin_frame_pathname = same_origin_url(feature_name); + async_test( + t => { + test_feature_availability_with_post_message_result( + t, same_origin_frame_pathname, '#OK'); + }, + 'Default "' + feature_name + + '" feature policy ["*"] allows same-origin iframes.'); + + // 3. Allowed in cross-origin iframe. + const cross_origin_frame_url = cross_origin_url(cross_origin, feature_name); + async_test( + t => { + test_feature_availability_with_post_message_result( + t, cross_origin_frame_url, '#OK'); + }, + 'Default "' + feature_name + + '" feature policy ["*"] allows cross-origin iframes.'); + + // 4. Blocked in cross-origin iframe with "allow" attribute set to 'none'. + async_test( + t => { + test_feature_availability_with_post_message_result( + t, cross_origin_frame_url, '#' + error_name, + feature_name + " 'none'"); + }, + 'Feature policy "' + feature_name + + '" can be disabled in cross-origin iframes using "allow" attribute.'); + + // 5. Blocked in same-origin iframe with "allow" attribute set to 'none'. + async_test( + t => { + test_feature_availability_with_post_message_result( + t, same_origin_frame_pathname, '#' + error_name, + feature_name + " 'none'"); + }, + 'Feature policy "' + feature_name + + '" can be disabled in same-origin iframes using "allow" attribute.'); +} + +// This function tests that a given policy allows each feature for the correct +// list of origins specified by the |expected_policy|. +// Arguments: +// expected_policy: A list of {feature, allowlist} pairs where the feature is +// enabled for every origin in the allowlist, in the |policy|. +// policy: Either a document.featurePolicy or an iframe.featurePolicy to be +// tested. +// message: A short description of what policy is being tested. +function test_allowlists(expected_policy, policy, message) { + for (var allowlist of allowlists) { + test(function() { + assert_array_equals( + policy.getAllowlistForFeature(allowlist.feature), + allowlist.allowlist); + }, message + ' for feature ' + allowlist.feature); + } +} + +// This function tests that a subframe's document policy allows a given feature. +// A feature is allowed in a frame either through inherited policy or specified +// by iframe allow attribute. +// Arguments: +// test: test created by testharness. Examples: async_test, promise_test. +// feature: feature name that should be allowed in the frame. +// src: the URL to load in the frame. +// allow: the allow attribute (container policy) of the iframe +function test_allowed_feature_for_subframe(message, feature, src, allow) { + let frame = document.createElement('iframe'); + if (typeof allow !== 'undefined') { + frame.allow = allow; + } + promise_test(function() { + assert_feature_policy_supported(); + frame.src = src; + return new Promise(function(resolve, reject) { + window.addEventListener('message', function handler(evt) { + resolve(evt.data); + }, { once: true }); + document.body.appendChild(frame); + }).then(function(data) { + assert_true(data.includes(feature), feature); + }); + }, message); +} + +// This function tests that a subframe's document policy disallows a given +// feature. A feature is allowed in a frame either through inherited policy or +// specified by iframe allow attribute. +// Arguments: +// test: test created by testharness. Examples: async_test, promise_test. +// feature: feature name that should not be allowed in the frame. +// src: the URL to load in the frame. +// allow: the allow attribute (container policy) of the iframe +function test_disallowed_feature_for_subframe(message, feature, src, allow) { + let frame = document.createElement('iframe'); + if (typeof allow !== 'undefined') { + frame.allow = allow; + } + promise_test(function() { + assert_feature_policy_supported(); + frame.src = src; + return new Promise(function(resolve, reject) { + window.addEventListener('message', function handler(evt) { + resolve(evt.data); + }, { once: true }); + document.body.appendChild(frame); + }).then(function(data) { + assert_false(data.includes(feature), feature); + }); + }, message); +} + +// This function tests that a subframe with header policy defined on a given +// feature allows and disallows the feature as expected. +// Arguments: +// feature: feature name. +// frame_header_policy: either *, 'self' or 'none', defines the frame +// document's header policy on |feature|. +// src: the URL to load in the frame. +// test_expects: contains 6 expected results of either |feature| is allowed +// or not inside of a local or remote iframe nested inside +// the subframe given the header policy to be either *, +// 'slef', or 'none'. +// test_name: name of the test. +function test_subframe_header_policy( + feature, frame_header_policy, src, test_expects, test_name) { + let frame = document.createElement('iframe'); + promise_test(function() { + assert_feature_policy_supported() + frame.src = src + '?pipe=sub|header(Feature-Policy,' + feature + ' ' + + frame_header_policy + ';)'; + return new Promise(function(resolve) { + window.addEventListener('message', function handler(evt) { + resolve(evt.data); + }); + document.body.appendChild(frame); + }).then(function(results) { + for (var j = 0; j < results.length; j++) { + var data = results[j]; + + function test_result(message, test_expect) { + if (test_expect) { + assert_true(data.allowedfeatures.includes(feature), message); + } else { + assert_false(data.allowedfeatures.includes(feature), message); + } + } + + if (data.frame === 'local') { + if (data.policy === '*') { + test_result('local_all:', test_expects.local_all); + } + if (data.policy === '\'self\'') { + test_result('local_self:', test_expects.local_self); + } + if (data.policy === '\'none\'') { + test_result('local_none:', test_expects.local_none); + } + } + + if (data.frame === 'remote') { + if (data.policy === '*') { + test_result('remote_all:', test_expects.remote_all); + } + if (data.policy === '\'self\'') { + test_result('remote_self:', test_expects.remote_self); + } + if (data.policy === '\'none\'') { + test_result('remote_none:', test_expects.remote_none); + } + } + } + }); + }, test_name); +} + +// This function tests that frame policy allows a given feature correctly. A +// feature is allowed in a frame either through inherited policy or specified +// by iframe allow attribute. +// Arguments: +// feature: feature name. +// src: the URL to load in the frame. If undefined, the iframe will have a +// srcdoc="" attribute +// test_expect: boolean value of whether the feature should be allowed. +// allow: optional, the allow attribute (container policy) of the iframe. +// allowfullscreen: optional, boolean value of allowfullscreen attribute. +// sandbox: optional boolean. If true, the frame will be sandboxed (with +// allow-scripts, so that tests can run in it.) +function test_frame_policy( + feature, src, srcdoc, test_expect, allow, allowfullscreen, sandbox) { + let frame = document.createElement('iframe'); + document.body.appendChild(frame); + // frame_policy should be dynamically updated as allow and allowfullscreen is + // updated. + var frame_policy = frame.featurePolicy; + if (typeof allow !== 'undefined') { + frame.setAttribute('allow', allow); + } + if (!!allowfullscreen) { + frame.setAttribute('allowfullscreen', true); + } + if (!!sandbox) { + frame.setAttribute('sandbox', 'allow-scripts'); + } + if (!!src) { + frame.src = src; + } + if (!!srcdoc) { + frame.srcdoc = "

Hello world!

"; + } + if (test_expect) { + assert_true(frame_policy.allowedFeatures().includes(feature)); + } else { + assert_false(frame_policy.allowedFeatures().includes(feature)); + } +} + +function expect_reports(report_count, policy_name, description) { + async_test(t => { + var num_received_reports = 0; + new ReportingObserver(t.step_func((reports, observer) => { + const relevant_reports = reports.filter(r => (r.body.featureId === policy_name)); + num_received_reports += relevant_reports.length; + if (num_received_reports >= report_count) { + t.done(); + } + }), {types: ['permissions-policy-violation'], buffered: true}).observe(); + }, description); +} diff --git a/testing/web-platform/tests/feature-policy/resources/nested-sandbox.html b/testing/web-platform/tests/feature-policy/resources/nested-sandbox.html new file mode 100644 index 0000000000..30af207092 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/nested-sandbox.html @@ -0,0 +1,8 @@ + +Return fullscreen feature policy state + diff --git a/testing/web-platform/tests/feature-policy/resources/picture-in-picture.js b/testing/web-platform/tests/feature-policy/resources/picture-in-picture.js new file mode 100644 index 0000000000..1bf3c1c12a --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/picture-in-picture.js @@ -0,0 +1,30 @@ +function async_pip_test(func, name) { + async_test(t => { + assert_true('pictureInPictureEnabled' in document, 'Picture-in-Picture API is available'); + func(t); + }, name); +} + +function promise_pip_test(func, name) { + promise_test(async t => { + assert_true('pictureInPictureEnabled' in document, 'Picture-in-Picture API is available'); + return func(t); + }, name); +} + +function isPictureInPictureAllowed() { + return new Promise(resolve => { + let video = document.createElement('video'); + video.src = getVideoURI('/media/movie_5'); + video.onloadedmetadata = () => { + video.requestPictureInPicture() + .then(() => resolve(document.pictureInPictureEnabled)) + .catch(e => { + if (e.name == 'NotAllowedError') + resolve(document.pictureInPictureEnabled); + else + resolve(false); + }); + }; + }); +} diff --git a/testing/web-platform/tests/feature-policy/resources/redirect-on-load.html b/testing/web-platform/tests/feature-policy/resources/redirect-on-load.html new file mode 100644 index 0000000000..1711655b03 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/redirect-on-load.html @@ -0,0 +1,11 @@ + + + + diff --git a/testing/web-platform/tests/feature-policy/resources/sandbox-self.html b/testing/web-platform/tests/feature-policy/resources/sandbox-self.html new file mode 100644 index 0000000000..3488338f96 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/sandbox-self.html @@ -0,0 +1,23 @@ + +Return fullscreen feature policy state from self and a sandboxed child frame + diff --git a/testing/web-platform/tests/feature-policy/resources/sandbox-self.html.headers b/testing/web-platform/tests/feature-policy/resources/sandbox-self.html.headers new file mode 100644 index 0000000000..16c20a7649 --- /dev/null +++ b/testing/web-platform/tests/feature-policy/resources/sandbox-self.html.headers @@ -0,0 +1 @@ +Feature-Policy: fullscreen 'self' -- cgit v1.2.3