test-partitioned-iframes-in-different-origin-windows.https.sub.html (2575B)
1 <!-- 2 Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ 4 --> 5 <html> 6 <head> 7 <meta charset="utf-8" /> 8 <meta name="timeout" content="long" /> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <script src="testHelpers.js"></script> 12 <script> 13 const messageHub = createMotherListener(); 14 15 async function runTests() { 16 const params = new URL(window.location.href).searchParams; 17 const api = params.get("api"); 18 assert_true(!!api); 19 console.log("Tested API " + api); 20 21 const testIdWindow = "DifferentOriginWindowsWith" + api; 22 const testIdWorker = "Worker" + testIdWindow; 23 24 const writeWindows = new Map(); 25 26 const readWindowURL = 27 "https://{{hosts[alt][www1]}}:{{ports[https][0]}}/_mozilla/dom/quota/support/test-read-and-notify-wrapper.https.sub.html"; 28 29 const readWindows = new Map(); 30 31 messageHub.registerReadWindow(testIdWindow); 32 readWindows.set( 33 testIdWindow, 34 window.open(readWindowURL + "?id=" + testIdWindow) 35 ); 36 37 messageHub.registerReadWindow(testIdWorker); 38 readWindows.set( 39 testIdWorker, 40 window.open(readWindowURL + "?id=" + testIdWorker) 41 ); 42 43 const setup = { readWindows, writeWindows }; 44 45 await messageHub.getReadWindow(testIdWindow); 46 async_test(t => { 47 messageHub.registerWindow(t, testIdWindow, api, "deny", setup); 48 49 writeWindows.set( 50 testIdWindow, 51 window.open( 52 "https://{{hosts[][www1]}}:{{ports[https][0]}}/_mozilla/dom/quota/support/test-write-and-notify-wrapper.https.sub.html?id=" + 53 testIdWindow 54 ) 55 ); 56 }, "Access not allowed for two iframes with the same origin on windows with different origins " + api); 57 58 await messageHub.getReadWindow(testIdWorker); 59 async_test(t => { 60 messageHub.registerWorker(t, testIdWorker, api, "deny", setup); 61 62 writeWindows.set( 63 testIdWorker, 64 window.open( 65 "https://{{hosts[][www1]}}:{{ports[https][0]}}/_mozilla/dom/quota/support/test-write-and-notify-wrapper.https.sub.html?id=" + 66 testIdWorker 67 ) 68 ); 69 }, "Reading from worker not allowed for two iframes with the same origin on windows with different origins " + api); 70 } 71 </script> 72 </head> 73 <body onload="runTests();"></body> 74 </html>