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.

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

mercurial