-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add some testing for ancestor bit behavior #56147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <!doctype html> | ||
| <meta charset=utf-8> | ||
| <script src="/resources/testharness.js"></script> | ||
| <script src="/resources/testharnessreport.js"></script> | ||
| <body> | ||
| <script> | ||
| async function getResultPromise(key) { | ||
| return new Promise((resolve) => { | ||
| window.addEventListener("message", (event) => { | ||
| if (event.data?.type != "result" || event.data?.key != key) { | ||
| return; | ||
| } | ||
| resolve(event.data.value); | ||
| }); | ||
| }); | ||
| } | ||
| localStorage.setItem("aba", "unpartitioned"); | ||
| localStorage.setItem("aaa", "unpartitioned"); | ||
| localStorage.setItem("aa-sw-redir", "unpartitioned"); | ||
| let resultDataABA = getResultPromise("aba"); | ||
| let resultDataAAA = getResultPromise("aaa"); | ||
| let resultDataAASW = getResultPromise("aa-sw-redir"); | ||
| </script> | ||
| <iframe src="//{{hosts[alt][www]}}:{{ports[https][0]}}{{location[path]}}/../resources/middle-frame.sub.html?key=aba"></iframe> | ||
| <iframe src="//{{hosts[][]}}:{{ports[https][0]}}{{location[path]}}/../resources/middle-frame.sub.html?key=aaa"></iframe> | ||
| <iframe id="aa-sw-redir"></iframe> | ||
| <script> | ||
| promise_test(async function() { | ||
| let value = await resultDataABA; | ||
| assert_equals(value, null, "Expected partitioned data in A(B(A)) nested frame"); | ||
| localStorage.removeItem("aba"); | ||
| }, "Expected partitioned data in A(B(A)) nested frame") | ||
|
|
||
| promise_test(async function() { | ||
| let value = await resultDataAAA; | ||
| assert_equals(value, "unpartitioned", "Expected unpartitioned data in A(A(A)) nested frame"); | ||
| localStorage.removeItem("aaa"); | ||
| }, "Expected unpartitioned data in A(A(A)) nested frame") | ||
|
|
||
| promise_test(async function() { | ||
| let registration = await navigator.serviceWorker.register("./resources/intercepting-worker.sub.js"); | ||
| this.add_cleanup(async function() { | ||
| await registration.unregister(); | ||
| }); | ||
|
|
||
| let innerFrame = document.getElementById("aa-sw-redir"); | ||
| innerFrame.src ="//{{hosts[][]}}:{{ports[https][0]}}{{location[path]}}/../resources/post-storage.html?key=aa-sw-redir&intercept"; | ||
|
|
||
| let value = await resultDataAASW; | ||
| assert_equals(value, "unpartitioned", "Expected unpartitioned data in same-origin subframe redirected by service worker"); | ||
|
|
||
| localStorage.removeItem("aa-sw-redir"); | ||
| }, "Expected unpartitioned data in same-origin subframe redirected by service worker") | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| self.addEventListener("fetch", (event) => { | ||
| let url = new URL(event.request.url); | ||
| if (url.searchParams.has("intercept")) { | ||
| if (url.hostname == "{{hosts[][]}}") { | ||
| url.hostname = "{{hosts[alt][www]}}" | ||
| } else { | ||
| url.hostname = "{{hosts[][]}}"; | ||
| } | ||
| return event.respondWith(fetch(url)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand how this is doing the CORS thing whatwg/html#11540 (comment) discusses. Or is this testing something else?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was trying to validate that the request vs response partition behavior. I was going to do it with top-level sandboxing, but the sandbox blocks localStorage, so I went this way. I can do a cookie-lookup in a sandboxed-partitioned context if that helps. Adding the CORS headers here though. |
||
| } | ||
| }); | ||
bvandersloot-mozilla marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <!doctype html> | ||
| <meta charset=utf-8> | ||
| <script src="/resources/testharness.js"></script> | ||
bvandersloot-mozilla marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <body> | ||
| <iframe id="innerFrame"></iframe> | ||
| <script> | ||
| window.addEventListener("message", (event) => { | ||
| if (event.data?.type != "result") { | ||
| return; | ||
| } | ||
| parent.postMessage(event.data, "*"); | ||
| }); | ||
| let innerFrame = document.getElementById("innerFrame"); | ||
| innerFrame.src ="//{{hosts[][]}}:{{ports[https][0]}}{{location[path]}}/../../resources/post-storage.html{{location[query]}}"; | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <!doctype html> | ||
| <meta charset=utf-8> | ||
| <script src="/resources/testharness.js"></script> | ||
| <body> | ||
| <iframe id="innerFrame"></iframe> | ||
| <script> | ||
| window.addEventListener("message", (event) => { | ||
| if (event.data?.type != "result") { | ||
| return; | ||
| } | ||
| window.opener.postMessage(event.data, "*"); | ||
| }); | ||
| let innerFrame = document.getElementById("innerFrame"); | ||
| innerFrame.src ="//{{hosts[alt][www]}}:{{ports[https][0]}}{{location[path]}}/../../resources/post-storage.html{{location[query]}}"; | ||
| </script> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!doctype html> | ||
| <meta charset=utf-8> | ||
| <script src="/resources/testharness.js"></script> | ||
| <body> | ||
| <script> | ||
| const urlParams = new URLSearchParams(window.location.search); | ||
| let key = urlParams.get("key"); | ||
| let result = localStorage.getItem(key); | ||
| if (urlParams.has("store")) { | ||
| localStorage.setItem(key, urlParams.get("store")); | ||
| } | ||
| parent.postMessage({ | ||
| type: "result", | ||
| value: result, | ||
| key, | ||
| }, "*"); | ||
| </script> |
Uh oh!
There was an error while loading. Please reload this page.