Bug 1167224 - Remove getMostRecentBrowserWindow() from nsIBrowserGlue and use RecentWindow in nsBrowserGlue.js. r=mak

This commit is contained in:
Abdelrhman Ahmed 2015-05-24 07:05:00 -04:00
parent 88abbbb5cb
commit d76a348b9d
2 changed files with 13 additions and 24 deletions

View File

@ -375,7 +375,7 @@ BrowserGlue.prototype = {
case "handle-xul-text-link":
let linkHandled = subject.QueryInterface(Ci.nsISupportsPRBool);
if (!linkHandled.data) {
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
if (win) {
win.openUILinkIn(data, "tab");
linkHandled.data = true;
@ -393,7 +393,7 @@ BrowserGlue.prototype = {
// browser.js:BrowserSearch.recordSearchInHealthReport(). The code could
// be consolidated if there is will. We need the observer in
// nsBrowserGlue to prevent double counting.
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
BrowserUITelemetry.countSearchEvent("urlbar", win.gURLBar.value);
let engine = null;
@ -813,7 +813,7 @@ BrowserGlue.prototype = {
},
_showSlowStartupNotification: function () {
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
if (!win)
return;
@ -847,7 +847,7 @@ BrowserGlue.prototype = {
* Show a notification bar offering a reset if the profile has been unused for some time.
*/
_resetUnusedProfileNotification: function () {
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
if (!win)
return;
@ -877,7 +877,7 @@ BrowserGlue.prototype = {
},
_notifyUnsignedAddonsDisabled: function () {
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
if (!win)
return;
@ -1075,7 +1075,7 @@ BrowserGlue.prototype = {
// them to the user.
let changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED);
if (changedIDs.length > 0) {
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
AddonManager.getAddonsByIDs(changedIDs, function(aAddons) {
aAddons.forEach(function(aAddon) {
// If the add-on isn't user disabled or can't be enabled then skip it.
@ -1115,7 +1115,7 @@ BrowserGlue.prototype = {
if (shouldCheck && !isDefault && !willRecoverSession) {
Services.tm.mainThread.dispatch(function() {
DefaultBrowserCheck.prompt(this.getMostRecentBrowserWindow());
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
}
}
@ -1339,7 +1339,7 @@ BrowserGlue.prototype = {
let key = getNotifyString({propName: "notificationButtonAccessKey",
stringName: "pu.notifyButton.accesskey"});
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
let notifyBox = win.document.getElementById("high-priority-global-notificationbox");
let buttons = [
@ -1380,12 +1380,11 @@ BrowserGlue.prototype = {
let url = getNotifyString({propName: "alertURL",
prefName: "startup.homepage_override_url"});
var self = this;
function clickCallback(subject, topic, data) {
// This callback will be called twice but only once with this topic
if (topic != "alertclickcallback")
return;
let win = self.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
win.openUILinkIn(data, "tab");
}
@ -1406,7 +1405,7 @@ BrowserGlue.prototype = {
getService(Ci.nsIURLFormatter);
var updateUrl = formatter.formatURLPref(PREF_PLUGINS_UPDATEURL);
var win = this.getMostRecentBrowserWindow();
var win = RecentWindow.getMostRecentBrowserWindow();
win.openUILinkIn(updateUrl, "tab");
},
@ -1655,7 +1654,7 @@ BrowserGlue.prototype = {
formatURLPref("app.support.baseURL");
url += helpTopic;
var win = this.getMostRecentBrowserWindow();
var win = RecentWindow.getMostRecentBrowserWindow();
var buttons = [
{
@ -2201,11 +2200,6 @@ BrowserGlue.prototype = {
}
}),
// this returns the most recent non-popup browser window
getMostRecentBrowserWindow: function BG_getMostRecentBrowserWindow() {
return RecentWindow.getMostRecentBrowserWindow();
},
#ifdef MOZ_SERVICES_SYNC
/**
* Called as an observer when Sync's "display URI" notification is fired.
@ -2252,7 +2246,7 @@ BrowserGlue.prototype = {
Services.prefs.setBoolPref("dom.ipc.plugins.flash.disable-protected-mode", true);
Services.prefs.setBoolPref("browser.flash-protected-mode-flip.done", true);
let win = this.getMostRecentBrowserWindow();
let win = RecentWindow.getMostRecentBrowserWindow();
if (!win) {
return;
}

View File

@ -23,7 +23,7 @@ interface nsIDOMWindow;
*
*/
[scriptable, uuid(ea083cb7-6b9d-4695-8b34-2e8f6ce2a860)]
[scriptable, uuid(b0e7c156-d00c-4605-a77d-27c7418f23ae)]
interface nsIBrowserGlue : nsISupports
{
/**
@ -34,9 +34,4 @@ interface nsIBrowserGlue : nsISupports
*
*/
void sanitize(in nsIDOMWindow aParentWindow);
/**
* Gets the most recent window that's a browser (but not a popup)
*/
nsIDOMWindow getMostRecentBrowserWindow();
};