Backed out changeset 2612892f2785 (bug 1361286) for typos in its strings. r=backout

This commit is contained in:
Sebastian Hengst 2017-05-27 10:27:02 +02:00
Родитель cf1d58517f
Коммит b01db289d2
9 изменённых файлов: 45 добавлений и 97 удалений

Просмотреть файл

@ -1585,7 +1585,6 @@ pref("browser.migrate.automigrate.enabled", false);
// hidden the 4th day, so it will actually be shown on 3 different days.
pref("browser.migrate.automigrate.daysToOfferUndo", 4);
pref("browser.migrate.automigrate.ui.enabled", true);
pref("browser.migrate.automigrate.inpage.ui.enabled", false);
// See comments in bug 1340115 on how we got to these numbers.
pref("browser.migrate.chrome.history.limit", 2000);

Просмотреть файл

@ -251,6 +251,10 @@ var gPage = {
onPageVisibleAndLoaded() {
// Maybe tell the user they can undo an initial automigration
sendAsyncMessage("NewTab:MaybeShowMigrateMessage");
this.maybeShowAutoMigrationUndoNotification();
},
maybeShowAutoMigrationUndoNotification() {
sendAsyncMessage("NewTab:MaybeShowAutoMigrationUndoNotification");
},
};

Просмотреть файл

@ -160,7 +160,7 @@ var AboutHomeListener = {
addEventListener("click", this, true);
addEventListener("pagehide", this, true);
sendAsyncMessage("AboutHome:MaybeShowMigrateMessage");
sendAsyncMessage("AboutHome:MaybeShowAutoMigrationUndoNotification");
sendAsyncMessage("AboutHome:RequestUpdate");
},

Просмотреть файл

@ -11,8 +11,6 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
const kAutoMigrateEnabledPref = "browser.migrate.automigrate.enabled";
const kUndoUIEnabledPref = "browser.migrate.automigrate.ui.enabled";
const kInPageUIEnabledPref = "browser.migrate.automigrate.inpage.ui.enabled";
const kAutoMigrateBrowserPref = "browser.migrate.automigrate.browser";
const kAutoMigrateImportedItemIds = "browser.migrate.automigrate.imported-items";
@ -28,7 +26,6 @@ Cu.import("resource:///modules/MigrationUtils.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
"resource://gre/modules/AsyncShutdown.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
@ -317,75 +314,54 @@ const AutoMigrate = {
},
/**
* Decide if we need to show [the user] a prompt indicating we automatically
* imported their data.
* Show the user a notification bar indicating we automatically imported
* their data and offering them the possibility of removing it.
* @param target (xul:browser)
* The browser in which we should show the notification.
* @returns {Boolean} return true when need to show the prompt.
*/
async shouldShowMigratePrompt(target) {
async maybeShowUndoNotification(target) {
if (!(await this.canUndo())) {
return false;
return;
}
// The tab might have navigated since we requested the undo state:
let canUndoFromThisPage = ["about:home", "about:newtab"].includes(target.currentURI.spec);
if (!canUndoFromThisPage ||
!Preferences.get(kUndoUIEnabledPref, false)) {
return false;
return;
}
let win = target.ownerGlobal;
let notificationBox = win.gBrowser.getNotificationBox(target);
if (!notificationBox || notificationBox.getNotificationWithValue(kNotificationId)) {
return;
}
// At this stage we're committed to show the prompt - unless we shouldn't,
// in which case we remove the undo prefs (which will cause canUndo() to
// return false from now on.):
if (this.isMigratePromptExpired()) {
if (!this.shouldStillShowUndoPrompt()) {
this._purgeUndoState(this.UNDO_REMOVED_REASON_OFFER_EXPIRED);
this._removeNotificationBars();
return false;
return;
}
let remainingDays = Preferences.get(kAutoMigrateDaysToOfferUndoPref, 0);
Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_UNDO_OFFERED").add(4 - remainingDays);
return true;
},
/**
* Return the message that denotes the user data is migrated from the other browser.
* @returns {String} imported message with the brand and the browser name
*/
getUndoMigrationMessage() {
let browserName = this.getBrowserUsedForMigration();
if (!browserName) {
browserName = MigrationUtils.getLocalizedString("automigration.undo.unknownbrowser");
}
const kMessageId = "automigration.undo.message2." +
const kMessageId = "automigration.undo.message." +
Preferences.get(kAutoMigrateImportedItemIds, "all");
const kBrandShortName = gBrandBundle.GetStringFromName("brandShortName");
return MigrationUtils.getLocalizedString(kMessageId,
[kBrandShortName, browserName]);
},
let message = MigrationUtils.getLocalizedString(kMessageId,
[browserName, kBrandShortName]);
/**
* Show the user a notification bar indicating we automatically imported
* their data and offering them the possibility of removing it.
* @param target (xul:browser)
* The browser in which we should show the notification.
*/
showUndoNotificationBar(target) {
let isInPage = Preferences.get(kInPageUIEnabledPref, false);
let win = target.ownerGlobal;
let notificationBox = win.gBrowser.getNotificationBox(target);
if (isInPage || !notificationBox || notificationBox.getNotificationWithValue(kNotificationId)) {
return;
}
let message = this.getUndoMigrationMessage();
let buttons = [
{
label: MigrationUtils.getLocalizedString("automigration.undo.keep2.label"),
accessKey: MigrationUtils.getLocalizedString("automigration.undo.keep2.accesskey"),
callback: () => {
this.keepAutoMigration();
this._purgeUndoState(this.UNDO_REMOVED_REASON_OFFER_REJECTED);
this._removeNotificationBars();
},
},
@ -393,21 +369,19 @@ const AutoMigrate = {
label: MigrationUtils.getLocalizedString("automigration.undo.dontkeep2.label"),
accessKey: MigrationUtils.getLocalizedString("automigration.undo.dontkeep2.accesskey"),
callback: () => {
this.undoAutoMigration(win);
this._maybeOpenUndoSurveyTab(win);
this.undo();
},
},
];
notificationBox.appendNotification(
message, kNotificationId, null, notificationBox.PRIORITY_INFO_HIGH, buttons
);
let remainingDays = Preferences.get(kAutoMigrateDaysToOfferUndoPref, 0);
Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_UNDO_OFFERED").add(4 - remainingDays);
},
/**
* Return true if we have shown the prompt to user several days.
* (defined in kAutoMigrateDaysToOfferUndoPref)
*/
isMigratePromptExpired() {
shouldStillShowUndoPrompt() {
let today = new Date();
// Round down to midnight:
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
@ -422,10 +396,10 @@ const AutoMigrate = {
Preferences.set(kAutoMigrateDaysToOfferUndoPref, remainingDays);
Preferences.set(kAutoMigrateLastUndoPromptDateMsPref, today.valueOf().toString());
if (remainingDays <= 0) {
return true;
return false;
}
}
return false;
return true;
},
UNDO_REMOVED_REASON_UNDO_USED: 0,
@ -682,22 +656,6 @@ const AutoMigrate = {
QueryInterface: XPCOMUtils.generateQI(
[Ci.nsIObserver, Ci.nsINavBookmarkObserver, Ci.nsISupportsWeakReference]
),
/**
* Undo action called by the UndoNotification or by the newtab
* @param chromeWindow A reference to the window in which to open a link.
*/
undoAutoMigration(chromeWindow) {
this._maybeOpenUndoSurveyTab(chromeWindow);
this.undo();
},
/**
* Keep the automigration result and not prompt anymore
*/
keepAutoMigration() {
this._purgeUndoState(this.UNDO_REMOVED_REASON_OFFER_REJECTED);
},
};
AutoMigrate.init();

Просмотреть файл

@ -1110,7 +1110,6 @@ this.MigrationUtils = Object.freeze({
MIGRATION_ENTRYPOINT_FXREFRESH: 2,
MIGRATION_ENTRYPOINT_PLACES: 3,
MIGRATION_ENTRYPOINT_PASSWORDS: 4,
MIGRATION_ENTRYPOINT_NEWTAB: 5,
_sourceNameToIdMapping: {
"nothing": 1,

Просмотреть файл

@ -149,7 +149,7 @@ const listeners = {
},
mm: {
"AboutHome:MaybeShowMigrateMessage": ["AboutHome"],
"AboutHome:MaybeShowAutoMigrationUndoNotification": ["AboutHome"],
"AboutHome:RequestUpdate": ["AboutHome"],
"Content:Click": ["ContentClick"],
"ContentSearch": ["ContentSearch"],

Просмотреть файл

@ -72,14 +72,14 @@ importedEdgeReadingList=Reading List (From Edge)
128_firefox=Windows and Tabs
# Automigration undo notification.
# %1$S will be replaced with brandShortName, %2$S will be replaced with the name of the browser we imported from
automigration.undo.message2.all = Dive right into %1$S! Import your favorate sites, bookmarks, history and passwords from %2$S.
automigration.undo.message2.bookmarks = Dive right into %1$S! Import your favorate sites and bookmarks from %2$S.
automigration.undo.message2.bookmarks.logins = Dive right into %1$S! Import your favorate sites, bookmarks and passwords from %2$S.
automigration.undo.message2.bookmarks.visits = Dive right into %1$S! Import your favorate sites, bookmarks and history from %2$S.
automigration.undo.message2.logins = Dive right into %1$S! Import your passwords from %2$S.
automigration.undo.message2.logins.visits = Dive right into %1$S! Import your favorate sites, history and passwords from %2$S.
automigration.undo.message2.visits = Dive right into %1$S! Import your favorate sites and history from %2$S.
# %1$S will be replaced with the name of the browser we imported from, %2$S will be replaced with brandShortName
automigration.undo.message.all = Pick up where you left off. Weve imported these sites and your bookmarks, history and passwords from %1$S into %2$S.
automigration.undo.message.bookmarks = Pick up where you left off. Weve imported these sites and your bookmarks from %1$S into %2$S.
automigration.undo.message.bookmarks.logins = Pick up where you left off. Weve imported these sites and your bookmarks and passwords from %1$S into %2$S.
automigration.undo.message.bookmarks.visits = Pick up where you left off. Weve imported these sites and your bookmarks and history from %1$S into %2$S.
automigration.undo.message.logins = Pick up where you left off. Weve imported your passwords from %1$S into %2$S.
automigration.undo.message.logins.visits = Pick up where you left off. Weve imported these sites and your history and passwords from %1$S into %2$S.
automigration.undo.message.visits = Pick up where you left off. Weve imported these sites and your history from %1$S into %2$S.
automigration.undo.keep2.label = OK, Got it
automigration.undo.keep2.accesskey = O
automigration.undo.dontkeep2.label = No Thanks

Просмотреть файл

@ -10,8 +10,8 @@ var Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "AboutHomeUtils", "AboutHome" ];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
@ -149,12 +149,8 @@ var AboutHome = {
this.sendAboutHomeData(aMessage.target);
break;
case "AboutHome:MaybeShowMigrateMessage":
AutoMigrate.shouldShowMigratePrompt(aMessage.target).then((prompt) => {
if (prompt) {
AutoMigrate.showUndoNotificationBar(aMessage.target);
}
});
case "AboutHome:MaybeShowAutoMigrationUndoNotification":
AutoMigrate.maybeShowUndoNotification(aMessage.target);
break;
}
},

Просмотреть файл

@ -32,16 +32,8 @@ var AboutNewTab = {
}
this.pageListener = new RemotePages("about:newtab");
this.pageListener.addMessageListener("NewTab:Customize", this.customize.bind(this));
this.pageListener.addMessageListener("NewTab:MaybeShowMigrateMessage",
this.maybeShowMigrateMessage.bind(this));
},
maybeShowMigrateMessage({ target }) {
AutoMigrate.shouldShowMigratePrompt(target.browser).then((prompt) => {
if (prompt) {
AutoMigrate.showUndoNotificationBar(target.browser);
}
});
this.pageListener.addMessageListener("NewTab:MaybeShowAutoMigrationUndoNotification",
(msg) => AutoMigrate.maybeShowUndoNotification(msg.target.browser));
},
customize(message) {