blob_object_url.https.html (1186B)
1 <!DOCTYPE html> 2 <title>Same-origin prerendering page can create a url for the given 3 objects</title> 4 <meta name="timeout" content="long"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/utils.js"></script> 8 <script src="/common/dispatcher/dispatcher.js"></script> 9 <script src="../resources/utils.js"></script> 10 <script src="resources/utils.js"></script> 11 12 <body> 13 <script> 14 setup(() => assertSpeculationRulesIsSupported()); 15 16 promise_test(async t => { 17 const {exec} = await create_prerendered_page(t); 18 19 const result = await exec(async () => { 20 const blob_contents = "test blob contents"; 21 const blob = new Blob([blob_contents]); 22 const url = URL.createObjectURL(blob); 23 const fetched_content = await fetch(url).then(response => response.text()); 24 URL.revokeObjectURL(url); 25 return fetched_content === blob_contents ? "PASS" : "FAIL"; 26 }); 27 28 // Start prerendering a page that attempts to create a url for a blob. 29 assert_equals( 30 result, "PASS", 31 'prerendering page should be able to create a url for blob and fetch it.'); 32 }, 'prerendering page should be able create url'); 33 34 </script>