summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_739531.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /browser/components/sessionstore/test/browser_739531.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/components/sessionstore/test/browser_739531.js')
-rw-r--r--browser/components/sessionstore/test/browser_739531.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_739531.js b/browser/components/sessionstore/test/browser_739531.js
new file mode 100644
index 000000000..e5927caf6
--- /dev/null
+++ b/browser/components/sessionstore/test/browser_739531.js
@@ -0,0 +1,47 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// This test ensures that attempts made to save/restore ("duplicate") pages
+// using designmode AND make changes to document structure (remove body)
+// don't result in uncaught errors and a broken browser state.
+
+function test() {
+ waitForExplicitFinish();
+
+ let testURL = "http://mochi.test:8888/browser/" +
+ "browser/components/sessionstore/test/browser_739531_sample.html";
+
+ let loadCount = 0;
+ let tab = gBrowser.addTab(testURL);
+ tab.linkedBrowser.addEventListener("load", function onLoad(aEvent) {
+ // make sure both the page and the frame are loaded
+ if (++loadCount < 2)
+ return;
+ tab.linkedBrowser.removeEventListener("load", onLoad, true);
+
+ // executeSoon to allow the JS to execute on the page
+ executeSoon(function() {
+
+ let tab2;
+ let caughtError = false;
+ try {
+ tab2 = ss.duplicateTab(window, tab);
+ }
+ catch (e) {
+ caughtError = true;
+ info(e);
+ }
+
+ is(gBrowser.tabs.length, 3, "there should be 3 tabs")
+
+ ok(!caughtError, "duplicateTab didn't throw");
+
+ // if the test fails, we don't want to try to close a tab that doesn't exist
+ if (tab2)
+ gBrowser.removeTab(tab2);
+ gBrowser.removeTab(tab);
+
+ finish();
+ });
+ }, true);
+}