storage-access-beyond-cookies.thirdPartyBlobStorage.sub.https.window.js (1247B)
1 // META: script=/resources/testdriver.js 2 // META: script=/resources/testdriver-vendor.js 3 4 'use strict'; 5 6 async_test(t => { 7 window.addEventListener("message", t.step_func(async e => { 8 if (e.data.type !== "blobURL") { 9 return; 10 } 11 const blob_url = e.data.message; 12 13 // Create an iframe and pass the blob URL to it. 14 const id = btoa(blob_url); 15 const iframe = document.createElement("iframe"); 16 iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=ThirdPartyBlobURL&id=" + id; 17 document.body.appendChild(iframe); 18 19 // Set up a second message listener to receive the result from the iframe. 20 window.addEventListener("message", t.step_func(e => { 21 if (e.data.type !== "result") { 22 return; 23 } 24 assert_equals(e.data.message, "Third Party Blob URL tests completed successfully."); 25 popup.close(); 26 t.done(); 27 })); 28 })); 29 30 // Open a popup to create the blob URL. 31 const popup = window.open("https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/iframe-creation.sub.html"); 32 33 }, "Verify StorageAccessAPIBeyondCookies for third-party context accessing first-party Blob URLs");