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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | function test() { |
michael@0 | 6 | /** Test for Bug 463206 **/ |
michael@0 | 7 | |
michael@0 | 8 | waitForExplicitFinish(); |
michael@0 | 9 | |
michael@0 | 10 | let testURL = "http://mochi.test:8888/browser/" + |
michael@0 | 11 | "browser/components/sessionstore/test/browser_463206_sample.html"; |
michael@0 | 12 | |
michael@0 | 13 | var frameCount = 0; |
michael@0 | 14 | let tab = gBrowser.addTab(testURL); |
michael@0 | 15 | tab.linkedBrowser.addEventListener("load", function(aEvent) { |
michael@0 | 16 | // wait for all frames to load completely |
michael@0 | 17 | if (frameCount++ < 5) |
michael@0 | 18 | return; |
michael@0 | 19 | tab.linkedBrowser.removeEventListener("load", arguments.callee, true); |
michael@0 | 20 | |
michael@0 | 21 | function typeText(aTextField, aValue) { |
michael@0 | 22 | aTextField.value = aValue; |
michael@0 | 23 | |
michael@0 | 24 | let event = aTextField.ownerDocument.createEvent("UIEvents"); |
michael@0 | 25 | event.initUIEvent("input", true, true, aTextField.ownerDocument.defaultView, 0); |
michael@0 | 26 | aTextField.dispatchEvent(event); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | let doc = tab.linkedBrowser.contentDocument; |
michael@0 | 30 | typeText(doc.getElementById("out1"), Date.now()); |
michael@0 | 31 | typeText(doc.getElementsByName("1|#out2")[0], Math.random()); |
michael@0 | 32 | typeText(doc.defaultView.frames[0].frames[1].document.getElementById("in1"), new Date()); |
michael@0 | 33 | |
michael@0 | 34 | let tab2 = gBrowser.duplicateTab(tab); |
michael@0 | 35 | whenTabRestored(tab2, function() { |
michael@0 | 36 | let doc = tab2.linkedBrowser.contentDocument; |
michael@0 | 37 | let win = tab2.linkedBrowser.contentWindow; |
michael@0 | 38 | isnot(doc.getElementById("out1").value, |
michael@0 | 39 | win.frames[1].document.getElementById("out1").value, |
michael@0 | 40 | "text isn't reused for frames"); |
michael@0 | 41 | isnot(doc.getElementsByName("1|#out2")[0].value, "", |
michael@0 | 42 | "text containing | and # is correctly restored"); |
michael@0 | 43 | is(win.frames[1].document.getElementById("out2").value, "", |
michael@0 | 44 | "id prefixes can't be faked"); |
michael@0 | 45 | // Disabled for now, Bug 588077 |
michael@0 | 46 | // isnot(win.frames[0].frames[1].document.getElementById("in1").value, "", |
michael@0 | 47 | // "id prefixes aren't mixed up"); |
michael@0 | 48 | is(win.frames[1].frames[0].document.getElementById("in1").value, "", |
michael@0 | 49 | "id prefixes aren't mixed up"); |
michael@0 | 50 | |
michael@0 | 51 | // clean up |
michael@0 | 52 | gBrowser.removeTab(tab2); |
michael@0 | 53 | gBrowser.removeTab(tab); |
michael@0 | 54 | |
michael@0 | 55 | finish(); |
michael@0 | 56 | }); |
michael@0 | 57 | }, true); |
michael@0 | 58 | } |