1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/sessionstore/test/browser_463206.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +function test() { 1.9 + /** Test for Bug 463206 **/ 1.10 + 1.11 + waitForExplicitFinish(); 1.12 + 1.13 + let testURL = "http://mochi.test:8888/browser/" + 1.14 + "browser/components/sessionstore/test/browser_463206_sample.html"; 1.15 + 1.16 + var frameCount = 0; 1.17 + let tab = gBrowser.addTab(testURL); 1.18 + tab.linkedBrowser.addEventListener("load", function(aEvent) { 1.19 + // wait for all frames to load completely 1.20 + if (frameCount++ < 5) 1.21 + return; 1.22 + tab.linkedBrowser.removeEventListener("load", arguments.callee, true); 1.23 + 1.24 + function typeText(aTextField, aValue) { 1.25 + aTextField.value = aValue; 1.26 + 1.27 + let event = aTextField.ownerDocument.createEvent("UIEvents"); 1.28 + event.initUIEvent("input", true, true, aTextField.ownerDocument.defaultView, 0); 1.29 + aTextField.dispatchEvent(event); 1.30 + } 1.31 + 1.32 + let doc = tab.linkedBrowser.contentDocument; 1.33 + typeText(doc.getElementById("out1"), Date.now()); 1.34 + typeText(doc.getElementsByName("1|#out2")[0], Math.random()); 1.35 + typeText(doc.defaultView.frames[0].frames[1].document.getElementById("in1"), new Date()); 1.36 + 1.37 + let tab2 = gBrowser.duplicateTab(tab); 1.38 + whenTabRestored(tab2, function() { 1.39 + let doc = tab2.linkedBrowser.contentDocument; 1.40 + let win = tab2.linkedBrowser.contentWindow; 1.41 + isnot(doc.getElementById("out1").value, 1.42 + win.frames[1].document.getElementById("out1").value, 1.43 + "text isn't reused for frames"); 1.44 + isnot(doc.getElementsByName("1|#out2")[0].value, "", 1.45 + "text containing | and # is correctly restored"); 1.46 + is(win.frames[1].document.getElementById("out2").value, "", 1.47 + "id prefixes can't be faked"); 1.48 + // Disabled for now, Bug 588077 1.49 + // isnot(win.frames[0].frames[1].document.getElementById("in1").value, "", 1.50 + // "id prefixes aren't mixed up"); 1.51 + is(win.frames[1].frames[0].document.getElementById("in1").value, "", 1.52 + "id prefixes aren't mixed up"); 1.53 + 1.54 + // clean up 1.55 + gBrowser.removeTab(tab2); 1.56 + gBrowser.removeTab(tab); 1.57 + 1.58 + finish(); 1.59 + }); 1.60 + }, true); 1.61 +}