storage-access-beyond-cookies.none.sub.https.window.js (1345B)
1 // META: script=/resources/testdriver.js 2 // META: script=/resources/testdriver-vendor.js 3 4 'use strict'; 5 6 // Here's the set-up for this test: 7 // Step 1 (top-frame) Set up listener for "HasAccess" message. 8 // Step 2 (top-frame) Skipped in this test, but numbering must be consistent with other tests. 9 // Step 3 (top-frame) Embed an iframe that's cross-site with top-frame. 10 // Step 4 (sub-frame) Skipped in this test, but numbering must be consistent with other tests. 11 // Step 5 (sub-frame) Embed an iframe that's same-origin with top-frame. 12 // Step 6 (sub-sub-frame) Try to use storage access API without requesting anything. 13 // Step 7 (sub-sub-frame) Send "HasAccess for none" message to top-frame. 14 // Step 8 (top-frame) Cleanup. 15 16 async_test(t => { 17 // Step 1 18 window.addEventListener("message", t.step_func(e => { 19 // Step 8 20 if (e.data.type != "result") { 21 return; 22 } 23 assert_equals(e.data.message, "HasAccess for none", "Storage Access API should not allow access for empty requests."); 24 t.done(); 25 })); 26 27 // Step 2 28 // Step 3 29 let iframe = document.createElement("iframe"); 30 iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=none&id="; 31 document.body.appendChild(iframe); 32 }, "Verify StorageAccessAPIBeyondCookies for None");