browser/base/content/test/general/browser_bug495058.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 function test() {
     2   waitForExplicitFinish();
     3   next();
     4 }
     6 var uris = [
     7   "about:blank",
     8   "about:sessionrestore",
     9   "about:privatebrowsing",
    10 ];
    12 function next() {
    13   var tab = gBrowser.addTab();
    14   var uri = uris.shift();
    16   if (uri == "about:blank") {
    17     detach();
    18   } else {
    19     let browser = tab.linkedBrowser;
    20     browser.addEventListener("load", function () {
    21       browser.removeEventListener("load", arguments.callee, true);
    22       detach();
    23     }, true);
    24     browser.loadURI(uri);
    25   }
    27   function detach() {
    28     var win = gBrowser.replaceTabWithWindow(tab);
    30     whenDelayedStartupFinished(win, function () {
    31       is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
    32       is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
    33       is(win.gURLBar.value, "", uri + ": urlbar is empty");
    34       ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
    36       win.close();
    37       if (uris.length)
    38         next();
    39       else
    40         executeSoon(finish);
    41     });
    42   }
    43 }

mercurial