From 7ac2f9cfd4fd9e184ee5a1748e505877081caa9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sun, 20 Sep 2009 12:58:27 +0200 Subject: [PATCH] Bug 517704 - use gBrowser instead of getBrowser() in Places code. r=mak --- browser/base/content/browser-places.js | 13 ++++++------- browser/components/places/content/utils.js | 3 +-- .../places/tests/browser/browser_bug399606.js | 8 ++++---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index f4af188b12f..97be3921f06 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -450,7 +450,7 @@ var PlacesCommandHook = { * Adds a bookmark to the page loaded in the current tab. */ bookmarkCurrentPage: function PCH_bookmarkCurrentPage(aShowEditUI, aParent) { - this.bookmarkPage(getBrowser().selectedBrowser, aParent, aShowEditUI); + this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI); }, /** @@ -484,19 +484,18 @@ var PlacesCommandHook = { */ _getUniqueTabInfo: function BATC__getUniqueTabInfo() { var tabList = []; - var seenURIs = []; + var seenURIs = {}; - var browsers = getBrowser().browsers; + var browsers = gBrowser.browsers; for (var i = 0; i < browsers.length; ++i) { - var webNav = browsers[i].webNavigation; - var uri = webNav.currentURI; + let uri = browsers[i].currentURI; // skip redundant entries if (uri.spec in seenURIs) continue; // add to the set of seen URIs - seenURIs[uri.spec] = true; + seenURIs[uri.spec] = null; tabList.push(uri); } return tabList; @@ -1166,7 +1165,7 @@ var PlacesStarButton = { if (!starIcon) return; - var uri = getBrowser().currentURI; + var uri = gBrowser.currentURI; this._starred = uri && (PlacesUtils.getMostRecentBookmarkForURI(uri) != -1 || PlacesUtils.getMostRecentFolderForFeedURI(uri) != -1); if (this._starred) { diff --git a/browser/components/places/content/utils.js b/browser/components/places/content/utils.js index bae1809bd06..542373a95f8 100644 --- a/browser/components/places/content/utils.js +++ b/browser/components/places/content/utils.js @@ -918,8 +918,7 @@ var PlacesUIUtils = { var loadInBackground = where == "tabshifted" ? true : false; var replaceCurrentTab = where == "tab" ? false : true; - browserWindow.getBrowser().loadTabs(urls, loadInBackground, - replaceCurrentTab); + browserWindow.gBrowser.loadTabs(urls, loadInBackground, replaceCurrentTab); }, openContainerNodeInTabs: function PU_openContainerInTabs(aNode, aEvent) { diff --git a/toolkit/components/places/tests/browser/browser_bug399606.js b/toolkit/components/places/tests/browser/browser_bug399606.js index 39cbbe11733..f60b7575b70 100644 --- a/toolkit/components/places/tests/browser/browser_bug399606.js +++ b/toolkit/components/places/tests/browser/browser_bug399606.js @@ -90,8 +90,8 @@ function test() { info("new load count is " + loadCount); if (loadCount == 3) { - window.getBrowser().removeEventListener("DOMContentLoaded", handleLoad, true); - window.content.document.location.href = "about:blank"; + gBrowser.removeEventListener("DOMContentLoaded", handleLoad, true); + content.location.href = "about:blank"; executeSoon(check_next_uri); } } @@ -100,8 +100,8 @@ function test() { if (URIs.length) { let uri = URIs.shift(); loadCount = 0; - window.getBrowser().addEventListener("DOMContentLoaded", handleLoad, true); - window.content.document.location.href = uri; + gBrowser.addEventListener("DOMContentLoaded", handleLoad, true); + content.location.href = uri; } else { setTimeout(confirm_results, LAZY_ADD_TIMER * 2);