browser/base/content/test/general/browser_bug495058.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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