browser_sessionStorage.html (1180B)
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="utf-8"> 5 <title>browser_sessionStorage.html</title> 6 </head> 7 <body> 8 <iframe id="iframe"></iframe> 9 10 <script type="text/javascript"> 11 let isOuter = window == window.top; 12 let args = window.location.search.slice(1).split("&"); 13 let rand = args[0]; 14 15 if (isOuter) { 16 let iframe = document.getElementById("iframe"); 17 let isSecure = args.indexOf("secure") > -1; 18 let scheme = isSecure ? "https" : "http"; 19 // WARNING This iframe might not finish loading before the top level document does 20 // See intermittent bug 1775609, bug 2001322 21 iframe.setAttribute("src", scheme + "://example.com" + location.pathname + "?" + rand); 22 } 23 24 if (sessionStorage.length === 0) { 25 sessionStorage.test = (isOuter ? "outer" : "inner") + "-value-" + rand; 26 document.title = sessionStorage.test; 27 } 28 29 // Log the load so that it becomes more obvious if intermittent failures reoccur 30 onload = () => { 31 dump(`browser_sessionStorage.html ${isOuter ? 'TOP LEVEL' : 'IFRAME'} loaded\n`); 32 } 33 </script> 34 </body> 35 </html>