|
1 <html> |
|
2 <head> |
|
3 <script> |
|
4 |
|
5 window.addEventListener("message", onMessageReceived, false); |
|
6 |
|
7 function postMsg(msg) |
|
8 { |
|
9 parent.postMessage(msg, "http://mochi.test:8888"); |
|
10 } |
|
11 |
|
12 function onMessageReceived(event) |
|
13 { |
|
14 if (event.data == "check") { |
|
15 postMsg(sessionStorage.getItem("foo")); |
|
16 |
|
17 var gotValue = "threw"; |
|
18 try { |
|
19 gotValue = sessionStorage.getItem("foo-https"); |
|
20 } catch (e) { |
|
21 } |
|
22 |
|
23 postMsg(gotValue); |
|
24 |
|
25 postMsg("the end"); |
|
26 } |
|
27 } |
|
28 |
|
29 function start() |
|
30 { |
|
31 sessionStorage.setItem("foo", "insecure"); |
|
32 postMsg(sessionStorage.getItem("foo")); |
|
33 } |
|
34 |
|
35 </script> |
|
36 </head> |
|
37 <body onload="start();"> |
|
38 insecure |
|
39 </body> |
|
40 </html> |