diff --git a/browser/components/places/tests/browser/browser_library_middleclick.js b/browser/components/places/tests/browser/browser_library_middleclick.js index dd001ba1bf03..f160e5434229 100644 --- a/browser/components/places/tests/browser/browser_library_middleclick.js +++ b/browser/components/places/tests/browser/browser_library_middleclick.js @@ -42,8 +42,6 @@ const Cc = Components.classes; const Ci = Components.interfaces; -var gPrefs = Cc["@mozilla.org/preferences-service;1"]. - getService(Ci.nsIPrefBranch); const DISABLE_HISTORY_PREF = "browser.history_expire_days"; var gLibrary = null; @@ -65,7 +63,7 @@ var gTabsListener = { } var tab = aEvent.target; - is(tab.ownerDocument.defaultView.getBrowser(), gBrowser, + is(tab.ownerDocument.defaultView, window, "Tab has been opened in current browser window"); }, @@ -264,7 +262,7 @@ function test() { gBrowser.addTabsProgressListener(gTabsListener); // Temporary disable history, so we won't record pages navigation. - gPrefs.setIntPref(DISABLE_HISTORY_PREF, 0); + gPrefService.setIntPref(DISABLE_HISTORY_PREF, 0); // Window watcher for Library window. var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]. @@ -320,7 +318,7 @@ function runNextTest() { gBrowser.removeTabsProgressListener(gTabsListener); // Restore history. - gPrefs.setIntPref(DISABLE_HISTORY_PREF, 180); + gPrefService.clearUserPref(DISABLE_HISTORY_PREF); finish(); } diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_viewsource.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_viewsource.js index c6ad2c20a962..a93b7c7f97d2 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_viewsource.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_viewsource.js @@ -45,9 +45,8 @@ function test() { waitForExplicitFinish(); - let tabAbout = gBrowser.addTab(); - gBrowser.selectedTab = tabAbout; - let aboutBrowser = gBrowser.getBrowserForTab(tabAbout); + gBrowser.selectedTab = gBrowser.addTab(); + let aboutBrowser = gBrowser.selectedBrowser; aboutBrowser.addEventListener("load", function () { aboutBrowser.removeEventListener("load", arguments.callee, true); @@ -62,7 +61,7 @@ function test() { win.addEventListener("load", function() { win.removeEventListener("load", arguments.callee, false); - let browser = win.document.defaultView.getBrowser(); + let browser = win.getBrowser(); browser.addEventListener("load", function() { browser.removeEventListener("load", arguments.callee, true); @@ -134,7 +133,7 @@ function test() { win.addEventListener("load", function() { win.removeEventListener("load", arguments.callee, false); - let browser = win.document.defaultView.getBrowser(); + let browser = win.getBrowser(); browser.addEventListener("load", function() { browser.removeEventListener("load", arguments.callee, true); @@ -169,16 +168,16 @@ function test() { win.addEventListener("load", function() { win.removeEventListener("load", arguments.callee, false); - let browser = win.document.defaultView.getBrowser(); + let browser = win.getBrowser(); browser.addEventListener("load", function() { browser.removeEventListener("load", arguments.callee, true); - is(browser.currentURI.spec, "view-source:about:", + is(win.content.location.href, "view-source:about:", "The correct view source window should be restored"); // cleanup win.close(); - gBrowser.removeTab(gBrowser.selectedTab); + gBrowser.removeCurrentTab(); finish(); }, true); }, false); diff --git a/browser/components/sessionstore/test/browser/browser_345898.js b/browser/components/sessionstore/test/browser/browser_345898.js index d8e139c0b78c..10b5b8343cbd 100644 --- a/browser/components/sessionstore/test/browser/browser_345898.js +++ b/browser/components/sessionstore/test/browser/browser_345898.js @@ -62,7 +62,7 @@ function test() { "Invalid tab for setTabState throws"); ok(test(function() ss.duplicateTab({}, {})), "Invalid tab for duplicateTab throws"); - ok(test(function() ss.duplicateTab({}, getBrowser().selectedTab)), + ok(test(function() ss.duplicateTab({}, gBrowser.selectedTab)), "Invalid window for duplicateTab throws"); ok(test(function() ss.getClosedTabData({})), "Invalid window for getClosedTabData throws"); @@ -80,6 +80,6 @@ function test() { "Invalid window for deleteWindowValue throws"); ok(test(function() ss.deleteWindowValue(window, Date.now().toString())), "Nonexistent value for deleteWindowValue throws"); - ok(test(function() ss.deleteTabValue(getBrowser().selectedTab, Date.now().toString())), + ok(test(function() ss.deleteTabValue(gBrowser.selectedTab, Date.now().toString())), "Nonexistent value for deleteTabValue throws"); } diff --git a/browser/components/sessionstore/test/browser/browser_346337.js b/browser/components/sessionstore/test/browser/browser_346337.js index 407888c456ed..33e0fada9b48 100644 --- a/browser/components/sessionstore/test/browser/browser_346337.js +++ b/browser/components/sessionstore/test/browser/browser_346337.js @@ -89,7 +89,7 @@ function test() { } // test setup - let tabbrowser = getBrowser(); + let tabbrowser = gBrowser; waitForExplicitFinish(); // make sure we don't save form data at all (except for tab duplication) diff --git a/browser/components/sessionstore/test/browser/browser_350525.js b/browser/components/sessionstore/test/browser/browser_350525.js index 369d42e4f712..fb468f54c902 100644 --- a/browser/components/sessionstore/test/browser/browser_350525.js +++ b/browser/components/sessionstore/test/browser/browser_350525.js @@ -10,7 +10,7 @@ function test() { } // test setup - let tabbrowser = getBrowser(); + let tabbrowser = gBrowser; waitForExplicitFinish(); // component diff --git a/browser/components/sessionstore/test/browser/browser_393716.js b/browser/components/sessionstore/test/browser/browser_393716.js index 08d9b76f2183..7484c8eabd00 100644 --- a/browser/components/sessionstore/test/browser/browser_393716.js +++ b/browser/components/sessionstore/test/browser/browser_393716.js @@ -7,7 +7,7 @@ function test() { } catch (ex) { } ok(ss, "SessionStore service is available"); - let tabbrowser = getBrowser(); + let tabbrowser = gBrowser; waitForExplicitFinish(); ///////////////// diff --git a/browser/components/sessionstore/test/browser/browser_448741.js b/browser/components/sessionstore/test/browser/browser_448741.js index fab5533ffeae..43f9b4e921b3 100644 --- a/browser/components/sessionstore/test/browser/browser_448741.js +++ b/browser/components/sessionstore/test/browser/browser_448741.js @@ -40,14 +40,13 @@ function test() { // test setup let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); let os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); - let tabbrowser = getBrowser(); waitForExplicitFinish(); let uniqueName = "bug 448741"; let uniqueValue = "as good as unique: " + Date.now(); // set a unique value on a new, blank tab - var tab = tabbrowser.addTab(); + var tab = gBrowser.addTab(); ss.setTabValue(tab, uniqueName, uniqueValue); let valueWasCleaned = false; @@ -84,7 +83,7 @@ function test() { ok(aSubject.data.indexOf(uniqueValue) == -1, "data no longer contains our value?"); // clean up - tabbrowser.removeTab(tab); + gBrowser.removeTab(tab); os.removeObserver(this, aTopic, false); gPrefService.clearUserPref("browser.sessionstore.interval"); finish();