test_cache_untrusted.html (989B)
1 <!-- Any copyright is dedicated to the Public Domain. 2 - http://creativecommons.org/publicdomain/zero/1.0/ --> 3 <!DOCTYPE HTML> 4 <html> 5 <head> 6 <title>Test Cache in untrusted context</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <script type="text/javascript" src="large_url_list.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <script class="testbody" type="text/javascript"> 13 function setupTestIframe() { 14 return new Promise(function(resolve) { 15 var iframe = document.createElement("iframe"); 16 iframe.src = "empty.html"; 17 iframe.onload = function() { 18 window.caches = iframe.contentWindow.caches; 19 resolve(); 20 }; 21 document.body.appendChild(iframe); 22 }); 23 } 24 25 SimpleTest.waitForExplicitFinish(); 26 setupTestIframe().then(function() { 27 is(typeof window.caches, "undefined", "caches should not be usable in untrusted http origin"); 28 SimpleTest.finish(); 29 }); 30 </script> 31 </body> 32 </html>