зеркало из https://github.com/mozilla/gecko-dev.git
Bug 816995 - Use openUILinkIn instead of the gBrowser.selectedTab = gBrowser.addTab() pattern. r=Mossop
--HG-- extra : rebase_source : cc016af00864d2aaa1468c143f6b053a21ebd7a1
This commit is contained in:
Родитель
5bab670499
Коммит
fd963545b4
|
@ -445,14 +445,14 @@ BrowserGlue.prototype = {
|
|||
// them to the user.
|
||||
let changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED);
|
||||
if (changedIDs.length > 0) {
|
||||
let browser = this.getMostRecentBrowserWindow().gBrowser;
|
||||
let win = this.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.
|
||||
if (!aAddon.userDisabled || !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE))
|
||||
return;
|
||||
|
||||
browser.selectedTab = browser.addTab("about:newaddon?id=" + aAddon.id);
|
||||
win.openUILinkIn("about:newaddon?id=" + aAddon.id, "tab");
|
||||
})
|
||||
});
|
||||
}
|
||||
|
@ -717,8 +717,7 @@ BrowserGlue.prototype = {
|
|||
_showRightsNotification: function BG__showRightsNotification() {
|
||||
// Stick the notification onto the selected tab of the active browser window.
|
||||
var win = this.getMostRecentBrowserWindow();
|
||||
var browser = win.gBrowser; // for closure in notification bar callback
|
||||
var notifyBox = browser.getNotificationBox();
|
||||
var notifyBox = win.gBrowser.getNotificationBox();
|
||||
|
||||
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
||||
var rightsBundle = Services.strings.createBundle("chrome://global/locale/aboutRights.properties");
|
||||
|
@ -734,7 +733,7 @@ BrowserGlue.prototype = {
|
|||
accessKey: buttonAccessKey,
|
||||
popup: null,
|
||||
callback: function(aNotificationBar, aButton) {
|
||||
browser.selectedTab = browser.addTab("about:rights");
|
||||
win.openUILinkIn("about:rights", "tab");
|
||||
}
|
||||
}
|
||||
];
|
||||
|
@ -799,8 +798,7 @@ BrowserGlue.prototype = {
|
|||
stringName: "pu.notifyButton.accesskey"});
|
||||
|
||||
let win = this.getMostRecentBrowserWindow();
|
||||
let browser = win.gBrowser; // for closure in notification bar callback
|
||||
let notifyBox = browser.getNotificationBox();
|
||||
let notifyBox = win.gBrowser.getNotificationBox();
|
||||
|
||||
let buttons = [
|
||||
{
|
||||
|
@ -808,7 +806,7 @@ BrowserGlue.prototype = {
|
|||
accessKey: key,
|
||||
popup: null,
|
||||
callback: function(aNotificationBar, aButton) {
|
||||
browser.selectedTab = browser.addTab(url);
|
||||
win.openUILinkIn(url, "tab");
|
||||
}
|
||||
}
|
||||
];
|
||||
|
@ -847,8 +845,7 @@ BrowserGlue.prototype = {
|
|||
if (topic != "alertclickcallback")
|
||||
return;
|
||||
let win = self.getMostRecentBrowserWindow();
|
||||
let browser = win.gBrowser;
|
||||
browser.selectedTab = browser.addTab(data);
|
||||
win.openUILinkIn(data, "tab");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -926,7 +923,7 @@ BrowserGlue.prototype = {
|
|||
// Open the learn more url in a new tab
|
||||
let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
|
||||
url += "how-can-i-help-submitting-performance-data";
|
||||
tabbrowser.selectedTab = tabbrowser.addTab(url);
|
||||
win.openUILinkIn(url, "tab");
|
||||
// Remove the notification on which the user clicked
|
||||
notification.parentNode.removeNotification(notification, true);
|
||||
}, false);
|
||||
|
@ -973,7 +970,7 @@ BrowserGlue.prototype = {
|
|||
let link = appendLearnMoreLink(notification);
|
||||
link.addEventListener('click', function() {
|
||||
// Open the learn more url in a new tab
|
||||
tabbrowser.selectedTab = tabbrowser.addTab(Services.prefs.getCharPref(PREF_TELEMETRY_INFOURL));
|
||||
win.openUILinkIn(Services.prefs.getCharPref(PREF_TELEMETRY_INFOURL), "tab");
|
||||
// Remove the notification on which the user clicked
|
||||
notification.parentNode.removeNotification(notification, true);
|
||||
// Add a new notification to that tab, with no "Learn more" link
|
||||
|
@ -991,8 +988,7 @@ BrowserGlue.prototype = {
|
|||
var updateUrl = formatter.formatURLPref(PREF_PLUGINS_UPDATEURL);
|
||||
|
||||
var win = this.getMostRecentBrowserWindow();
|
||||
var browser = win.gBrowser;
|
||||
browser.selectedTab = browser.addTab(updateUrl);
|
||||
win.openUILinkIn(updateUrl, "tab");
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1223,7 +1219,7 @@ BrowserGlue.prototype = {
|
|||
formatURLPref("app.support.baseURL");
|
||||
url += helpTopic;
|
||||
|
||||
var browser = this.getMostRecentBrowserWindow().gBrowser;
|
||||
var win = this.getMostRecentBrowserWindow();
|
||||
|
||||
var buttons = [
|
||||
{
|
||||
|
@ -1231,12 +1227,12 @@ BrowserGlue.prototype = {
|
|||
accessKey: accessKey,
|
||||
popup: null,
|
||||
callback: function(aNotificationBar, aButton) {
|
||||
browser.selectedTab = browser.addTab(url);
|
||||
win.openUILinkIn(url, "tab");
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var notifyBox = browser.getNotificationBox();
|
||||
var notifyBox = win.gBrowser.getNotificationBox();
|
||||
var notification = notifyBox.appendNotification(text, title, null,
|
||||
notifyBox.PRIORITY_CRITICAL_MEDIUM,
|
||||
buttons);
|
||||
|
|
Загрузка…
Ссылка в новой задаче