From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../html/browsers/sandboxing/inner-iframe.html | 13 ++ .../html/browsers/sandboxing/noscript-iframe.html | 3 + ...from-initial-empty-sandboxed-document.window.js | 46 ++++++ .../sandboxing/resources/check-sandbox-flags.html | 8 ++ .../sandboxing/resources/document-open.html | 14 ++ .../sandboxing/resources/execute-postmessage.html | 5 + .../sandboxing/resources/post-done-to-opener.html | 3 + ...x-inherited-from-initiator-response-helper.html | 15 ++ ...ted-from-initiator-response-helper.html.headers | 1 + .../resources/sandbox-javascript-window-open.html | 18 +++ .../sandboxing/sandbox-allow-same-origin.html | 30 ++++ .../browsers/sandboxing/sandbox-allow-scripts.html | 29 ++++ .../sandboxing/sandbox-disallow-popups.html | 39 ++++++ .../sandboxing/sandbox-disallow-same-origin.html | 35 +++++ ...ow-scripts-via-unsandboxed-popup.tentative.html | 33 +++++ .../sandboxing/sandbox-disallow-scripts.html | 29 ++++ .../sandbox-document-open-mutation.window.js | 37 +++++ .../browsers/sandboxing/sandbox-document-open.html | 50 +++++++ .../sandbox-inherited-from-initiator-frame.html | 64 +++++++++ .../sandbox-inherited-from-initiator-response.html | 46 ++++++ .../sandbox-inherited-from-required-csp.html | 154 +++++++++++++++++++++ ...-initial-empty-document-toward-same-origin.html | 30 ++++ .../sandboxing/sandbox-javascript-window-open.html | 19 +++ ...sandbox-navigation-timing-iframe.tentative.html | 16 +++ .../sandbox-navigation-timing.tentative.html | 29 ++++ .../sandbox-new-execution-context-iframe.html | 5 + .../sandboxing/sandbox-new-execution-context.html | 39 ++++++ .../sandboxing/sandbox-parse-noscript-ref.html | 6 + .../sandboxing/sandbox-parse-noscript.html | 7 + .../sandboxing/sandbox-window-open-srcdoc.html | 52 +++++++ ...window-open-blank-from-different-initiator.html | 90 ++++++++++++ 31 files changed, 965 insertions(+) create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/inner-iframe.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/noscript-iframe.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/popup-from-initial-empty-sandboxed-document.window.js create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/resources/check-sandbox-flags.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/resources/document-open.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/resources/execute-postmessage.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/resources/post-done-to-opener.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html.headers create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-same-origin.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-scripts.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-popups.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-same-origin.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts-via-unsandboxed-popup.tentative.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-document-open-mutation.window.js create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-document-open.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-frame.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-response.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-required-csp.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-initial-empty-document-toward-same-origin.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-javascript-window-open.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing-iframe.tentative.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing.tentative.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript-ref.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/sandbox-window-open-srcdoc.html create mode 100644 testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html (limited to 'testing/web-platform/tests/html/browsers/sandboxing') diff --git a/testing/web-platform/tests/html/browsers/sandboxing/inner-iframe.html b/testing/web-platform/tests/html/browsers/sandboxing/inner-iframe.html new file mode 100644 index 0000000000..229f6b3d85 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/inner-iframe.html @@ -0,0 +1,13 @@ + + + + + + +
foo
+ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/noscript-iframe.html b/testing/web-platform/tests/html/browsers/sandboxing/noscript-iframe.html new file mode 100644 index 0000000000..677b5fc83a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/noscript-iframe.html @@ -0,0 +1,3 @@ + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/popup-from-initial-empty-sandboxed-document.window.js b/testing/web-platform/tests/html/browsers/sandboxing/popup-from-initial-empty-sandboxed-document.window.js new file mode 100644 index 0000000000..1ae4fad0cb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/popup-from-initial-empty-sandboxed-document.window.js @@ -0,0 +1,46 @@ +// META: timeout=long +// META: script=/common/utils.js +// META: script=/common/dispatcher/dispatcher.js + +// Regression test for: https://crbug.com/1256822. +// +// From a sandboxed iframe allowing popups, scripts, and same-origin. Open a +// popup using the WindowProxy of a new iframe that is still on the initial +// empty document. Check that the sandbox flags are properly inherited. + +// Return true if the execution context is sandboxed. +const isSandboxed = () => { + try { + // Setting document.domain in sandboxed document throw errors. + document.domain = document.domain; + return false; + } catch (error) { + return true; + } +} + +promise_test(async test => { + // 1. Create a sandboxed iframe, allowing popups, same-origin and scripts. + const iframe_token = token(); + const iframe_document = new RemoteContext(iframe_token); + const iframe_url = remoteExecutorUrl(iframe_token); + const iframe = document.createElement("iframe"); + iframe.sandbox = "allow-same-origin allow-scripts allow-popups"; + iframe.src = iframe_url; + document.body.appendChild(iframe); + assert_true(await iframe_document.execute_script(isSandboxed), + "iframe is sandboxed"); + + // 2. From the sandboxed iframe, create an empty iframe, and open a popup + // using it's WindowProxy. The popup must inherit sandbox flags. + const popup_token = token(); + const popup_document = new RemoteContext(popup_token); + const popup_url = remoteExecutorUrl(popup_token); + iframe_document.execute_script((popup_url) => { + let iframe = document.createElement("iframe"); + iframe.name = "iframe_name"; + document.body.appendChild(iframe); + iframe_name.open(popup_url); + }, [popup_url.href]); + assert_true(await popup_document.execute_script(isSandboxed), "popup is sandboxed"); +}); diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/check-sandbox-flags.html b/testing/web-platform/tests/html/browsers/sandboxing/resources/check-sandbox-flags.html new file mode 100644 index 0000000000..0dc95315f1 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/check-sandbox-flags.html @@ -0,0 +1,8 @@ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/document-open.html b/testing/web-platform/tests/html/browsers/sandboxing/resources/document-open.html new file mode 100644 index 0000000000..136c494d5a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/document-open.html @@ -0,0 +1,14 @@ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/execute-postmessage.html b/testing/web-platform/tests/html/browsers/sandboxing/resources/execute-postmessage.html new file mode 100644 index 0000000000..89bd268f9c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/execute-postmessage.html @@ -0,0 +1,5 @@ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/post-done-to-opener.html b/testing/web-platform/tests/html/browsers/sandboxing/resources/post-done-to-opener.html new file mode 100644 index 0000000000..b47f0f274e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/post-done-to-opener.html @@ -0,0 +1,3 @@ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html new file mode 100644 index 0000000000..29c7f12441 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html @@ -0,0 +1,15 @@ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html.headers b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html.headers new file mode 100644 index 0000000000..82e8023d0b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-inherited-from-initiator-response-helper.html.headers @@ -0,0 +1 @@ +Content-Security-Policy: sandbox allow-scripts allow-same-origin diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html new file mode 100644 index 0000000000..909956a54f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html @@ -0,0 +1,18 @@ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-same-origin.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-same-origin.html new file mode 100644 index 0000000000..d6b3b099f2 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-same-origin.html @@ -0,0 +1,30 @@ + + + + DOM access in sandbox="allow-same-origin" iframe + + + + + + + +

DOM access in sandbox="allow-same-origin" iframe

+ + + + +
+ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-scripts.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-scripts.html new file mode 100644 index 0000000000..6cf3f5a4a8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-allow-scripts.html @@ -0,0 +1,29 @@ + + + + Script execution in sandbox="allow-scripts" iframe + + + + + + + +

Script execution in sandbox="allow-scripts" iframe

+ + + + +
+ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-popups.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-popups.html new file mode 100644 index 0000000000..8e4b34eb8b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-popups.html @@ -0,0 +1,39 @@ + + +window.open in sandbox iframe + + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-same-origin.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-same-origin.html new file mode 100644 index 0000000000..0dae0137ac --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-same-origin.html @@ -0,0 +1,35 @@ + + + + Access to sandbox iframe + + + + + + + + +

Access to sandbox iframe

+ + + + + +
+ diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts-via-unsandboxed-popup.tentative.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts-via-unsandboxed-popup.tentative.html new file mode 100644 index 0000000000..3c8c0b346a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts-via-unsandboxed-popup.tentative.html @@ -0,0 +1,33 @@ + + + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts.html new file mode 100644 index 0000000000..1bc116ada4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-disallow-scripts.html @@ -0,0 +1,29 @@ + + + + Script execution in sandbox iframe + + + + + + + +

Script execution in sandbox iframe

+ + + + +
+ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-document-open-mutation.window.js b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-document-open-mutation.window.js new file mode 100644 index 0000000000..713ca612c5 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-document-open-mutation.window.js @@ -0,0 +1,37 @@ +// Return whether the current context is sandboxed or not. The implementation do +// not matter much, but might have to change over time depending on what side +// effect sandbox flag have. Feel free to update as needed. +const is_sandboxed = () => { + try { + document.domain = document.domain; + return "not sandboxed"; + } catch (error) { + return "sandboxed"; + } +}; + +promise_test(async test => { + const message = new Promise(r => window.addEventListener("message", r)); + + const iframe_unsandboxed = document.createElement("iframe"); + document.body.appendChild(iframe_unsandboxed); + + const iframe_sandboxed = document.createElement("iframe"); + iframe_sandboxed.sandbox = "allow-same-origin allow-scripts"; + document.body.appendChild(iframe_sandboxed); + + iframe_sandboxed.srcdoc = ` + + + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-frame.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-frame.html new file mode 100644 index 0000000000..ab87fce5e0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-frame.html @@ -0,0 +1,64 @@ + + +Inherit sandbox flags from the initiator's frame + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-response.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-response.html new file mode 100644 index 0000000000..638f1ba783 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-initiator-response.html @@ -0,0 +1,46 @@ + + +Inherit sandbox flags from the initiator's response + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-required-csp.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-required-csp.html new file mode 100644 index 0000000000..04f485cc66 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-inherited-from-required-csp.html @@ -0,0 +1,154 @@ + + +Inherit sandbox from CSP embedded enforcement + + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-initial-empty-document-toward-same-origin.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-initial-empty-document-toward-same-origin.html new file mode 100644 index 0000000000..d1306c9703 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-initial-empty-document-toward-same-origin.html @@ -0,0 +1,30 @@ + + + + Check sandbox-flags inheritance in case of javascript window reuse. + + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-javascript-window-open.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-javascript-window-open.html new file mode 100644 index 0000000000..fd21e9bb02 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-javascript-window-open.html @@ -0,0 +1,19 @@ + + +window.open in sandbox iframe + + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing-iframe.tentative.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing-iframe.tentative.html new file mode 100644 index 0000000000..43726e7720 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing-iframe.tentative.html @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing.tentative.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing.tentative.html new file mode 100644 index 0000000000..686f1c0c9f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-navigation-timing.tentative.html @@ -0,0 +1,29 @@ + + +Sandbox Navigation Timing + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html new file mode 100644 index 0000000000..801e78f9c0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context-iframe.html @@ -0,0 +1,5 @@ + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context.html new file mode 100644 index 0000000000..dc1953aee6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-new-execution-context.html @@ -0,0 +1,39 @@ + + + + Reuse of iframe about:blank document execution context + + + + + + + +

Reuse of iframe about:blank document execution context in sandbox="allow-scripts" iframe

+ +
+ + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript-ref.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript-ref.html new file mode 100644 index 0000000000..9cf92768f7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript-ref.html @@ -0,0 +1,6 @@ + + +noscript parsing when sandbox disables scripting + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript.html new file mode 100644 index 0000000000..bb7ced0a14 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-parse-noscript.html @@ -0,0 +1,7 @@ + + +noscript parsing when sandbox disables scripting + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/sandbox-window-open-srcdoc.html b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-window-open-srcdoc.html new file mode 100644 index 0000000000..6fbff6df82 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/sandbox-window-open-srcdoc.html @@ -0,0 +1,52 @@ + + +window.open("about:srcdoc") from a sandboxed iframe + + + + diff --git a/testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html b/testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html new file mode 100644 index 0000000000..91817c3db4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html @@ -0,0 +1,90 @@ + + + + + + -- cgit v1.2.3