Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 // This test ensures that attempts made to save/restore ("duplicate") pages
5 // using designmode AND make changes to document structure (remove body)
6 // don't result in uncaught errors and a broken browser state.
8 function test() {
9 waitForExplicitFinish();
11 let testURL = "http://mochi.test:8888/browser/" +
12 "browser/components/sessionstore/test/browser_739531_sample.html";
14 let loadCount = 0;
15 let tab = gBrowser.addTab(testURL);
16 tab.linkedBrowser.addEventListener("load", function onLoad(aEvent) {
17 // make sure both the page and the frame are loaded
18 if (++loadCount < 2)
19 return;
20 tab.linkedBrowser.removeEventListener("load", onLoad, true);
22 // executeSoon to allow the JS to execute on the page
23 executeSoon(function() {
25 let tab2;
26 let caughtError = false;
27 try {
28 tab2 = ss.duplicateTab(window, tab);
29 }
30 catch (e) {
31 caughtError = true;
32 info(e);
33 }
35 is(gBrowser.tabs.length, 3, "there should be 3 tabs")
37 ok(!caughtError, "duplicateTab didn't throw");
39 // if the test fails, we don't want to try to close a tab that doesn't exist
40 if (tab2)
41 gBrowser.removeTab(tab2);
42 gBrowser.removeTab(tab);
44 finish();
45 });
46 }, true);
47 }