test_storagePermissionsAccept.html (1642B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>Storage Permission Restrictions</title> 4 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script type="text/javascript" src="storagePermissionsUtils.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 8 </head> 9 <body> 10 <iframe></iframe> 11 12 <script type="text/javascript"> 13 14 task(async function() { 15 await setCookieBehavior(BEHAVIOR_ACCEPT); 16 17 await runTestInWindow(async function() { 18 // We should be able to access storage 19 await storageAllowed(); 20 21 // Same origin iframes should be allowed, unless they redirect to a URI with the null principal 22 await runIFrame("frameStorageAllowed.html"); 23 await runIFrame("frameStorageNullprincipal.sjs"); 24 await runIFrame("frameStorageChrome.html?allowed=yes"); 25 26 // Sandboxed iframes should have the null principal, and thus can't access storage 27 document.querySelector('iframe').setAttribute('sandbox', 'allow-scripts'); 28 await runIFrame("frameStoragePrevented.html#nullprincipal"); 29 await runIFrame("frameStorageNullprincipal.sjs"); 30 document.querySelector('iframe').removeAttribute('sandbox'); 31 32 // Thirdparty iframes should be allowed, unless they redirect to a URI with the null principal 33 await runIFrame(thirdparty + "frameStorageAllowed.html"); 34 await runIFrame(thirdparty + "frameStorageNullprincipal.sjs"); 35 await runIFrame(thirdparty + "frameStorageChrome.html?allowed=yes"); 36 37 // Workers should be able to access storage 38 await runWorker("workerStorageAllowed.js"); 39 }); 40 }); 41 42 </script> 43 </body> 44 </html>