From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../prefetch/anonymous-client.https.html | 20 + .../prefetch/cross-origin-cookies.https.html | 41 ++ .../prefetch/different-initiators-2.https.html | 52 +++ .../prefetch/different-initiators.sub.https.html | 81 ++++ .../prefetch/document-rules.https.html | 317 +++++++++++++++ .../prefetch/duplicate-urls.https.html | 21 + .../prefetch/initiators-a-element.sub.https.html | 79 ++++ .../initiators-iframe-location-href.sub.https.html | 48 +++ .../prefetch/initiators-window-open.sub.https.html | 68 ++++ .../prefetch/invalid-rules.https.html | 18 + .../prefetch/multiple-url.https.html | 21 + ...ation-timing-delivery-type.tentative.https.html | 59 +++ ...on-timing-requestStart-responseStart.https.html | 52 +++ .../prefetch/navigation-timing-sizes.https.html | 60 +++ .../prefetch/no-vary-search/README.txt | 1 + .../prefetch-single-with-hint.https.html | 337 ++++++++++++++++ .../no-vary-search/prefetch-single.https.html | 314 +++++++++++++++ .../prefetch/out-of-document-rule-set.https.html | 152 +++++++ .../prefetch/prefetch-single.https.html | 28 ++ .../prefetch/prefetch-status.https.html | 30 ++ .../prefetch/prefetch-traverse-reload.sub.html | 74 ++++ .../prefetch/redirect-url.https.html | 18 + .../prefetch/referrer-policy-from-rules.https.html | 143 +++++++ .../referrer-policy-not-accepted.https.html | 53 +++ .../prefetch/referrer-policy.https.html | 88 ++++ .../prefetch/resources/authenticate.py | 32 ++ .../prefetch/resources/cookies.py | 41 ++ .../prefetch/resources/executor.sub.html | 13 + .../prefetch/resources/prefetch.py | 16 + .../prefetch/resources/prefetch_nvs_hint.py | 34 ++ .../prefetch/resources/redirect.py | 3 + .../prefetch/resources/ruleset.py | 49 +++ .../speculation-rules/prefetch/resources/sw.js | 1 + .../prefetch/resources/utils.sub.js | 176 ++++++++ .../prefetch/same-origin-cookies.https.html | 39 ++ .../prefetch/user-pass.https.html | 44 ++ .../prerender/about-blank-iframes.html | 35 ++ .../prerender/accept-client-hint-cache.https.html | 40 ++ .../prerender/activation-start.html | 70 ++++ .../prerender/cache-storage.https.html | 35 ++ .../prerender/clients-matchall.https.html | 52 +++ .../speculation-rules/prerender/cookies.https.html | 37 ++ .../credentialed-prerender-not-opt-in.html | 26 ++ .../prerender/credentialed-prerender-opt-in.html | 22 + .../prerender/cross-origin-iframe.html | 63 +++ .../prerender/cross-origin-isolated.https.html | 28 ++ ...rc-elem-inline-speculation-rules.tentative.html | 28 ++ ...ipt-src-inline-speculation-rules.tentative.html | 28 ++ .../prerender/csp-script-src-self.html | 28 ++ .../prerender/csp-script-src-strict-dynamic.html | 28 ++ .../prerender/csp-script-src-unsafe-inline.html | 28 ++ .../speculation-rules/prerender/fetch-blob.html | 34 ++ .../fetch-intercepted-by-service-worker.https.html | 44 ++ .../prerender/iframe-added-post-activation.html | 33 ++ .../speculation-rules/prerender/indexeddb.html | 43 ++ .../speculation-rules/prerender/local-storage.html | 49 +++ .../prerender/main-frame-navigation.https.html | 39 ++ .../prerender/media-autoplay.html | 47 +++ ...gation-intercepted-by-service-worker.https.html | 42 ++ .../prerender/navigator-plugins.tentative.html | 52 +++ .../navigator-subapp.https.tentative.html | 31 ++ .../prerender/prefetch.https.html | 21 + .../prerender/referrer-policy-from-rules.html | 43 ++ .../prerender/referrer-policy-mismatch.html | 90 +++++ .../prerender/referrer-policy-no-referrer.html | 21 + .../prerender/referrer-policy-origin.html | 24 ++ .../prerender/referrer-policy-strict-origin.html | 22 + .../speculation-rules/prerender/referrer.html | 20 + .../prerender/register-service-worker.https.html | 53 +++ .../prerender/remove-script-element.html | 23 ++ .../prerender/resources/about-blank-iframes.html | 115 ++++++ .../prerender/resources/accept-ch.html | 4 + .../prerender/resources/accept-ch.html.headers | 2 + .../prerender/resources/audio-setSinkId.https.html | 27 ++ .../resources/background-fetch.https.html | 29 ++ .../prerender/resources/background-sync.https.html | 29 ++ .../prerender/resources/battery-status.https.html | 21 + .../prerender/resources/bear-av1-opus.mp4 | Bin 0 -> 50253 bytes .../resources/bluetooth-access.https.html | 25 ++ .../prerender/resources/broadcast-channel.html | 35 ++ .../prerender/resources/cache.txt | 1 + .../resources/clients-matchall-service-worker.js | 11 + .../resources/cross-origin-iframe-src.html | 7 + .../prerender/resources/cross-origin-iframe.html | 56 +++ .../cross-origin-isolated-iframe.https.html | 10 + ...cross-origin-isolated-iframe.https.html.headers | 2 + .../resources/cross-origin-isolated.https.html | 21 + .../cross-origin-isolated.https.html.headers | 2 + ...p-script-src-elem-inline-speculation-rules.html | 14 + .../csp-script-src-inline-speculation-rules.html | 14 + .../prerender/resources/csp-script-src-self.html | 15 + .../resources/csp-script-src-strict-dynamic.html | 15 + .../resources/csp-script-src-unsafe-inline.html | 10 + .../prerender/resources/csp-script-src.js | 57 +++ .../resources/dedicated-worker.https.html | 31 ++ .../prerender/resources/dedicated-worker.js | 1 + .../prerender/resources/deferred-promise-utils.js | 74 ++++ .../resources/deprecated-broadcast-channel.py | 28 ++ .../prerender/resources/do-nothing-worker.js | 1 + .../resources/echo-client-hints-received.py | 88 ++++ .../echo-prerender-page-client-hints-received.py | 96 +++++ .../prerender/resources/echo-referrer.py | 27 ++ .../echo-subresource-client-hints-received.py | 15 + .../prerender/resources/empty.html | 0 .../prerender/resources/encrypted-media.https.html | 39 ++ .../prerender/resources/exec.html | 18 + .../speculation-rules/prerender/resources/exec.py | 26 ++ .../prerender/resources/fetch-intercept-worker.js | 9 + .../fetch-intercepted-by-service-worker.html | 22 + .../prerender/resources/file-picker.html | 27 ++ .../prerender/resources/generic-sensor.https.html | 34 ++ .../prerender/resources/idle-detection.https.html | 27 ++ .../resources/iframe-added-post-activation.html | 57 +++ .../prerender/resources/indexedb-utils.js | 61 +++ .../prerender/resources/key-value-store.py | 27 ++ .../prerender/resources/main-frame-navigation.html | 84 ++++ .../resources/media-autoplay-attribute.html | 40 ++ .../resources/media-device-info.https.html | 25 ++ .../resources/media-devices-access.https.html | 26 ++ .../prerender/resources/media-play.html | 41 ++ .../prerender/resources/message-boxes.html | 50 +++ .../prerender/resources/midi.https.html | 37 ++ .../prerender/resources/navigator-plugins.html | 20 + .../resources/notification-before-activation.html | 40 ++ .../resources/notification-on-activation.html | 44 ++ ...ssage-prerendering-completion-notification.html | 7 + .../resources/postmessage-to-client-worker.js | 3 + .../resources/postmessage-to-service-worker.html | 34 ++ .../resources/prerender-response-code.html | 22 + .../prerender/resources/prerender-state.html | 85 ++++ .../prerender/resources/prerendered-iframe.html | 17 + .../prerender/resources/prerendered-page.html | 17 + .../prerender/resources/presentation-request.html | 26 ++ .../prompt-by-before-unload-inner-frame.html | 12 + .../resources/prompt-by-before-unload.html | 53 +++ .../prerender/resources/push.https.html | 31 ++ .../prerender/resources/referrer-test.js | 15 + .../resources/register-service-worker.html | 41 ++ .../resources/request-picture-in-picture.html | 34 ++ .../prerender/resources/sandbox-iframe.html | 50 +++ .../prerender/resources/screen-capture.https.html | 24 ++ .../resources/screen-orientation-lock.https.html | 23 ++ .../resources/service-worker-unregister.html | 34 ++ .../prerender/resources/service-worker-update.html | 33 ++ .../prerender/resources/service-worker.js | 11 + .../prerender/resources/session-history-harness.js | 75 ++++ .../resources/session-history-initiator.https.html | 61 +++ .../resources/session-history-prerender.https.html | 149 +++++++ .../resources/session-history-test-util.js | 40 ++ .../prerender/resources/shared-worker.py | 11 + .../resources/speech-synthesis.https.html | 65 +++ .../prerender/resources/storage-persist.https.html | 23 ++ .../prerender/resources/subapp.html | 26 ++ .../speculation-rules/prerender/resources/utils.js | 442 +++++++++++++++++++++ .../prerender/resources/wake-lock.https.html | 40 ++ .../prerender/resources/web-database-access.html | 22 + .../prerender/resources/web-hid.https.html | 23 ++ .../prerender/resources/web-locks.html | 32 ++ .../prerender/resources/web-nfc.https.html | 36 ++ .../prerender/resources/web-serial.https.html | 27 ++ .../prerender/resources/web-share.https.html | 24 ++ .../prerender/resources/web-usb.https.html | 22 + .../web-xr-immersive-vr-session.https.html | 24 ++ .../resources/web-xr-inline-session.https.html | 24 ++ .../prerender/resources/window-move.html | 62 +++ .../resources/window-open-during-prerendering.html | 41 ++ .../window-open-in-prerenderingchange.html | 65 +++ .../prerender/resources/window-resize.html | 64 +++ .../resources/windowclient-navigate-on-iframe.html | 97 +++++ .../resources/windowclient-navigate-worker.js | 38 ++ .../prerender/resources/worker-post-timeOrigin.js | 1 + .../resources/workers-in-cross-origin-iframe.html | 15 + .../prerender/response-code-non-successful.html | 30 ++ .../prerender/response-code-successful.html | 28 ++ ...SinkId-with-invalid-sinkId.https.tentative.html | 59 +++ ...estriction-audio-setSinkId.https.tentative.html | 58 +++ .../restriction-background-fetch.https.html | 66 +++ ...estriction-background-sync.tentative.https.html | 66 +++ .../restriction-battery-status.https.html | 47 +++ .../restriction-bluetooth.tentative.https.html | 59 +++ .../prerender/restriction-broadcast-channel.html | 60 +++ .../restriction-dedicated-worker.https.html | 56 +++ ...n-encrypted-media-unsupported-config.https.html | 57 +++ .../restriction-encrypted-media.https.html | 55 +++ .../prerender/restriction-focus.html | 40 ++ .../restriction-idle-detection.https.html | 35 ++ ...restriction-local-file-system-access.https.html | 32 ++ .../restriction-media-auto-play-attribute.html | 69 ++++ .../prerender/restriction-media-camera.https.html | 57 +++ .../restriction-media-device-info.https.html | 55 +++ .../restriction-media-microphone.https.html | 57 +++ .../prerender/restriction-media-play.html | 71 ++++ .../prerender/restriction-message-boxes.html | 51 +++ .../prerender/restriction-midi-sysex.https.html | 64 +++ .../prerender/restriction-midi.https.html | 64 +++ .../prerender/restriction-notification.https.html | 106 +++++ .../restriction-presentation-request.https.html | 33 ++ .../restriction-prompt-by-before-unload.html | 35 ++ .../prerender/restriction-push.https.html | 67 ++++ .../restriction-request-picture-in-picture.html | 36 ++ .../restriction-screen-capture.https.html | 35 ++ .../restriction-screen-orientation-lock.https.html | 48 +++ .../restriction-sensor-accelerometer.https.html | 64 +++ ...triction-sensor-ambient-light-sensor.https.html | 64 +++ .../restriction-sensor-gyroscope.https.html | 64 +++ .../restriction-sensor-magnetometer.https.html | 64 +++ ...striction-service-worker-postmessage.https.html | 59 +++ ...estriction-service-worker-unregister.https.html | 56 +++ .../restriction-service-worker-update.https.html | 56 +++ .../prerender/restriction-speech-synthesis.html | 61 +++ .../restriction-storage-persist.https.html | 55 +++ .../prerender/restriction-wake-lock.https.html | 72 ++++ .../prerender/restriction-web-hid.https.html | 47 +++ .../prerender/restriction-web-locks.https.html | 50 +++ .../prerender/restriction-web-nfc.https.html | 49 +++ .../restriction-web-serial.tentative.https.html | 49 +++ .../prerender/restriction-web-share.https.html | 34 ++ .../prerender/restriction-web-usb.https.html | 46 +++ ...triction-web-xr-immersive-vr-session.https.html | 57 +++ .../restriction-web-xr-inline-session.https.html | 57 +++ .../prerender/restriction-window-move.html | 49 +++ .../prerender/restriction-window-open.html | 41 ++ .../prerender/restriction-window-resize.html | 50 +++ .../speculation-rules/prerender/restrictions.html | 34 ++ .../prerender/sandbox-iframe.html | 57 +++ .../script-supports-speculationrules.html | 21 + .../prerender/service-workers.https.html | 117 ++++++ .../session-history-activation.https.html | 28 ++ .../prerender/session-history-location.https.html | 36 ++ .../session-history-navigation.https.html | 24 ++ .../prerender/session-history-pushstate.https.html | 29 ++ .../session-history-subframe-navigation.https.html | 22 + .../session-history-subframe-reload.https.html | 22 + .../prerender/state-and-event.html | 48 +++ .../prerender/visibility-state.html | 25 ++ .../prerender/web-database.https.html | 72 ++++ ...vigate-to-cross-origin-url-on-iframe.https.html | 82 ++++ ...avigate-to-same-origin-url-on-iframe.https.html | 56 +++ .../prerender/windowclient-navigate.https.html | 71 ++++ .../prerender/workers-in-cross-origin-iframe.html | 51 +++ .../tests/speculation-rules/prerender/workers.html | 96 +++++ 241 files changed, 11291 insertions(+) create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/anonymous-client.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/cross-origin-cookies.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/different-initiators-2.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/different-initiators.sub.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/document-rules.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/duplicate-urls.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/initiators-a-element.sub.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/initiators-iframe-location-href.sub.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/initiators-window-open.sub.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/invalid-rules.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/multiple-url.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-delivery-type.tentative.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-requestStart-responseStart.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-sizes.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/README.txt create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single-with-hint.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/out-of-document-rule-set.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/prefetch-single.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/prefetch-status.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/prefetch-traverse-reload.sub.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/redirect-url.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-from-rules.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/referrer-policy.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/authenticate.py create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/cookies.py create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/executor.sub.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch.py create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch_nvs_hint.py create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/redirect.py create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/ruleset.py create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/sw.js create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/same-origin-cookies.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prefetch/user-pass.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/about-blank-iframes.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/accept-client-hint-cache.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/activation-start.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/cache-storage.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/clients-matchall.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/cookies.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-not-opt-in.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-opt-in.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/cross-origin-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/cross-origin-isolated.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.tentative.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/csp-script-src-inline-speculation-rules.tentative.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/csp-script-src-self.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/csp-script-src-strict-dynamic.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/csp-script-src-unsafe-inline.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/fetch-blob.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/fetch-intercepted-by-service-worker.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/iframe-added-post-activation.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/indexeddb.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/local-storage.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/main-frame-navigation.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/media-autoplay.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/navigation-intercepted-by-service-worker.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/navigator-plugins.tentative.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/navigator-subapp.https.tentative.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/prefetch.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/referrer-policy-from-rules.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/referrer-policy-mismatch.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/referrer-policy-no-referrer.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/referrer-policy-origin.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/referrer-policy-strict-origin.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/referrer.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/register-service-worker.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/remove-script-element.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/about-blank-iframes.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html.headers create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/audio-setSinkId.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/background-fetch.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/background-sync.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/battery-status.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/bear-av1-opus.mp4 create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/bluetooth-access.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/broadcast-channel.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/cache.txt create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/clients-matchall-service-worker.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe-src.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html.headers create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html.headers create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-elem-inline-speculation-rules.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-inline-speculation-rules.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-self.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-strict-dynamic.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-unsafe-inline.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/deferred-promise-utils.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/deprecated-broadcast-channel.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/do-nothing-worker.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/echo-client-hints-received.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/echo-prerender-page-client-hints-received.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/echo-referrer.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/echo-subresource-client-hints-received.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/empty.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/encrypted-media.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/exec.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/exec.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercept-worker.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercepted-by-service-worker.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/file-picker.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/generic-sensor.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/idle-detection.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/iframe-added-post-activation.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/indexedb-utils.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/key-value-store.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/main-frame-navigation.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/media-autoplay-attribute.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/media-device-info.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/media-devices-access.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/media-play.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/message-boxes.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/midi.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/navigator-plugins.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/notification-before-activation.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/notification-on-activation.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/post-message-prerendering-completion-notification.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-client-worker.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-service-worker.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/prerender-response-code.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/prerender-state.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-page.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/presentation-request.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload-inner-frame.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/push.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/referrer-test.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/register-service-worker.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/request-picture-in-picture.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/sandbox-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/screen-capture.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/screen-orientation-lock.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-unregister.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-update.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/service-worker.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/session-history-harness.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/session-history-initiator.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/session-history-prerender.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/session-history-test-util.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/shared-worker.py create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/speech-synthesis.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/storage-persist.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/subapp.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/utils.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/wake-lock.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-database-access.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-hid.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-locks.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-nfc.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-serial.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-share.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-usb.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-immersive-vr-session.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-inline-session.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/window-move.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/window-open-during-prerendering.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/window-open-in-prerenderingchange.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/window-resize.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-on-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-worker.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/worker-post-timeOrigin.js create mode 100644 testing/web-platform/tests/speculation-rules/prerender/resources/workers-in-cross-origin-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/response-code-non-successful.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/response-code-successful.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-background-fetch.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-background-sync.tentative.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-battery-status.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-bluetooth.tentative.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-broadcast-channel.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-dedicated-worker.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media-unsupported-config.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-focus.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-idle-detection.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-local-file-system-access.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-media-auto-play-attribute.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-media-camera.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-media-device-info.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-media-microphone.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-media-play.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-message-boxes.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-midi-sysex.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-midi.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-notification.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-presentation-request.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-prompt-by-before-unload.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-push.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-request-picture-in-picture.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-screen-capture.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-screen-orientation-lock.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-accelerometer.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-ambient-light-sensor.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-gyroscope.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-magnetometer.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-postmessage.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-unregister.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-update.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-speech-synthesis.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-storage-persist.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-wake-lock.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-hid.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-locks.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-nfc.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-serial.tentative.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-share.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-usb.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-immersive-vr-session.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-inline-session.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-window-move.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-window-open.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restriction-window-resize.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/restrictions.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/sandbox-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/script-supports-speculationrules.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/service-workers.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/session-history-activation.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/session-history-location.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/session-history-navigation.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/session-history-pushstate.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-navigation.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-reload.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/state-and-event.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/visibility-state.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/web-database.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-cross-origin-url-on-iframe.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-same-origin-url-on-iframe.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate.https.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/workers-in-cross-origin-iframe.html create mode 100644 testing/web-platform/tests/speculation-rules/prerender/workers.html (limited to 'testing/web-platform/tests/speculation-rules') diff --git a/testing/web-platform/tests/speculation-rules/prefetch/anonymous-client.https.html b/testing/web-platform/tests/speculation-rules/prefetch/anonymous-client.https.html new file mode 100644 index 0000000000..dfa48f02ab --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/anonymous-client.https.html @@ -0,0 +1,20 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/cross-origin-cookies.https.html b/testing/web-platform/tests/speculation-rules/prefetch/cross-origin-cookies.https.html new file mode 100644 index 0000000000..c3911919f0 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/cross-origin-cookies.https.html @@ -0,0 +1,41 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/different-initiators-2.https.html b/testing/web-platform/tests/speculation-rules/prefetch/different-initiators-2.https.html new file mode 100644 index 0000000000..1242ebbfb4 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/different-initiators-2.https.html @@ -0,0 +1,52 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/different-initiators.sub.https.html b/testing/web-platform/tests/speculation-rules/prefetch/different-initiators.sub.https.html new file mode 100644 index 0000000000..c35ccde8bb --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/different-initiators.sub.https.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/document-rules.https.html b/testing/web-platform/tests/speculation-rules/prefetch/document-rules.https.html new file mode 100644 index 0000000000..701987c431 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/document-rules.https.html @@ -0,0 +1,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/duplicate-urls.https.html b/testing/web-platform/tests/speculation-rules/prefetch/duplicate-urls.https.html new file mode 100644 index 0000000000..179bbdfd68 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/duplicate-urls.https.html @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/initiators-a-element.sub.https.html b/testing/web-platform/tests/speculation-rules/prefetch/initiators-a-element.sub.https.html new file mode 100644 index 0000000000..bac5eb7cb7 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/initiators-a-element.sub.https.html @@ -0,0 +1,79 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/initiators-iframe-location-href.sub.https.html b/testing/web-platform/tests/speculation-rules/prefetch/initiators-iframe-location-href.sub.https.html new file mode 100644 index 0000000000..9d6702d4b7 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/initiators-iframe-location-href.sub.https.html @@ -0,0 +1,48 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/initiators-window-open.sub.https.html b/testing/web-platform/tests/speculation-rules/prefetch/initiators-window-open.sub.https.html new file mode 100644 index 0000000000..f786df077d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/initiators-window-open.sub.https.html @@ -0,0 +1,68 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/invalid-rules.https.html b/testing/web-platform/tests/speculation-rules/prefetch/invalid-rules.https.html new file mode 100644 index 0000000000..573f3c0b0f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/invalid-rules.https.html @@ -0,0 +1,18 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/multiple-url.https.html b/testing/web-platform/tests/speculation-rules/prefetch/multiple-url.https.html new file mode 100644 index 0000000000..dd9916632f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/multiple-url.https.html @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-delivery-type.tentative.https.html b/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-delivery-type.tentative.https.html new file mode 100644 index 0000000000..cee8e55f12 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-delivery-type.tentative.https.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-requestStart-responseStart.https.html b/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-requestStart-responseStart.https.html new file mode 100644 index 0000000000..062d7265d8 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-requestStart-responseStart.https.html @@ -0,0 +1,52 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-sizes.https.html b/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-sizes.https.html new file mode 100644 index 0000000000..19c254ca1d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/navigation-timing-sizes.https.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/README.txt b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/README.txt new file mode 100644 index 0000000000..60ac226f8c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/README.txt @@ -0,0 +1 @@ +Web Platform Tests for No-Vary-Search support in prefetch cache. diff --git a/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single-with-hint.https.html b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single-with-hint.https.html new file mode 100644 index 0000000000..d62788caba --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single-with-hint.https.html @@ -0,0 +1,337 @@ + +Use for navigation the requested prefetched response annotated with No-Vary-Search hint, if +No-Vary-Search headers also match during navigation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html new file mode 100644 index 0000000000..fdbb617135 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/no-vary-search/prefetch-single.https.html @@ -0,0 +1,314 @@ + +Prefetched response including No-Vary-Search headers is used during navigation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/out-of-document-rule-set.https.html b/testing/web-platform/tests/speculation-rules/prefetch/out-of-document-rule-set.https.html new file mode 100644 index 0000000000..9f2c311715 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/out-of-document-rule-set.https.html @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/prefetch-single.https.html b/testing/web-platform/tests/speculation-rules/prefetch/prefetch-single.https.html new file mode 100644 index 0000000000..42f75d0c29 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/prefetch-single.https.html @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/prefetch-status.https.html b/testing/web-platform/tests/speculation-rules/prefetch/prefetch-status.https.html new file mode 100644 index 0000000000..6835a55ee9 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/prefetch-status.https.html @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/prefetch-traverse-reload.sub.html b/testing/web-platform/tests/speculation-rules/prefetch/prefetch-traverse-reload.sub.html new file mode 100644 index 0000000000..ec6a7cd926 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/prefetch-traverse-reload.sub.html @@ -0,0 +1,74 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/redirect-url.https.html b/testing/web-platform/tests/speculation-rules/prefetch/redirect-url.https.html new file mode 100644 index 0000000000..07db405dc3 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/redirect-url.https.html @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-from-rules.https.html b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-from-rules.https.html new file mode 100644 index 0000000000..bbb0343509 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-from-rules.https.html @@ -0,0 +1,143 @@ + +Prefetch with the referrer policy specified in speculation rules + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html new file mode 100644 index 0000000000..d7c003b3ca --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html @@ -0,0 +1,53 @@ + +Prefetch attempts with an unacceptable referrer policy + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy.https.html b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy.https.html new file mode 100644 index 0000000000..1987d2e2ff --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy.https.html @@ -0,0 +1,88 @@ + +Prefetch is done with the referring page's referrer policy + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/authenticate.py b/testing/web-platform/tests/speculation-rules/prefetch/resources/authenticate.py new file mode 100644 index 0000000000..037a7c144e --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/authenticate.py @@ -0,0 +1,32 @@ + +def main(request, response): + def fmt(x): + return f'"{x.decode("utf-8")}"' if x is not None else "undefined" + + purpose = request.headers.get("Purpose", b"").decode("utf-8") + sec_purpose = request.headers.get("Sec-Purpose", b"").decode("utf-8") + + headers = [(b"Content-Type", b"text/html"), (b'WWW-Authenticate', 'Basic')] + status = 200 if request.auth.username is not None or sec_purpose.startswith( + "prefetch") else 401 + + content = f''' + + + + + ''' + return status, headers, content diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/cookies.py b/testing/web-platform/tests/speculation-rules/prefetch/resources/cookies.py new file mode 100644 index 0000000000..3c2299aa3a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/cookies.py @@ -0,0 +1,41 @@ + +def main(request, response): + def get_cookie(key): + key = key.encode("utf-8") + if key in request.cookies: + return f'"{request.cookies[key].value.decode("utf-8")}"' + else: + return "undefined" + + purpose = request.headers.get("Purpose", b"").decode("utf-8") + sec_purpose = request.headers.get("Sec-Purpose", b"").decode("utf-8") + + cookie_count = int( + request.cookies[b"count"].value) if b"count" in request.cookies else 0 + response.set_cookie("count", f"{cookie_count+1}", + secure=True, samesite="None") + response.set_cookie( + "type", "prefetch" if sec_purpose.startswith("prefetch") else "navigate") + + headers = [(b"Content-Type", b"text/html")] + + content = f''' + + + + + ''' + return headers, content diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/executor.sub.html b/testing/web-platform/tests/speculation-rules/prefetch/resources/executor.sub.html new file mode 100644 index 0000000000..ba1b3acb0c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/executor.sub.html @@ -0,0 +1,13 @@ + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch.py b/testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch.py new file mode 100644 index 0000000000..4a0a7a3602 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch.py @@ -0,0 +1,16 @@ +from wptserve.handlers import json_handler + +@json_handler +def main(request, response): + uuid = request.GET[b"uuid"] + prefetch = request.headers.get( + "Sec-Purpose", b"").decode("utf-8").startswith("prefetch") + + n = request.server.stash.take(uuid) + if n is None: + n = 0 + if prefetch: + n += 1 + request.server.stash.put(uuid, n) + + return n diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch_nvs_hint.py b/testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch_nvs_hint.py new file mode 100644 index 0000000000..09c5d2eb73 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/prefetch_nvs_hint.py @@ -0,0 +1,34 @@ +import time + +def main(request, response): + uuid = request.GET[b"uuid"] + prefetch = request.headers.get( + "Sec-Purpose", b"").decode("utf-8").startswith("prefetch") + if b"unblock" in request.GET: + request.server.stash.put(uuid, 0) + return '' + + if b"nvs_header" in request.GET: + nvs_header = request.GET[b"nvs_header"] + response.headers.set("No-Vary-Search", nvs_header) + + if prefetch: + nvswait = None + while nvswait is None: + time.sleep(0.1) + nvswait = request.server.stash.take(uuid) + + content = (f'\n' + f'\n' + f'\n' + f'\n') + + return content diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/redirect.py b/testing/web-platform/tests/speculation-rules/prefetch/resources/redirect.py new file mode 100644 index 0000000000..de7a4af987 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/redirect.py @@ -0,0 +1,3 @@ +def main(request, response): + new_url = request.url.replace("redirect", "prefetch").encode("utf-8") + return 301, [(b"Location", new_url)], b"" diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/ruleset.py b/testing/web-platform/tests/speculation-rules/prefetch/resources/ruleset.py new file mode 100644 index 0000000000..97de1cc1a0 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/ruleset.py @@ -0,0 +1,49 @@ +def main(request, response): + url = request.GET[b"url"].decode("utf-8") + uuid = request.GET[b"uuid"].decode("utf-8") + page = request.GET[b"page"].decode("utf-8") + valid_json = request.GET[b"valid_json"].decode("utf-8") + empty_json = request.GET[b"empty_json"].decode("utf-8") + fail_cors = request.GET[b"fail_cors"].decode("utf-8") + valid_encoding = request.GET[b"valid_encoding"].decode("utf-8") + redirect = request.GET[b"redirect"].decode("utf-8") + sec_fetch_dest = request.headers[b"Sec-Fetch-Dest"].decode( + "utf-8").lower() if b"Sec-Fetch-Dest" in request.headers else None + content_type = b"application/speculationrules+json" if request.GET[ + b"valid_mime"].decode("utf-8") == "true" else b"application/json" + status = int(request.GET[b"status"]) + + if redirect == "true": + new_url = request.url.replace("redirect=true", + "redirect=false").encode("utf-8") + return 301, [(b"Location", new_url), + (b'Access-Control-Allow-Origin', b'*')], b"" + + encoding = "utf-8" if valid_encoding == "true" else "windows-1250" + content_type += f'; charset={encoding}'.encode('utf-8') + strparam = b'\xc3\xb7'.decode('utf-8') + + content = f''' + {{ + "prefetch": [ + {{ + "source":"list", + "urls":["{url}?uuid={uuid}&page={page}&str={strparam}"], + "requires":["anonymous-client-ip-when-cross-origin"] + }} + ] + }} + ''' + if empty_json == "true": + content = "" + elif valid_json != "true": + content = "invalid json" + elif sec_fetch_dest is None or sec_fetch_dest != "script": + content = "normal document" + + headers = [(b"Content-Type", content_type)] + if fail_cors != "true": + origin = request.headers[ + b"Origin"] if b"Origin" in request.headers else b'*' + headers.append((b'Access-Control-Allow-Origin', origin)) + return status, headers, content.encode(encoding) diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/sw.js b/testing/web-platform/tests/speculation-rules/prefetch/resources/sw.js new file mode 100644 index 0000000000..db774f9d5b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/sw.js @@ -0,0 +1 @@ +self.addEventListener('fetch', () => event.respondWith(fetch(event.request))); diff --git a/testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js b/testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js new file mode 100644 index 0000000000..9b3b630733 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/resources/utils.sub.js @@ -0,0 +1,176 @@ +/** + * Utilities for initiating prefetch via speculation rules. + */ + +// Resolved URL to find this script. +const SR_PREFETCH_UTILS_URL = new URL(document.currentScript.src, document.baseURI); +// Hostname for cross origin urls. +const PREFETCH_PROXY_BYPASS_HOST = "{{hosts[alt][]}}"; + +class PrefetchAgent extends RemoteContext { + constructor(uuid, t) { + super(uuid); + this.t = t; + } + + getExecutorURL(options = {}) { + let {hostname, username, password, protocol, executor, ...extra} = options; + let params = new URLSearchParams({uuid: this.context_id, ...extra}); + if(executor === undefined) { + executor = "executor.sub.html"; + } + let url = new URL(`${executor}?${params}`, SR_PREFETCH_UTILS_URL); + if(hostname !== undefined) { + url.hostname = hostname; + } + if(username !== undefined) { + url.username = username; + } + if(password !== undefined) { + url.password = password; + } + if(protocol !== undefined) { + url.protocol = protocol; + url.port = protocol === "https" ? "{{ports[https][0]}}" : "{{ports[http][0]}}"; + } + return url; + } + + // Requests prefetch via speculation rules. + // + // In the future, this should also use browser hooks to force the prefetch to + // occur despite heuristic matching, etc., and await the completion of the + // prefetch. + async forceSinglePrefetch(url, extra = {}) { + await this.execute_script((url, extra) => { + insertSpeculationRules({ prefetch: [{source: 'list', urls: [url], ...extra}] }); + }, [url, extra]); + return new Promise(resolve => this.t.step_timeout(resolve, 2000)); + } + + async navigate(url) { + await this.execute_script((url) => { + window.executor.suspend(() => { + location.href = url; + }); + }, [url]); + url.username = ''; + url.password = ''; + assert_equals( + await this.execute_script(() => location.href), + url.toString(), + "expected navigation to reach destination URL"); + await this.execute_script(() => {}); + } + + async getRequestHeaders() { + return this.execute_script(() => requestHeaders); + } + + async getResponseCookies() { + return this.execute_script(() => { + let cookie = {}; + document.cookie.split(/\s*;\s*/).forEach((kv)=>{ + let [key, value] = kv.split(/\s*=\s*/); + cookie[key] = value; + }); + return cookie; + }); + } + + async getRequestCookies() { + return this.execute_script(() => window.requestCookies); + } + + async getRequestCredentials() { + return this.execute_script(() => window.requestCredentials); + } + + async setReferrerPolicy(referrerPolicy) { + return this.execute_script(referrerPolicy => { + const meta = document.createElement("meta"); + meta.name = "referrer"; + meta.content = referrerPolicy; + document.head.append(meta); + }, [referrerPolicy]); + } + + async getDeliveryType(){ + return this.execute_script(() => { + return performance.getEntriesByType("navigation")[0].deliveryType; + }); + } +} + +// Produces a URL with a UUID which will record when it's prefetched. +// |extra_params| can be specified to add extra search params to the generated +// URL. +function getPrefetchUrl(extra_params={}) { + let params = new URLSearchParams({ uuid: token(), ...extra_params }); + return new URL(`prefetch.py?${params}`, SR_PREFETCH_UTILS_URL); +} + +// Produces n URLs with unique UUIDs which will record when they are prefetched. +function getPrefetchUrlList(n) { + return Array.from({ length: n }, () => getPrefetchUrl()); +} + +function getRedirectUrl() { + let params = new URLSearchParams({uuid: token()}); + return new URL(`redirect.py?${params}`, SR_PREFETCH_UTILS_URL); +} + +async function isUrlPrefetched(url) { + let response = await fetch(url, {redirect: 'follow'}); + assert_true(response.ok); + return response.json(); +} + +// Must also include /common/utils.js and /common/dispatcher/dispatcher.js to use this. +async function spawnWindow(t, options = {}, uuid = token()) { + let agent = new PrefetchAgent(uuid, t); + let w = window.open(agent.getExecutorURL(options), '_blank', options); + t.add_cleanup(() => w.close()); + return agent; +} + +function insertSpeculationRules(body) { + let script = document.createElement('script'); + script.type = 'speculationrules'; + script.textContent = JSON.stringify(body); + document.head.appendChild(script); +} + +// Creates and appends to |insertion point|. If +// |insertion_point| is not specified, document.body is used. +function addLink(href, insertion_point=document.body) { + const a = document.createElement('a'); + a.href = href; + insertion_point.appendChild(a); + return a; +} + +// Inserts a prefetch document rule with |predicate|. |predicate| can be +// undefined, in which case the default predicate will be used (i.e. all links +// in document will match). +function insertDocumentRule(predicate, extra_options={}) { + insertSpeculationRules({ + prefetch: [{ + source: 'document', + eagerness: 'eager', + where: predicate, + ...extra_options + }] + }); +} + +function assert_prefetched (requestHeaders, description) { + assert_in_array(requestHeaders.purpose, ["", "prefetch"], "The vendor-specific header Purpose, if present, must be 'prefetch'."); + assert_in_array(requestHeaders.sec_purpose, + ["prefetch", "prefetch;anonymous-client-ip"], description); +} + +function assert_not_prefetched (requestHeaders, description){ + assert_equals(requestHeaders.purpose, "", description); + assert_equals(requestHeaders.sec_purpose, "", description); +} diff --git a/testing/web-platform/tests/speculation-rules/prefetch/same-origin-cookies.https.html b/testing/web-platform/tests/speculation-rules/prefetch/same-origin-cookies.https.html new file mode 100644 index 0000000000..1d60a4bee0 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/same-origin-cookies.https.html @@ -0,0 +1,39 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prefetch/user-pass.https.html b/testing/web-platform/tests/speculation-rules/prefetch/user-pass.https.html new file mode 100644 index 0000000000..94748f1eac --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prefetch/user-pass.https.html @@ -0,0 +1,44 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/about-blank-iframes.html b/testing/web-platform/tests/speculation-rules/prerender/about-blank-iframes.html new file mode 100644 index 0000000000..9cc0ab3792 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/about-blank-iframes.html @@ -0,0 +1,35 @@ + + +Test about:blank iframes prerendering state + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/accept-client-hint-cache.https.html b/testing/web-platform/tests/speculation-rules/prerender/accept-client-hint-cache.https.html new file mode 100644 index 0000000000..66e2c90c04 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/accept-client-hint-cache.https.html @@ -0,0 +1,40 @@ + +Test Prerender pages maintain their own Client Hint Caches + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/activation-start.html b/testing/web-platform/tests/speculation-rules/prerender/activation-start.html new file mode 100644 index 0000000000..676eca3fa1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/activation-start.html @@ -0,0 +1,70 @@ + +PerformanceNavigationTiming's activationStart in prerendered page + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/cache-storage.https.html b/testing/web-platform/tests/speculation-rules/prerender/cache-storage.https.html new file mode 100644 index 0000000000..b2044a4078 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/cache-storage.https.html @@ -0,0 +1,35 @@ + +Same-origin prerendering can access cache storage + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/clients-matchall.https.html b/testing/web-platform/tests/speculation-rules/prerender/clients-matchall.https.html new file mode 100644 index 0000000000..bbd9ea2327 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/clients-matchall.https.html @@ -0,0 +1,52 @@ + +Service Worker: Clients.matchAll with a prerender page + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/cookies.https.html b/testing/web-platform/tests/speculation-rules/prerender/cookies.https.html new file mode 100644 index 0000000000..84cbd1c6d1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/cookies.https.html @@ -0,0 +1,37 @@ + +Same-origin prerendering can access cookies + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-not-opt-in.html b/testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-not-opt-in.html new file mode 100644 index 0000000000..8c797b8022 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-not-opt-in.html @@ -0,0 +1,26 @@ + +same-site cross-origin prerendering not opt in + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-opt-in.html b/testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-opt-in.html new file mode 100644 index 0000000000..eb8fd3cdfc --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/credentialed-prerender-opt-in.html @@ -0,0 +1,22 @@ + +same-site cross-origin prerendering opt in + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/cross-origin-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/cross-origin-iframe.html new file mode 100644 index 0000000000..f4819c207b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/cross-origin-iframe.html @@ -0,0 +1,63 @@ + + +Load a cross-origin document in a prerendered iframe + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/cross-origin-isolated.https.html b/testing/web-platform/tests/speculation-rules/prerender/cross-origin-isolated.https.html new file mode 100644 index 0000000000..01dafe00bf --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/cross-origin-isolated.https.html @@ -0,0 +1,28 @@ + +Allow crossOriginIsolated in prerendered page + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.tentative.html b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.tentative.html new file mode 100644 index 0000000000..0a3b3b8a70 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-elem-inline-speculation-rules.tentative.html @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-inline-speculation-rules.tentative.html b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-inline-speculation-rules.tentative.html new file mode 100644 index 0000000000..923598bd27 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-inline-speculation-rules.tentative.html @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-self.html b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-self.html new file mode 100644 index 0000000000..f0f9784666 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-self.html @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-strict-dynamic.html b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-strict-dynamic.html new file mode 100644 index 0000000000..5e08877a49 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-strict-dynamic.html @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-unsafe-inline.html b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-unsafe-inline.html new file mode 100644 index 0000000000..f6925f59f4 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/csp-script-src-unsafe-inline.html @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/fetch-blob.html b/testing/web-platform/tests/speculation-rules/prerender/fetch-blob.html new file mode 100644 index 0000000000..7f8d557049 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/fetch-blob.html @@ -0,0 +1,34 @@ + +Same-origin prerendering can access localStorage + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/fetch-intercepted-by-service-worker.https.html b/testing/web-platform/tests/speculation-rules/prerender/fetch-intercepted-by-service-worker.https.html new file mode 100644 index 0000000000..6c2062a107 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/fetch-intercepted-by-service-worker.https.html @@ -0,0 +1,44 @@ + +Service worker intercepts a fetch request coming from a prerendered page + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/iframe-added-post-activation.html b/testing/web-platform/tests/speculation-rules/prerender/iframe-added-post-activation.html new file mode 100644 index 0000000000..c4263db87d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/iframe-added-post-activation.html @@ -0,0 +1,33 @@ + + +iframe added after activation + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/indexeddb.html b/testing/web-platform/tests/speculation-rules/prerender/indexeddb.html new file mode 100644 index 0000000000..40528dce5a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/indexeddb.html @@ -0,0 +1,43 @@ + +Same-origin prerendering can access Indexed Database + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/local-storage.html b/testing/web-platform/tests/speculation-rules/prerender/local-storage.html new file mode 100644 index 0000000000..cd14685054 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/local-storage.html @@ -0,0 +1,49 @@ + +Same-origin prerendering can access localStorage + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/main-frame-navigation.https.html b/testing/web-platform/tests/speculation-rules/prerender/main-frame-navigation.https.html new file mode 100644 index 0000000000..47d8f2e81a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/main-frame-navigation.https.html @@ -0,0 +1,39 @@ + +Test about: main frame navigation in a prerendered page + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/media-autoplay.html b/testing/web-platform/tests/speculation-rules/prerender/media-autoplay.html new file mode 100644 index 0000000000..7e6b8d1047 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/media-autoplay.html @@ -0,0 +1,47 @@ + +Same-origin prerendering can trigger autoplay + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/navigation-intercepted-by-service-worker.https.html b/testing/web-platform/tests/speculation-rules/prerender/navigation-intercepted-by-service-worker.https.html new file mode 100644 index 0000000000..916c704767 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/navigation-intercepted-by-service-worker.https.html @@ -0,0 +1,42 @@ + +Service worker intercepts a navigation and starts prerendering + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/navigator-plugins.tentative.html b/testing/web-platform/tests/speculation-rules/prerender/navigator-plugins.tentative.html new file mode 100644 index 0000000000..192d4b3cd1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/navigator-plugins.tentative.html @@ -0,0 +1,52 @@ + + +Same-origin prerendering can access navigator.plugins + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/navigator-subapp.https.tentative.html b/testing/web-platform/tests/speculation-rules/prerender/navigator-subapp.https.tentative.html new file mode 100644 index 0000000000..8cfc78ac6e --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/navigator-subapp.https.tentative.html @@ -0,0 +1,31 @@ + +navigator.subApp API test + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/prefetch.https.html b/testing/web-platform/tests/speculation-rules/prerender/prefetch.https.html new file mode 100644 index 0000000000..2a1553b3d9 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/prefetch.https.html @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-from-rules.html b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-from-rules.html new file mode 100644 index 0000000000..b19c5dddac --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-from-rules.html @@ -0,0 +1,43 @@ + + +Prerender with the referrer policy specified in speculation rules + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-mismatch.html b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-mismatch.html new file mode 100644 index 0000000000..961b745e8e --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-mismatch.html @@ -0,0 +1,90 @@ + +Referrer policy mismatches must be allowed between prerendering and activation + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-no-referrer.html b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-no-referrer.html new file mode 100644 index 0000000000..a2bdda92f1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-no-referrer.html @@ -0,0 +1,21 @@ + + + +Test noreferrer + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-origin.html b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-origin.html new file mode 100644 index 0000000000..47001d66e0 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-origin.html @@ -0,0 +1,24 @@ + + + +Test origin referrer + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-strict-origin.html b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-strict-origin.html new file mode 100644 index 0000000000..2f5d1e935d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/referrer-policy-strict-origin.html @@ -0,0 +1,22 @@ + + + +Test strict-origin referrer + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/referrer.html b/testing/web-platform/tests/speculation-rules/prerender/referrer.html new file mode 100644 index 0000000000..f10d64aeff --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/referrer.html @@ -0,0 +1,20 @@ + +Test default referrer + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/register-service-worker.https.html b/testing/web-platform/tests/speculation-rules/prerender/register-service-worker.https.html new file mode 100644 index 0000000000..2edda3df45 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/register-service-worker.https.html @@ -0,0 +1,53 @@ + +Registration of a new service worker in a prerendered page + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/remove-script-element.html b/testing/web-platform/tests/speculation-rules/prerender/remove-script-element.html new file mode 100644 index 0000000000..9de7656f50 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/remove-script-element.html @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/about-blank-iframes.html b/testing/web-platform/tests/speculation-rules/prerender/resources/about-blank-iframes.html new file mode 100644 index 0000000000..db99d586e2 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/about-blank-iframes.html @@ -0,0 +1,115 @@ + + +about:blank iframe initiator and prerendered page + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html b/testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html new file mode 100644 index 0000000000..1a23661a44 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html @@ -0,0 +1,4 @@ + + + This page does nothing but update the ACCEPT-CH headers. + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html.headers b/testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html.headers new file mode 100644 index 0000000000..6c56648705 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/accept-ch.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-ua-bitness +Access-Control-Allow-Origin: * \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/audio-setSinkId.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/audio-setSinkId.https.html new file mode 100644 index 0000000000..f53e2f9a8b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/audio-setSinkId.https.html @@ -0,0 +1,27 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/background-fetch.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/background-fetch.https.html new file mode 100644 index 0000000000..3f1c072d10 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/background-fetch.https.html @@ -0,0 +1,29 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/background-sync.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/background-sync.https.html new file mode 100644 index 0000000000..f11a951818 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/background-sync.https.html @@ -0,0 +1,29 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/battery-status.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/battery-status.https.html new file mode 100644 index 0000000000..eb61117538 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/battery-status.https.html @@ -0,0 +1,21 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/bear-av1-opus.mp4 b/testing/web-platform/tests/speculation-rules/prerender/resources/bear-av1-opus.mp4 new file mode 100644 index 0000000000..64a5e1ffcc Binary files /dev/null and b/testing/web-platform/tests/speculation-rules/prerender/resources/bear-av1-opus.mp4 differ diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/bluetooth-access.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/bluetooth-access.https.html new file mode 100644 index 0000000000..b14b46c09c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/bluetooth-access.https.html @@ -0,0 +1,25 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/broadcast-channel.html b/testing/web-platform/tests/speculation-rules/prerender/resources/broadcast-channel.html new file mode 100644 index 0000000000..14980720a1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/broadcast-channel.html @@ -0,0 +1,35 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/cache.txt b/testing/web-platform/tests/speculation-rules/prerender/resources/cache.txt new file mode 100644 index 0000000000..89164cfabe --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/cache.txt @@ -0,0 +1 @@ +Hello, Prerender API! \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/clients-matchall-service-worker.js b/testing/web-platform/tests/speculation-rules/prerender/resources/clients-matchall-service-worker.js new file mode 100644 index 0000000000..634b13160a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/clients-matchall-service-worker.js @@ -0,0 +1,11 @@ +onmessage = e => { + // Collect all client URLs in this origin. + const options = { includeUncontrolled: true, type: 'all' }; + const promise = self.clients.matchAll(options) + .then(clients => { + const client_urls = []; + clients.forEach(client => client_urls.push(client.url)); + e.source.postMessage(client_urls); + }); + e.waitUntil(promise); +}; diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe-src.html b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe-src.html new file mode 100644 index 0000000000..77fa9bc208 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe-src.html @@ -0,0 +1,7 @@ + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe.html new file mode 100644 index 0000000000..21ccc0ca1b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-iframe.html @@ -0,0 +1,56 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html new file mode 100644 index 0000000000..acad3c3e64 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html.headers b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html.headers new file mode 100644 index 0000000000..b227e843ae --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated-iframe.https.html.headers @@ -0,0 +1,2 @@ +Cross-Origin-Embedder-Policy: require-corp +Cross-Origin-Resource-Policy: cross-origin \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html new file mode 100644 index 0000000000..4fdc6c9541 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html.headers b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html.headers new file mode 100644 index 0000000000..5f8621ef83 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/cross-origin-isolated.https.html.headers @@ -0,0 +1,2 @@ +Cross-Origin-Embedder-Policy: require-corp +Cross-Origin-Opener-Policy: same-origin diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-elem-inline-speculation-rules.html b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-elem-inline-speculation-rules.html new file mode 100644 index 0000000000..19aff92206 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-elem-inline-speculation-rules.html @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-inline-speculation-rules.html b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-inline-speculation-rules.html new file mode 100644 index 0000000000..febfbd01ba --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-inline-speculation-rules.html @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-self.html b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-self.html new file mode 100644 index 0000000000..8dc382068a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-self.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-strict-dynamic.html b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-strict-dynamic.html new file mode 100644 index 0000000000..00db373c47 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-strict-dynamic.html @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-unsafe-inline.html b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-unsafe-inline.html new file mode 100644 index 0000000000..d2f010dc56 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src-unsafe-inline.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src.js b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src.js new file mode 100644 index 0000000000..866acaa09b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/csp-script-src.js @@ -0,0 +1,57 @@ +const params = new URLSearchParams(location.search); + +// Take a key used for storing a test result in the server. +const key = params.get('key'); + +// Speculation rules injection is blocked in the csp-script-src 'self' test. +const block = location.pathname.endsWith('csp-script-src-self.html'); + +// The main test page (csp-script-src-*.html) in the parent directory) will load +// this page only with the "key" parameter. This page will then try prerendering +// itself with the "run-test" parameter. When "run-test" is in the URL we'll +// actually start the test process and record the results to send back to the +// main test page. We do this because the main test page cannot navigate itself +// but it also cannot open a popup to a prerendered browsing context so the +// prerender triggering and activation must both happen in this popup. +const run_test = params.has('run-test'); +if (!run_test) { + // Generate a new stash key so we can communicate with the prerendered page + // about when to close the popup. + const done_key = token(); + const url = new URL(document.URL); + url.searchParams.append('run-test', ''); + url.searchParams.append('done-key', done_key); + + if (block) { + // Observe `securitypolicyviolation` event that will be triggered by + // startPrerendering(). + document.addEventListener('securitypolicyviolation', e => { + if (e.effectiveDirective != 'script-src' && + e.effectiveDirective != 'script-src-elem') { + const message = 'unexpected effective directive: ' + e.effectiveDirective; + writeValueToServer(key, message).then(() => { window.close(); }); + } else { + const message = 'blocked by ' + e.effectiveDirective; + writeValueToServer(key, message).then(() => { window.close(); }); + } + }); + } + + startPrerendering(url.toString()); + + // Wait until the prerendered page signals us it's ready to close. + nextValueFromServer(done_key).then(() => { + window.close(); + }); +} else { + if (block) { + writeValueToServer(key, 'unexpected prerendering'); + } else { + // Tell the harness the initial document.prerendering value. + writeValueToServer(key, document.prerendering); + + // Tell the prerendering initiating page test being finished. + const done_key = params.get('done-key'); + writeValueToServer(done_key, "done"); + } +} diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.https.html new file mode 100644 index 0000000000..570d4b33a1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.https.html @@ -0,0 +1,31 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.js b/testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.js new file mode 100644 index 0000000000..d8029556be --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/dedicated-worker.js @@ -0,0 +1 @@ +postMessage('readyToActivate'); diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/deferred-promise-utils.js b/testing/web-platform/tests/speculation-rules/prerender/resources/deferred-promise-utils.js new file mode 100644 index 0000000000..19bc981a2a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/deferred-promise-utils.js @@ -0,0 +1,74 @@ +/** + * This file co-works with a html file and utils.js to test a promise that + * should be deferred during prerendering. + * + * Usage example: + * Suppose the html is "prerender-promise-test.html" + * On prerendering page, prerender-promise-test.html?prerendering: + * const prerenderEventCollector = new PrerenderEventCollector(); + * const promise = {a promise that should be deferred during prerendering}; + * prerenderEventCollector.start(promise, {promise name}); + * + * On the initiator page, prerender-promise-test.html: + * execute + * `loadInitiatorPage();` + */ + +// Collects events that happen relevant to a prerendering page. +// An event is added when: +// 1. start() is called. +// 2. a prerenderingchange event is dispatched on this document. +// 3. the promise passed to start() is resolved. +// 4. addEvent() is called manually. +class PrerenderEventCollector { + constructor() { + this.eventsSeen_ = []; + new PrerenderChannel('close').addEventListener('message', () => { + window.close(); + }); + } + + // Adds an event to `eventsSeen_` along with the prerendering state of the + // page. + addEvent(eventMessage) { + this.eventsSeen_.push( + {event: eventMessage, prerendering: document.prerendering}); + } + + // Starts collecting events until the promise resolves. Triggers activation by + // telling the initiator page that it is ready for activation. + async start(promise, promiseName) { + assert_true(document.prerendering); + this.addEvent(`started waiting ${promiseName}`); + promise + .then( + () => { + this.addEvent(`finished waiting ${promiseName}`); + }, + (error) => { + if (error instanceof Error) + error = error.name; + this.addEvent(`${promiseName} rejected: ${error}`); + }) + .finally(() => { + // Used to communicate with the main test page. + const testChannel = new PrerenderChannel('test-channel'); + // Send the observed events back to the main test page. + testChannel.postMessage(this.eventsSeen_); + testChannel.close(); + }); + document.addEventListener('prerenderingchange', () => { + this.addEvent('prerendering change'); + }); + + // Post a task to give the implementation a chance to fail in case it + // resolves a promise without waiting for activation. + setTimeout(() => { + // Used to communicate with the initiator page. + const prerenderChannel = new PrerenderChannel('prerender-channel'); + // Inform the initiator page that this page is ready to be activated. + prerenderChannel.postMessage('readyToActivate'); + prerenderChannel.close(); + }, 0); + } +} diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/deprecated-broadcast-channel.py b/testing/web-platform/tests/speculation-rules/prerender/resources/deprecated-broadcast-channel.py new file mode 100644 index 0000000000..62631d922f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/deprecated-broadcast-channel.py @@ -0,0 +1,28 @@ +import json +import time +def main(request, response): + uid = request.GET.first(b"uid") + name = request.GET.first(b"name") + time.sleep(0.1) + + messagesByName = [] + if request.method == 'POST': + with request.server.stash.lock: + messages = request.server.stash.take(uid) or {} + if name in messages: + messagesByName = messages[name] + + messagesByName.append(json.loads(request.body)) + messages[name] = messagesByName + request.server.stash.put(uid, messages) + response.status = 204 + else: + with request.server.stash.lock: + messages = request.server.stash.take(uid) or {} + if name in messages: + messagesByName = messages[name] + + request.server.stash.put(uid, messages) + response.status = 200 + response.headers['Content-Type'] = 'application/json' + response.content = json.dumps(messagesByName) diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/do-nothing-worker.js b/testing/web-platform/tests/speculation-rules/prerender/resources/do-nothing-worker.js new file mode 100644 index 0000000000..49ceb2648a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/do-nothing-worker.js @@ -0,0 +1 @@ +// Do nothing. diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/echo-client-hints-received.py b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-client-hints-received.py new file mode 100644 index 0000000000..26bd48d007 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-client-hints-received.py @@ -0,0 +1,88 @@ +""" Handle the initiator navigation request and attach the received client info +to the returned page. +""" + + +import textwrap + +html_template = """ + + + +echo client hints on prerendering page + + + + + + +""" + +def translate_to_js(val: bool) -> str: + if isinstance(val, bool): + return "true" if val else "false" + return "" + +def main(request, response): + response.status = 200 + + # Insert the received hints into script. + content = html_template % ( + textwrap.dedent( + f""" + const server_received_bitness = + {translate_to_js(b"sec-ch-ua-bitness" in request.headers)}; + const server_received_full_version_list = + {translate_to_js(b"sec-ch-ua-full-version-list" in + request.headers)}; + """ + ) + ) + response.content = content.encode("utf-8") diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/echo-prerender-page-client-hints-received.py b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-prerender-page-client-hints-received.py new file mode 100644 index 0000000000..b32dcec8f6 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-prerender-page-client-hints-received.py @@ -0,0 +1,96 @@ +""" Handle the prerendering navigation request and insert the received client +info to the returned page. +""" + +import textwrap + +html_template = """ + + + +echo client hints on prerendering page + + + + + + +""" + +def translate_to_js(val: bool) -> str: + if isinstance(val, bool): + return "true" if val else "false" + return "" + +def main(request, response): + response.headers.set(b"Accept-CH", "sec-ch-ua-full-version-list") + response.status = 200 + + # Insert the received hints into script. + content = html_template % ( + textwrap.dedent( + f""" + const server_received_bitness = + {translate_to_js(b"sec-ch-ua-bitness" in request.headers)}; + const server_received_full_version_list = + {translate_to_js(b"sec-ch-ua-full-version-list" in + request.headers)}; + """ + ) + ) + response.content = content.encode("utf-8") diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/echo-referrer.py b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-referrer.py new file mode 100644 index 0000000000..38b54291ca --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-referrer.py @@ -0,0 +1,27 @@ +"""A page that echoes the Referrer header value via BroadcastChannel. +""" + + +def main(request, response): + referrer = request.headers.get(b"referer") + uid = request.GET.first(b"uid") + + if referrer is None: + referrer = b"(none)" + + html = u''' + + +Echo referrer + + + + + + +''' + return (200, [("Content-Type", b"text/html")], + html % (uid.decode("utf-8"), referrer.decode("utf-8"))) diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/echo-subresource-client-hints-received.py b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-subresource-client-hints-received.py new file mode 100644 index 0000000000..bb0d128e50 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/echo-subresource-client-hints-received.py @@ -0,0 +1,15 @@ +""" Handle the sub-resource requests and attach the received client info to +the response. +""" + + +def main(request, response): + response.status = 200 + + # Echo the received CH headers. + response.headers.set( + b"server_received_bitness", + "true" if b"sec-ch-ua-bitness" in request.headers else "false") + response.headers.set( + b"server_received_full_version_list", "true" + if b"sec-ch-ua-full-version-list" in request.headers else "false") diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/empty.html b/testing/web-platform/tests/speculation-rules/prerender/resources/empty.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/encrypted-media.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/encrypted-media.https.html new file mode 100644 index 0000000000..1c3a3ab0ea --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/encrypted-media.https.html @@ -0,0 +1,39 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/exec.html b/testing/web-platform/tests/speculation-rules/prerender/resources/exec.html new file mode 100644 index 0000000000..1eebaa73d0 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/exec.html @@ -0,0 +1,18 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/exec.py b/testing/web-platform/tests/speculation-rules/prerender/resources/exec.py new file mode 100644 index 0000000000..de0636117d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/exec.py @@ -0,0 +1,26 @@ +from wptserve.utils import isomorphic_decode +import os + +def main(request, response): + purpose = request.headers.get(b"purpose") + if (purpose == b'prefetch' and b"code" in request.GET): + code = int(request.GET.first(b"code")) + else: + code = 200 + + if b"uuid" in request.GET: + path = '/speculation-rules/prerender/resources/exec.py' + uuid = request.GET.first(b"uuid") + with request.server.stash.lock: + count = request.server.stash.take(uuid, path) or 0 + if b"get-fetch-count" in request.GET: + response.status = 200 + response.content = '%d' % count + request.server.stash.put(uuid, count, path) + return + count += 1 + request.server.stash.put(uuid, count, path) + + with open(os.path.join(os.path.dirname(isomorphic_decode(__file__)), "exec.html"), u"r") as fn: + response.content = fn.read() + response.status = code diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercept-worker.js b/testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercept-worker.js new file mode 100644 index 0000000000..f6e056a8eb --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercept-worker.js @@ -0,0 +1,9 @@ +self.addEventListener('fetch', e => { + if (e.request.url.includes('should-intercept')) { + if (e.request.destination === 'document') { + e.respondWith(fetch('./prerendered-page.html')); + } else { + e.respondWith(new Response('intercepted by service worker')); + } + } +}); diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercepted-by-service-worker.html b/testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercepted-by-service-worker.html new file mode 100644 index 0000000000..46aefb4e15 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercepted-by-service-worker.html @@ -0,0 +1,22 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/file-picker.html b/testing/web-platform/tests/speculation-rules/prerender/resources/file-picker.html new file mode 100644 index 0000000000..22245a49bc --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/file-picker.html @@ -0,0 +1,27 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/generic-sensor.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/generic-sensor.https.html new file mode 100644 index 0000000000..63dc2aca99 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/generic-sensor.https.html @@ -0,0 +1,34 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/idle-detection.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/idle-detection.https.html new file mode 100644 index 0000000000..4f4554983a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/idle-detection.https.html @@ -0,0 +1,27 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/iframe-added-post-activation.html b/testing/web-platform/tests/speculation-rules/prerender/resources/iframe-added-post-activation.html new file mode 100644 index 0000000000..10a48df58c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/iframe-added-post-activation.html @@ -0,0 +1,57 @@ + + +iframe added post activation: initiator and prerendered page + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/indexedb-utils.js b/testing/web-platform/tests/speculation-rules/prerender/resources/indexedb-utils.js new file mode 100644 index 0000000000..7c57000d5c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/indexedb-utils.js @@ -0,0 +1,61 @@ +const STORAGE_NAME = 'prerender_test'; +const INITIATOR_KEY = 'initiator'; +const INITIATOR_VALUE = INITIATOR_KEY + '_set'; +const PRERENDER_KEY = 'prerender'; +const PRERENDER_VALUE = PRERENDER_KEY + '_set'; + +async function openIndexedDatabase(t) { + return new Promise(resolve => { + const request = window.indexedDB.open(STORAGE_NAME); + if (t) + t.add_cleanup(() => new Promise(resolve => { + window.indexedDB.deleteDatabase(STORAGE_NAME); + resolve(); + })); + request.onupgradeneeded = e => { + const db = e.target.result; + const objectStore = + db.createObjectStore(STORAGE_NAME, {autoIncrement: true}); + objectStore.createIndex('key', 'key', {unique: true}); + }; + request.onerror = e => { + resolve(null); + }; + request.onsuccess = e => { + resolve(e.target.result); + }; + }); +} + +async function addData(db, key, value) { + return new Promise((resolve, reject) => { + const transaction = db.transaction(STORAGE_NAME, 'readwrite'); + const request = + transaction.objectStore(STORAGE_NAME).add({'key': key, 'value': value}); + // Use `transaction.oncomplete` rather than `request.onsuccess` to ensure + // that IndexedDB has flushed to disk. + transaction.oncomplete = e => { + resolve(true); + }; + transaction.onerror = e => { + reject(e.target.error); + }; + }); +} + +async function readData(db, key) { + return new Promise((resolve, reject) => { + const transaction = db.transaction(STORAGE_NAME); + const request = transaction.objectStore(STORAGE_NAME).index('key').get(key); + request.onsuccess = e => { + if (e.target.result) { + resolve(e.target.result.value); + } else { + reject(new Error('Empty result.')); + } + }; + request.onerror = e => { + reject(e.target.error); + }; + }); +} diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/key-value-store.py b/testing/web-platform/tests/speculation-rules/prerender/resources/key-value-store.py new file mode 100644 index 0000000000..1ab609f11b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/key-value-store.py @@ -0,0 +1,27 @@ +"""Key-Value store server. + +The request takes "key=" and "value=" URL parameters. The key must be UUID +generated by token(). + +- When only the "key=" is specified, serves a 200 response whose body contains + the stored value specified by the key. If the stored value doesn't exist, + serves a 200 response with an empty body. +- When both the "key=" and "value=" are specified, stores the pair and serves + a 200 response without body. +""" + + +def main(request, response): + key = request.GET.get(b"key") + value = request.GET.get(b"value", None) + + # Store the value. + if value: + request.server.stash.put(key, value) + return (200, [], b"") + + # Get the value. + data = request.server.stash.take(key) + if not data: + return (200, [], b"") + return (200, [], data) diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/main-frame-navigation.html b/testing/web-platform/tests/speculation-rules/prerender/resources/main-frame-navigation.html new file mode 100644 index 0000000000..8781edef66 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/main-frame-navigation.html @@ -0,0 +1,84 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/media-autoplay-attribute.html b/testing/web-platform/tests/speculation-rules/prerender/resources/media-autoplay-attribute.html new file mode 100644 index 0000000000..ebef5b725d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/media-autoplay-attribute.html @@ -0,0 +1,40 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/media-device-info.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/media-device-info.https.html new file mode 100644 index 0000000000..09e85e77b1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/media-device-info.https.html @@ -0,0 +1,25 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/media-devices-access.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/media-devices-access.https.html new file mode 100644 index 0000000000..462ce53e1b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/media-devices-access.https.html @@ -0,0 +1,26 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/media-play.html b/testing/web-platform/tests/speculation-rules/prerender/resources/media-play.html new file mode 100644 index 0000000000..48cd3beb3b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/media-play.html @@ -0,0 +1,41 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/message-boxes.html b/testing/web-platform/tests/speculation-rules/prerender/resources/message-boxes.html new file mode 100644 index 0000000000..8e0a6e874f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/message-boxes.html @@ -0,0 +1,50 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/midi.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/midi.https.html new file mode 100644 index 0000000000..0cd98a1693 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/midi.https.html @@ -0,0 +1,37 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/navigator-plugins.html b/testing/web-platform/tests/speculation-rules/prerender/resources/navigator-plugins.html new file mode 100644 index 0000000000..dcb9302d8d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/navigator-plugins.html @@ -0,0 +1,20 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/notification-before-activation.html b/testing/web-platform/tests/speculation-rules/prerender/resources/notification-before-activation.html new file mode 100644 index 0000000000..16aab488a5 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/notification-before-activation.html @@ -0,0 +1,40 @@ + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/notification-on-activation.html b/testing/web-platform/tests/speculation-rules/prerender/resources/notification-on-activation.html new file mode 100644 index 0000000000..0a85746b04 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/notification-on-activation.html @@ -0,0 +1,44 @@ + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/post-message-prerendering-completion-notification.html b/testing/web-platform/tests/speculation-rules/prerender/resources/post-message-prerendering-completion-notification.html new file mode 100644 index 0000000000..77fa9bc208 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/post-message-prerendering-completion-notification.html @@ -0,0 +1,7 @@ + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-client-worker.js b/testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-client-worker.js new file mode 100644 index 0000000000..4aff84f336 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-client-worker.js @@ -0,0 +1,3 @@ +self.onmessage = e => { + e.source.postMessage('postmessage to client'); +}; diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-service-worker.html b/testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-service-worker.html new file mode 100644 index 0000000000..198ef64b2c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/postmessage-to-service-worker.html @@ -0,0 +1,34 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/prerender-response-code.html b/testing/web-platform/tests/speculation-rules/prerender/resources/prerender-response-code.html new file mode 100644 index 0000000000..c3a680bba8 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/prerender-response-code.html @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/prerender-state.html b/testing/web-platform/tests/speculation-rules/prerender/resources/prerender-state.html new file mode 100644 index 0000000000..34a59f07ee --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/prerender-state.html @@ -0,0 +1,85 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-iframe.html new file mode 100644 index 0000000000..dcdfb9b65b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-iframe.html @@ -0,0 +1,17 @@ + +Prerendered iframe + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-page.html b/testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-page.html new file mode 100644 index 0000000000..e6ab00788b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/prerendered-page.html @@ -0,0 +1,17 @@ + +Prerendered page + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/presentation-request.html b/testing/web-platform/tests/speculation-rules/prerender/resources/presentation-request.html new file mode 100644 index 0000000000..18475a3d67 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/presentation-request.html @@ -0,0 +1,26 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload-inner-frame.html b/testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload-inner-frame.html new file mode 100644 index 0000000000..ba59ca7960 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload-inner-frame.html @@ -0,0 +1,12 @@ + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload.html b/testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload.html new file mode 100644 index 0000000000..8cfe09a41f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/prompt-by-before-unload.html @@ -0,0 +1,53 @@ + + + + +
+ + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/push.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/push.https.html new file mode 100644 index 0000000000..30eb563ab7 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/push.https.html @@ -0,0 +1,31 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/referrer-test.js b/testing/web-platform/tests/speculation-rules/prerender/resources/referrer-test.js new file mode 100644 index 0000000000..5091b6403c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/referrer-test.js @@ -0,0 +1,15 @@ +async function referrer_test(expected, uid) { + const bc = new PrerenderChannel('prerender-channel', uid); + + const gotMessage = new Promise(resolve => { + bc.addEventListener('message', e => { + resolve(e.data); + }, {once: true}); + }); + + // Start prerendering a page that will echo its referrer. + startPrerendering(`resources/echo-referrer.py?uid=${uid}`); + + const result = await gotMessage; + assert_equals(result.referrer, expected, 'referrer'); +} diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/register-service-worker.html b/testing/web-platform/tests/speculation-rules/prerender/resources/register-service-worker.html new file mode 100644 index 0000000000..ccdf220573 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/register-service-worker.html @@ -0,0 +1,41 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/request-picture-in-picture.html b/testing/web-platform/tests/speculation-rules/prerender/resources/request-picture-in-picture.html new file mode 100644 index 0000000000..9aea3d33d5 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/request-picture-in-picture.html @@ -0,0 +1,34 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/sandbox-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/resources/sandbox-iframe.html new file mode 100644 index 0000000000..478dfccb3a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/sandbox-iframe.html @@ -0,0 +1,50 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/screen-capture.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/screen-capture.https.html new file mode 100644 index 0000000000..1304b9d74b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/screen-capture.https.html @@ -0,0 +1,24 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/screen-orientation-lock.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/screen-orientation-lock.https.html new file mode 100644 index 0000000000..a152e34490 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/screen-orientation-lock.https.html @@ -0,0 +1,23 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-unregister.html b/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-unregister.html new file mode 100644 index 0000000000..a78775a5a2 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-unregister.html @@ -0,0 +1,34 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-update.html b/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-update.html new file mode 100644 index 0000000000..d9a9273526 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker-update.html @@ -0,0 +1,33 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker.js b/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker.js new file mode 100644 index 0000000000..763d55764a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/service-worker.js @@ -0,0 +1,11 @@ +self.addEventListener("fetch", async e => { + if (e.request.url.endsWith("ping")) + e.respondWith(new Response('pong')); + else if (e.request.url.endsWith("client")) { + e.respondWith((async () => { + const client = await clients.get(e.clientId); + const clientInfo = client ? {id: e.clientId, visibilityState: client.visibilityState, focused: client.focused} : null; + return new Response(JSON.stringify({clientInfo}), {headers: {'Content-Type': 'application/json'}}); + })()); + } +}); diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-harness.js b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-harness.js new file mode 100644 index 0000000000..619ee3aa92 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-harness.js @@ -0,0 +1,75 @@ +// We don't have the test harness in this context, so we roll our own +// which communicates with our initiator which is actually running the tests. + +function assert(condition, message) { + if (!condition) { + throw new Error("Assertion failed: " + message); + } +} + +// Run a test after activation. +document.addEventListener("prerenderingchange", async (_) => { + // history.length is racy on activation. Wait *100ms* as a workaround. + // See crbug.com/1222893. + await new Promise((resolve) => { + window.setTimeout(resolve, 100); + }); + + const urlParams = new URLSearchParams(window.location.search); + const testName = urlParams.get("testName"); + const uid = urlParams.get("uid"); + const testChannel = new PrerenderChannel( + `test-channel-${testName}`, uid + ); + + try { + const activationTestFn = testName + "Activation"; + const testFn = window[activationTestFn]; + if (!testFn) { + testChannel.postMessage("Missing test: " + testName); + return; + } + testFn(); + testChannel.postMessage("Passed"); + } catch (e) { + testChannel.postMessage( + "Failed: " + e.name + ": " + e.message, + ); + } finally { + testChannel.close(); + } +}) + +if (document.prerendering) { + window.onload = async () => { + const urlParams = new URLSearchParams(window.location.search); + const testName = urlParams.get("testName"); + const uid = urlParams.get("uid"); + const prerenderChannel = new PrerenderChannel( + `prerender-channel-${testName}`, uid + ); + + // The document load event is not finished at this point, so navigations + // would be done with replacement. This interferes with our tests. We wait + // for the next task before navigating to avoid this. + await new Promise((resolve) => { + window.setTimeout(resolve); + }); + + try { + let testFn = window[testName]; + if (!testFn) { + prerenderChannel.postMessage("Missing test: " + testName); + return; + } + await testFn(); + prerenderChannel.postMessage("Passed"); + } catch (e) { + prerenderChannel.postMessage( + "Failed: " + e.name + ": " + e.message, + ); + } finally { + prerenderChannel.close(); + } + }; +} diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-initiator.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-initiator.https.html new file mode 100644 index 0000000000..f6d5eb555c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-initiator.https.html @@ -0,0 +1,61 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-prerender.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-prerender.https.html new file mode 100644 index 0000000000..b02865c1bc --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-prerender.https.html @@ -0,0 +1,149 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-test-util.js b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-test-util.js new file mode 100644 index 0000000000..c1ca36dc2f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/session-history-test-util.js @@ -0,0 +1,40 @@ +// Note: Following utility functions are expected to be used from +// session-history-* test files. + +async function waitChannelMessage(testName, uid) { + const result = new Promise((resolve) => { + const testChannel = new PrerenderChannel(testName, uid); + testChannel.addEventListener( + "message", + (e) => { + testChannel.close(); + resolve(e.data); + }, + { once: true }, + ); + }); + return result; +} + +async function runTestInPrerender(testName, uid) { + const result = waitChannelMessage(`test-channel-${testName}`, uid); + + // Run test in a new window for test isolation. + const prerender = "session-history-prerender.https.html"; + window.open( + `./resources/session-history-initiator.https.html?prerender=${prerender}&testName=${testName}&uid=${uid}`, + "_blank", + "noopener", + ); + return result; +} + +// This will activate the prerendered context created in runTestInPrerender +// and then run the post-activation variation of `testName`. +async function runTestInActivatedPage(testName, uid) { + const testChannel = new PrerenderChannel(`test-channel-${testName}`, uid); + testChannel.postMessage("activate"); + testChannel.close(); + + return waitChannelMessage(`test-channel-${testName}`, uid); +} diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/shared-worker.py b/testing/web-platform/tests/speculation-rules/prerender/resources/shared-worker.py new file mode 100644 index 0000000000..48e5cd9c15 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/shared-worker.py @@ -0,0 +1,11 @@ +def main(request, response): + if b"check" in request.GET: + with request.server.stash.lock: + result = request.server.stash.take(request.GET[b"id"]) + response.headers.set(b"Content-Type", b"text/plain") + return result + else: + with request.server.stash.lock: + request.server.stash.put(request.GET[b"id"], "ok") + response.headers.set(b"Content-Type", b"text/javascript") + return u"onconnect = ({ports: [port]}) => port.postMessage(performance.timeOrigin);" \ No newline at end of file diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/speech-synthesis.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/speech-synthesis.https.html new file mode 100644 index 0000000000..f7436e42ce --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/speech-synthesis.https.html @@ -0,0 +1,65 @@ + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/storage-persist.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/storage-persist.https.html new file mode 100644 index 0000000000..ab5fabd9e3 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/storage-persist.https.html @@ -0,0 +1,23 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/subapp.html b/testing/web-platform/tests/speculation-rules/prerender/resources/subapp.html new file mode 100644 index 0000000000..8fc4433c0b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/subapp.html @@ -0,0 +1,26 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/utils.js b/testing/web-platform/tests/speculation-rules/prerender/resources/utils.js new file mode 100644 index 0000000000..99c2613788 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/utils.js @@ -0,0 +1,442 @@ +const STORE_URL = '/speculation-rules/prerender/resources/key-value-store.py'; + +function assertSpeculationRulesIsSupported() { + assert_implements( + 'supports' in HTMLScriptElement, + 'HTMLScriptElement.supports is not supported'); + assert_implements( + HTMLScriptElement.supports('speculationrules'), + ' + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-database-access.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-database-access.html new file mode 100644 index 0000000000..fb00852caa --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-database-access.html @@ -0,0 +1,22 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-hid.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-hid.https.html new file mode 100644 index 0000000000..e9531293ea --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-hid.https.html @@ -0,0 +1,23 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-locks.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-locks.html new file mode 100644 index 0000000000..621dd18b4d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-locks.html @@ -0,0 +1,32 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-nfc.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-nfc.https.html new file mode 100644 index 0000000000..61207ab346 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-nfc.https.html @@ -0,0 +1,36 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-serial.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-serial.https.html new file mode 100644 index 0000000000..cfae1372c2 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-serial.https.html @@ -0,0 +1,27 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-share.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-share.https.html new file mode 100644 index 0000000000..f4e2f30471 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-share.https.html @@ -0,0 +1,24 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-usb.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-usb.https.html new file mode 100644 index 0000000000..555825a81c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-usb.https.html @@ -0,0 +1,22 @@ + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-immersive-vr-session.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-immersive-vr-session.https.html new file mode 100644 index 0000000000..d043c88cdb --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-immersive-vr-session.https.html @@ -0,0 +1,24 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-inline-session.https.html b/testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-inline-session.https.html new file mode 100644 index 0000000000..8f3e01134a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/web-xr-inline-session.https.html @@ -0,0 +1,24 @@ + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/window-move.html b/testing/web-platform/tests/speculation-rules/prerender/resources/window-move.html new file mode 100644 index 0000000000..0c5888c957 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/window-move.html @@ -0,0 +1,62 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/window-open-during-prerendering.html b/testing/web-platform/tests/speculation-rules/prerender/resources/window-open-during-prerendering.html new file mode 100644 index 0000000000..a314d5005b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/window-open-during-prerendering.html @@ -0,0 +1,41 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/window-open-in-prerenderingchange.html b/testing/web-platform/tests/speculation-rules/prerender/resources/window-open-in-prerenderingchange.html new file mode 100644 index 0000000000..f32126f93d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/window-open-in-prerenderingchange.html @@ -0,0 +1,65 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/window-resize.html b/testing/web-platform/tests/speculation-rules/prerender/resources/window-resize.html new file mode 100644 index 0000000000..8b6172ee16 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/window-resize.html @@ -0,0 +1,64 @@ + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-on-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-on-iframe.html new file mode 100644 index 0000000000..cc49e202c3 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-on-iframe.html @@ -0,0 +1,97 @@ + +WindowClient.navigate() on a prerendered iframe + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-worker.js b/testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-worker.js new file mode 100644 index 0000000000..8a17b13bbb --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/windowclient-navigate-worker.js @@ -0,0 +1,38 @@ +importScripts("/speculation-rules/prerender/resources/utils.js"); + +const params = new URLSearchParams(location.search); +const uid = params.get('uid'); + +const bc = new PrerenderChannel('navigation-channel', uid); + +bc.onmessage = async e => { + const data = JSON.parse(e.data); + const navigationUrl = data.navigationUrl; + const clientUrl = data.clientUrl; + const respondTo = data.respondTo; + + const clients = await self.clients.matchAll(); + const client = clients.find(c => c.url == clientUrl); + if (!client) { + const bc = new PrerenderChannel(respondTo, uid); + bc.postMessage('Client was not found'); + bc.close(); + return; + } + + let result; + try { + await client.navigate(navigationUrl); + result = 'navigate() succeeded'; + } catch (e) { + if (e instanceof TypeError) { + result = 'navigate() failed with TypeError'; + } else { + result = 'navigate() failed with unknown error'; + } + } finally { + const bc = new PrerenderChannel(respondTo, uid); + bc.postMessage(result); + bc.close(); + } +}; diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/worker-post-timeOrigin.js b/testing/web-platform/tests/speculation-rules/prerender/resources/worker-post-timeOrigin.js new file mode 100644 index 0000000000..86c7d3136d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/worker-post-timeOrigin.js @@ -0,0 +1 @@ +postMessage(performance.timeOrigin); diff --git a/testing/web-platform/tests/speculation-rules/prerender/resources/workers-in-cross-origin-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/resources/workers-in-cross-origin-iframe.html new file mode 100644 index 0000000000..8f27533ed1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/resources/workers-in-cross-origin-iframe.html @@ -0,0 +1,15 @@ + +Construction of Web Workers is deferred + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/response-code-non-successful.html b/testing/web-platform/tests/speculation-rules/prerender/response-code-non-successful.html new file mode 100644 index 0000000000..149971719c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/response-code-non-successful.html @@ -0,0 +1,30 @@ + +Check that non-successful responses result in discarding the prerender + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/response-code-successful.html b/testing/web-platform/tests/speculation-rules/prerender/response-code-successful.html new file mode 100644 index 0000000000..adf8a8932f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/response-code-successful.html @@ -0,0 +1,28 @@ + +Check that successful responses result in activating the prerender + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html new file mode 100644 index 0000000000..3cdc852802 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId-with-invalid-sinkId.https.tentative.html @@ -0,0 +1,59 @@ + + +Access to the setSinkId of the Audio API with an invalid value is deferred + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html new file mode 100644 index 0000000000..8ae72860f0 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-audio-setSinkId.https.tentative.html @@ -0,0 +1,58 @@ + +Access to the setSinkId of the Audio API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-background-fetch.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-background-fetch.https.html new file mode 100644 index 0000000000..cd1550b819 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-background-fetch.https.html @@ -0,0 +1,66 @@ + +Access to the Background Fetch API is deferred + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-background-sync.tentative.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-background-sync.tentative.https.html new file mode 100644 index 0000000000..05f9388f94 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-background-sync.tentative.https.html @@ -0,0 +1,66 @@ + +Access to the Background Sync API is deferred + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-battery-status.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-battery-status.https.html new file mode 100644 index 0000000000..80e25b08e7 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-battery-status.https.html @@ -0,0 +1,47 @@ + +Access to the Battery Status API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-bluetooth.tentative.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-bluetooth.tentative.https.html new file mode 100644 index 0000000000..243a5d5a74 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-bluetooth.tentative.https.html @@ -0,0 +1,59 @@ + +Access to the Bluetooth API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-broadcast-channel.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-broadcast-channel.html new file mode 100644 index 0000000000..7225e64cf9 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-broadcast-channel.html @@ -0,0 +1,60 @@ + +BroadcastChannel#postMessage is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-dedicated-worker.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-dedicated-worker.https.html new file mode 100644 index 0000000000..c58bd3434f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-dedicated-worker.https.html @@ -0,0 +1,56 @@ + +Access to the Dedicated Worker API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media-unsupported-config.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media-unsupported-config.https.html new file mode 100644 index 0000000000..6a5cc0e89a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media-unsupported-config.https.html @@ -0,0 +1,57 @@ + +Access to the Encrypted Media API is deferred with unsupported config + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media.https.html new file mode 100644 index 0000000000..9c375f59c9 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-encrypted-media.https.html @@ -0,0 +1,55 @@ + +Access to the Encrypted Media API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-focus.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-focus.html new file mode 100644 index 0000000000..1149b8bd09 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-focus.html @@ -0,0 +1,40 @@ + +Prerendering documents are not focused + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-idle-detection.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-idle-detection.https.html new file mode 100644 index 0000000000..688ae00ba7 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-idle-detection.https.html @@ -0,0 +1,35 @@ + +Prerendering cannot invoke the Idle Detection API + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-local-file-system-access.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-local-file-system-access.https.html new file mode 100644 index 0000000000..78aa2da84d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-local-file-system-access.https.html @@ -0,0 +1,32 @@ + +Same-origin prerendering cannot access local file system + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-media-auto-play-attribute.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-auto-play-attribute.html new file mode 100644 index 0000000000..2fbcc35124 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-auto-play-attribute.html @@ -0,0 +1,69 @@ + + +Access to the Autoplay of the Media is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-media-camera.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-camera.https.html new file mode 100644 index 0000000000..78f7dd098d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-camera.https.html @@ -0,0 +1,57 @@ + +Access to the Camera of the user media device is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-media-device-info.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-device-info.https.html new file mode 100644 index 0000000000..2e419c027e --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-device-info.https.html @@ -0,0 +1,55 @@ + +Access to the Media Device Info is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-media-microphone.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-microphone.https.html new file mode 100644 index 0000000000..09385be4b1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-microphone.https.html @@ -0,0 +1,57 @@ + +Access to the Microphone of the user media device is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-media-play.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-play.html new file mode 100644 index 0000000000..495019d7cc --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-media-play.html @@ -0,0 +1,71 @@ + + +Access to the Play of the Media is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-message-boxes.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-message-boxes.html new file mode 100644 index 0000000000..b494a57257 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-message-boxes.html @@ -0,0 +1,51 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-midi-sysex.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-midi-sysex.https.html new file mode 100644 index 0000000000..a48fbd39c3 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-midi-sysex.https.html @@ -0,0 +1,64 @@ + +Access to the Midi API with sysex=true is deferred + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-midi.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-midi.https.html new file mode 100644 index 0000000000..6338700d7f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-midi.https.html @@ -0,0 +1,64 @@ + +Access to the Midi API with sysex=false is deferred + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-notification.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-notification.https.html new file mode 100644 index 0000000000..c7428387a4 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-notification.https.html @@ -0,0 +1,106 @@ + + +Access to the Notification API before and after prerender activation + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-presentation-request.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-presentation-request.https.html new file mode 100644 index 0000000000..5f7742204e --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-presentation-request.https.html @@ -0,0 +1,33 @@ + +Same-origin prerendering cannot start presentation + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-prompt-by-before-unload.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-prompt-by-before-unload.html new file mode 100644 index 0000000000..16ebe4f39b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-prompt-by-before-unload.html @@ -0,0 +1,35 @@ + +Prerendering cannot invoke the prompt generated by the + beforeunload event + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-push.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-push.https.html new file mode 100644 index 0000000000..ec1ca48da9 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-push.https.html @@ -0,0 +1,67 @@ + +Access to the Push API is deferred + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-request-picture-in-picture.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-request-picture-in-picture.html new file mode 100644 index 0000000000..5bad4fed60 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-request-picture-in-picture.html @@ -0,0 +1,36 @@ + +Prerendering cannot invoke + HTMLVideoElement.requestPictureInPicture + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-screen-capture.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-screen-capture.https.html new file mode 100644 index 0000000000..2cd7fb662f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-screen-capture.https.html @@ -0,0 +1,35 @@ + +Prerendering cannot invoke the Screen Capture API + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-screen-orientation-lock.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-screen-orientation-lock.https.html new file mode 100644 index 0000000000..7c2be6acec --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-screen-orientation-lock.https.html @@ -0,0 +1,48 @@ + +Access to the Screen Orientation Lock API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-accelerometer.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-accelerometer.https.html new file mode 100644 index 0000000000..fdeb7e39be --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-accelerometer.https.html @@ -0,0 +1,64 @@ + +Access to the Accelerometer API is deferred + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-ambient-light-sensor.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-ambient-light-sensor.https.html new file mode 100644 index 0000000000..63db989bc4 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-ambient-light-sensor.https.html @@ -0,0 +1,64 @@ + +Access to the Ambient Light Sensor API is deferred + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-gyroscope.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-gyroscope.https.html new file mode 100644 index 0000000000..6b8780d7e9 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-gyroscope.https.html @@ -0,0 +1,64 @@ + +Access to the Gyroscope API is deferred + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-magnetometer.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-magnetometer.https.html new file mode 100644 index 0000000000..c1267bf198 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-sensor-magnetometer.https.html @@ -0,0 +1,64 @@ + +Access to the Magnetometer API is deferred + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-postmessage.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-postmessage.https.html new file mode 100644 index 0000000000..1f8afb5aa2 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-postmessage.https.html @@ -0,0 +1,59 @@ + +postMessage() between service worker and prerendered page + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-unregister.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-unregister.https.html new file mode 100644 index 0000000000..669e7ee0a2 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-unregister.https.html @@ -0,0 +1,56 @@ + +ServiceWorkerRegistration.unregister in a prerendered page + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-update.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-update.https.html new file mode 100644 index 0000000000..92c16e5433 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-service-worker-update.https.html @@ -0,0 +1,56 @@ + +ServiceWorkerRegistration.update in a prerendered page + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-speech-synthesis.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-speech-synthesis.html new file mode 100644 index 0000000000..8743d1fd95 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-speech-synthesis.html @@ -0,0 +1,61 @@ + +Access to the speech synthesis is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-storage-persist.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-storage-persist.https.html new file mode 100644 index 0000000000..7d2f04f6d0 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-storage-persist.https.html @@ -0,0 +1,55 @@ + +Access to storage.persist() is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-wake-lock.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-wake-lock.https.html new file mode 100644 index 0000000000..051cc5440f --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-wake-lock.https.html @@ -0,0 +1,72 @@ + +Access to the Wake Lock API is deferred + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-hid.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-hid.https.html new file mode 100644 index 0000000000..c96173ac17 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-hid.https.html @@ -0,0 +1,47 @@ + +Access to the Web HID API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-locks.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-locks.https.html new file mode 100644 index 0000000000..02b328d3a3 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-locks.https.html @@ -0,0 +1,50 @@ + +Access to the Web Locks API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-nfc.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-nfc.https.html new file mode 100644 index 0000000000..8e0825537e --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-nfc.https.html @@ -0,0 +1,49 @@ + +Access to the Web NFC API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-serial.tentative.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-serial.tentative.https.html new file mode 100644 index 0000000000..1d58bfa547 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-serial.tentative.https.html @@ -0,0 +1,49 @@ + +Access to the Web Serial API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-share.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-share.https.html new file mode 100644 index 0000000000..3bc071d5b4 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-share.https.html @@ -0,0 +1,34 @@ + +Prerendering cannot invoke the Web Share API + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-usb.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-usb.https.html new file mode 100644 index 0000000000..9d96a39c9c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-usb.https.html @@ -0,0 +1,46 @@ + +Access to the Web USB API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-immersive-vr-session.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-immersive-vr-session.https.html new file mode 100644 index 0000000000..b864718ccd --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-immersive-vr-session.https.html @@ -0,0 +1,57 @@ + +Access to the WebXR immersive-vr session API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-inline-session.https.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-inline-session.https.html new file mode 100644 index 0000000000..4f308a7543 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-web-xr-inline-session.https.html @@ -0,0 +1,57 @@ + +Access to the WebXR inline session API is deferred + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-window-move.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-window-move.html new file mode 100644 index 0000000000..e8011311f6 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-window-move.html @@ -0,0 +1,49 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-window-open.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-window-open.html new file mode 100644 index 0000000000..5de23efc77 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-window-open.html @@ -0,0 +1,41 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restriction-window-resize.html b/testing/web-platform/tests/speculation-rules/prerender/restriction-window-resize.html new file mode 100644 index 0000000000..20a71b4bdb --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restriction-window-resize.html @@ -0,0 +1,50 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/restrictions.html b/testing/web-platform/tests/speculation-rules/prerender/restrictions.html new file mode 100644 index 0000000000..5019d4b280 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/restrictions.html @@ -0,0 +1,34 @@ + +Same-origin prerendering can access localStorage + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/sandbox-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/sandbox-iframe.html new file mode 100644 index 0000000000..0f0a259a06 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/sandbox-iframe.html @@ -0,0 +1,57 @@ + + +Load a prerendered iframe with sandbox attributes + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/script-supports-speculationrules.html b/testing/web-platform/tests/speculation-rules/prerender/script-supports-speculationrules.html new file mode 100644 index 0000000000..2dc856fce5 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/script-supports-speculationrules.html @@ -0,0 +1,21 @@ + + +HTMLScriptElement.supports speculationrules + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/service-workers.https.html b/testing/web-platform/tests/speculation-rules/prerender/service-workers.https.html new file mode 100644 index 0000000000..6a45276057 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/service-workers.https.html @@ -0,0 +1,117 @@ + +Same-origin prerendering can access Indexed Database + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/session-history-activation.https.html b/testing/web-platform/tests/speculation-rules/prerender/session-history-activation.https.html new file mode 100644 index 0000000000..574c2783bc --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/session-history-activation.https.html @@ -0,0 +1,28 @@ + +Test history.length + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/session-history-location.https.html b/testing/web-platform/tests/speculation-rules/prerender/session-history-location.https.html new file mode 100644 index 0000000000..c68a515ec1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/session-history-location.https.html @@ -0,0 +1,36 @@ + +Test history.length + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/session-history-navigation.https.html b/testing/web-platform/tests/speculation-rules/prerender/session-history-navigation.https.html new file mode 100644 index 0000000000..2f4fab7d7b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/session-history-navigation.https.html @@ -0,0 +1,24 @@ + +Test history.length + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/session-history-pushstate.https.html b/testing/web-platform/tests/speculation-rules/prerender/session-history-pushstate.https.html new file mode 100644 index 0000000000..9e9b50a77a --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/session-history-pushstate.https.html @@ -0,0 +1,29 @@ + +Test history.length + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-navigation.https.html b/testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-navigation.https.html new file mode 100644 index 0000000000..f5c2558c3d --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-navigation.https.html @@ -0,0 +1,22 @@ + +Test history.length during a subframe navigation + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-reload.https.html b/testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-reload.https.html new file mode 100644 index 0000000000..1908cd5fe2 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/session-history-subframe-reload.https.html @@ -0,0 +1,22 @@ + +Test history.length and reloading a subframe + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/state-and-event.html b/testing/web-platform/tests/speculation-rules/prerender/state-and-event.html new file mode 100644 index 0000000000..b8252121b1 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/state-and-event.html @@ -0,0 +1,48 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/visibility-state.html b/testing/web-platform/tests/speculation-rules/prerender/visibility-state.html new file mode 100644 index 0000000000..023ee51293 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/visibility-state.html @@ -0,0 +1,25 @@ + +visibilityState must be updated after prerendering + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/web-database.https.html b/testing/web-platform/tests/speculation-rules/prerender/web-database.https.html new file mode 100644 index 0000000000..3ef1141e20 --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/web-database.https.html @@ -0,0 +1,72 @@ + +Same-origin prerendering can access Web Database + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-cross-origin-url-on-iframe.https.html b/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-cross-origin-url-on-iframe.https.html new file mode 100644 index 0000000000..a1fb63f77b --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-cross-origin-url-on-iframe.https.html @@ -0,0 +1,82 @@ + + +WindowClient.navigate() to cross-origin url in a prerendered iframe + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-same-origin-url-on-iframe.https.html b/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-same-origin-url-on-iframe.https.html new file mode 100644 index 0000000000..16989577df --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate-to-same-origin-url-on-iframe.https.html @@ -0,0 +1,56 @@ + +WindowClient.navigate() to same-origin url in a prerendered iframe + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate.https.html b/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate.https.html new file mode 100644 index 0000000000..3b335967ef --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/windowclient-navigate.https.html @@ -0,0 +1,71 @@ + +WindowClient.navigate() for prerendered main page + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/workers-in-cross-origin-iframe.html b/testing/web-platform/tests/speculation-rules/prerender/workers-in-cross-origin-iframe.html new file mode 100644 index 0000000000..8d79f43a4e --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/workers-in-cross-origin-iframe.html @@ -0,0 +1,51 @@ + +Construction of Web Workers in cross-origin iframe is deferred + + + + + + + + + + + + diff --git a/testing/web-platform/tests/speculation-rules/prerender/workers.html b/testing/web-platform/tests/speculation-rules/prerender/workers.html new file mode 100644 index 0000000000..daaedf481c --- /dev/null +++ b/testing/web-platform/tests/speculation-rules/prerender/workers.html @@ -0,0 +1,96 @@ + +Construction of Web Workers is deferred + + + + + + + + + -- cgit v1.2.3