Wed, 31 Dec 2014 06:09:35 +0100
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>localStorage replace test</title> |
michael@0 | 4 | |
michael@0 | 5 | <!-- |
michael@0 | 6 | This test checks that localStorage object doesn't leak |
michael@0 | 7 | in a window that changes its location. We do this by switching |
michael@0 | 8 | frame location inside of this window and then by changing location |
michael@0 | 9 | of a top level window. |
michael@0 | 10 | --> |
michael@0 | 11 | |
michael@0 | 12 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 13 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 14 | |
michael@0 | 15 | <script type="text/javascript"> |
michael@0 | 16 | |
michael@0 | 17 | var shell; |
michael@0 | 18 | var shellType; |
michael@0 | 19 | var failureRegExp = new RegExp("^FAILURE"); |
michael@0 | 20 | |
michael@0 | 21 | window.addEventListener("message", onMessageReceived, false); |
michael@0 | 22 | |
michael@0 | 23 | function onMessageReceived(event) |
michael@0 | 24 | { |
michael@0 | 25 | switch (event.data) |
michael@0 | 26 | { |
michael@0 | 27 | case "init_done": |
michael@0 | 28 | // This is frame with different origin in the same browsing context |
michael@0 | 29 | // as the first frame adding data to localStorage of the first origin. |
michael@0 | 30 | shell.location = "http://example.com:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?check&" + shellType; |
michael@0 | 31 | break; |
michael@0 | 32 | |
michael@0 | 33 | case "check_done": |
michael@0 | 34 | // Clean the localStorage of the first origin. |
michael@0 | 35 | shell.location = "http://example.org:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?clean&" + shellType; |
michael@0 | 36 | break; |
michael@0 | 37 | |
michael@0 | 38 | case "clean_done": |
michael@0 | 39 | switch (shellType) |
michael@0 | 40 | { |
michael@0 | 41 | case "frame": |
michael@0 | 42 | // We finished testing in a frame |
michael@0 | 43 | // proceed with test in a separate window |
michael@0 | 44 | shellType = "window"; |
michael@0 | 45 | shell = window.open("http://example.org:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?init&" + shellType); |
michael@0 | 46 | break; |
michael@0 | 47 | |
michael@0 | 48 | case "window": |
michael@0 | 49 | shell.close(); |
michael@0 | 50 | window.setTimeout(function() {SimpleTest.finish();}, 0); |
michael@0 | 51 | break; |
michael@0 | 52 | } |
michael@0 | 53 | break; |
michael@0 | 54 | |
michael@0 | 55 | default: |
michael@0 | 56 | SimpleTest.ok(!event.data.match(failureRegExp), event.data); |
michael@0 | 57 | break; |
michael@0 | 58 | } |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | function startTest() { |
michael@0 | 62 | SpecialPowers.pushPrefEnv({"set": [["security.mixed_content.block_display_content", false], ["security.mixed_content.block_active_content", false]]}, test1); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | function test1() { |
michael@0 | 66 | shellType = "frame"; |
michael@0 | 67 | shell = frame; |
michael@0 | 68 | shell.location = "http://example.org:80/tests/dom/tests/mochitest/localstorage/frameReplace.html?init&" + shellType; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 72 | |
michael@0 | 73 | </script> |
michael@0 | 74 | |
michael@0 | 75 | </head> |
michael@0 | 76 | |
michael@0 | 77 | <body onload="startTest();"> |
michael@0 | 78 | <iframe src="" name="frame"></iframe> |
michael@0 | 79 | </body> |
michael@0 | 80 | </html> |