browser/components/sessionstore/test/browser_739531.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 }

mercurial