window_storagePermissions.html (821B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>Storage Permission Restrictions</title> 4 <script type="text/javascript" src="storagePermissionsUtils.js"></script> 5 </head> 6 <body> 7 <iframe></iframe> 8 9 <script type="text/javascript"> 10 11 function ok(a, msg) { 12 opener.postMessage({type: "check", test: !!a, msg }, "*"); 13 } 14 15 function is(a, b, msg) { 16 ok(a === b , msg); 17 } 18 19 let init = false; 20 onmessage = e => { 21 if (!init) { 22 init = true; 23 24 let runnableStr = `(() => {return (${e.data});})();`; 25 let runnable = eval(runnableStr); // eslint-disable-line no-eval 26 runnable.call(this).then(_ => { 27 opener.postMessage({ type: "finish" }, "*"); 28 }).catch(e => { 29 ok(false, e.data); 30 }); 31 32 return; 33 } 34 35 parent.postMessage(e.data, "*"); 36 } 37 38 </script> 39 </body> 40 </html>