dom/tests/mochitest/sessionstorage/frameReplace.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 2 <head>
michael@0 3 <title>sessionStorage replace frame</title>
michael@0 4
michael@0 5 <script type="text/javascript">
michael@0 6
michael@0 7 var shell;
michael@0 8
michael@0 9 function ok(a, message)
michael@0 10 {
michael@0 11 if (!a)
michael@0 12 shell.postMessage("FAILURE: " + message, "http://mochi.test:8888");
michael@0 13 else
michael@0 14 shell.postMessage(message, "http://mochi.test:8888");
michael@0 15 }
michael@0 16
michael@0 17 function is(a, b, message)
michael@0 18 {
michael@0 19 if (a != b)
michael@0 20 shell.postMessage("FAILURE: " + message + ", expected "+b+" got "+a, "http://mochi.test:8888");
michael@0 21 else
michael@0 22 shell.postMessage(message + ", expected "+b+" got "+a, "http://mochi.test:8888");
michael@0 23 }
michael@0 24
michael@0 25 function doTest()
michael@0 26 {
michael@0 27 var query = location.search.substring(1);
michael@0 28 var queries = query.split("&");
michael@0 29
michael@0 30 var action = queries[0];
michael@0 31 shell = queries[1];
michael@0 32 switch (shell)
michael@0 33 {
michael@0 34 case "frame":
michael@0 35 shell = parent;
michael@0 36 break;
michael@0 37 case "window":
michael@0 38 shell = opener;
michael@0 39 break;
michael@0 40 }
michael@0 41
michael@0 42 switch (action)
michael@0 43 {
michael@0 44 case "init":
michael@0 45 sessionStorage.setItem("A", "1");
michael@0 46 sessionStorage.setItem("B", "2");
michael@0 47 sessionStorage.setItem("C", "3");
michael@0 48 is(sessionStorage.getItem("A"), "1", "'A' is '1'");
michael@0 49 is(sessionStorage.getItem("B"), "2", "'A' is '2'");
michael@0 50 is(sessionStorage.getItem("C"), "3", "'A' is '3'");
michael@0 51 break;
michael@0 52
michael@0 53 case "check":
michael@0 54 is(sessionStorage.getItem("A"), null, "'A' is null");
michael@0 55 is(sessionStorage.getItem("B"), null, "'A' is null");
michael@0 56 is(sessionStorage.getItem("C"), null, "'A' is null");
michael@0 57 break;
michael@0 58
michael@0 59 case "clean":
michael@0 60 is(sessionStorage.getItem("A"), "1", "'A' is '1'");
michael@0 61 is(sessionStorage.getItem("B"), "2", "'A' is '2'");
michael@0 62 is(sessionStorage.getItem("C"), "3", "'A' is '3'");
michael@0 63 sessionStorage.clear();
michael@0 64 break;
michael@0 65 }
michael@0 66
michael@0 67 shell.postMessage(action + "_done", "http://mochi.test:8888");
michael@0 68 }
michael@0 69
michael@0 70 </script>
michael@0 71
michael@0 72 </head>
michael@0 73 <body onload="doTest();">
michael@0 74 </body>
michael@0 75 </html>

mercurial