зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1220527 - Wait for the first window before showing the upgraded notifications alert. r=MattN
--HG-- extra : commitid : DDBFmrJtj1O
This commit is contained in:
Родитель
3249757e08
Коммит
759a7eadce
|
@ -647,6 +647,7 @@ BrowserGlue.prototype = {
|
|||
ExtensionManagement.registerScript("chrome://browser/content/ext-bookmarks.js");
|
||||
|
||||
this._flashHangCount = 0;
|
||||
this._firstWindowReady = new Promise(resolve => this._firstWindowLoaded = resolve);
|
||||
},
|
||||
|
||||
// cleanup (called on application shutdown)
|
||||
|
@ -1145,6 +1146,7 @@ BrowserGlue.prototype = {
|
|||
this._checkForOldBuildUpdates();
|
||||
|
||||
this._firstWindowTelemetry(aWindow);
|
||||
this._firstWindowLoaded();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -2213,7 +2215,7 @@ BrowserGlue.prototype = {
|
|||
}
|
||||
|
||||
if (currentUIVersion < 32) {
|
||||
this._notifyNotificationsUpgrade();
|
||||
this._notifyNotificationsUpgrade().catch(Cu.reportError);
|
||||
}
|
||||
|
||||
// Update the migration version.
|
||||
|
@ -2231,10 +2233,11 @@ BrowserGlue.prototype = {
|
|||
return false;
|
||||
},
|
||||
|
||||
_notifyNotificationsUpgrade: function BG__notifyNotificationsUpgrade() {
|
||||
_notifyNotificationsUpgrade: Task.async(function* () {
|
||||
if (!this._hasExistingNotificationPermission()) {
|
||||
return;
|
||||
}
|
||||
yield this._firstWindowReady;
|
||||
function clickCallback(subject, topic, data) {
|
||||
if (topic != "alertclickcallback")
|
||||
return;
|
||||
|
@ -2246,14 +2249,9 @@ BrowserGlue.prototype = {
|
|||
let text = gBrowserBundle.GetStringFromName("webNotifications.upgradeInfo");
|
||||
let url = Services.urlFormatter.formatURLPref("browser.push.warning.migrationURL");
|
||||
|
||||
try {
|
||||
AlertsService.showAlertNotification(imageURL, title, text,
|
||||
true, url, clickCallback);
|
||||
}
|
||||
catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
// ------------------------------
|
||||
// public nsIBrowserGlue members
|
||||
|
|
Загрузка…
Ссылка в новой задаче