summaryrefslogtreecommitdiff
path: root/libre/iceweasel-libre/Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch
diff options
context:
space:
mode:
Diffstat (limited to 'libre/iceweasel-libre/Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch')
-rw-r--r--libre/iceweasel-libre/Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch287
1 files changed, 287 insertions, 0 deletions
diff --git a/libre/iceweasel-libre/Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch b/libre/iceweasel-libre/Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch
new file mode 100644
index 000000000..82ba01a9c
--- /dev/null
+++ b/libre/iceweasel-libre/Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch
@@ -0,0 +1,287 @@
+From: Mike Hommey <mh@glandium.org>
+Date: Tue, 5 Jun 2012 08:57:06 +0200
+Subject: Bug 756390 - Make the "Reset Firefox" feature more generic
+
+diff --git a/browser/components/migration/content/migration.js b/browser/components/migration/content/migration.js
+index 91c5c1c..2f8bd1a 100644
+--- a/browser/components/migration/content/migration.js
++++ b/browser/components/migration/content/migration.js
+@@ -249,7 +249,7 @@ var MigrationWizard = {
+ }
+
+ var brandBundle = document.getElementById("brandBundle");
+- // These strings don't exist when not using official branding. If that's
++ // These strings may not exist when not using official branding. If that's
+ // the case, just skip this page.
+ try {
+ var pageTitle = brandBundle.getString("homePageMigrationPageTitle");
+@@ -281,8 +281,8 @@ var MigrationWizard = {
+ case "chrome":
+ source = "sourceNameChrome";
+ break;
+- case "firefox":
+- source = "sourceNameFirefox";
++ case "self":
++ source = "brand";
+ break;
+ }
+
+@@ -292,7 +292,12 @@ var MigrationWizard = {
+ var oldHomePageURL = this._migrator.sourceHomePageURL;
+
+ if (oldHomePageURL && source) {
+- var appName = MigrationUtils.getLocalizedString(source);
++ var appName;
++ if (source == "brand") {
++ appName = brandBundle.GetStringFromName("brandFullName");
++ } else {
++ appName = MigrationUtils.getLocalizedString(source);
++ }
+ var oldHomePageLabel =
+ brandBundle.getFormattedString("homePageImport", [appName]);
+ var oldHomePage = document.getElementById("oldHomePage");
+diff --git a/browser/components/migration/content/migration.xul b/browser/components/migration/content/migration.xul
+index f030756..23e37ff 100644
+--- a/browser/components/migration/content/migration.xul
++++ b/browser/components/migration/content/migration.xul
+@@ -42,7 +42,7 @@
+ #elifdef XP_UNIX
+ <radio id="chrome" label="&importFromChrome.label;" accesskey="&importFromChrome.accesskey;"/>
+ #endif
+- <radio id="firefox" label="&importFromFirefox.label;" accesskey="&importFromFirefox.accesskey;"/>
++ <radio id="self" hidden="true"/>
+ <radio id="nothing" label="&importFromNothing.label;" accesskey="&importFromNothing.accesskey;" hidden="true"/>
+ </radiogroup>
+ <label id="noSources" hidden="true">&noMigrationSources.label;</label>
+diff --git a/browser/components/migration/src/BrowserProfileMigrators.manifest b/browser/components/migration/src/BrowserProfileMigrators.manifest
+index d7fec75..d531b83 100644
+--- a/browser/components/migration/src/BrowserProfileMigrators.manifest
++++ b/browser/components/migration/src/BrowserProfileMigrators.manifest
+@@ -3,7 +3,7 @@ contract @mozilla.org/toolkit/profile-migrator;1 {6F8BB968-C14F-4D6F-9733-6C6737
+ component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
+ contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}
+ component {91185366-ba97-4438-acba-48deaca63386} FirefoxProfileMigrator.js
+-contract @mozilla.org/profile/migrator;1?app=browser&type=firefox {91185366-ba97-4438-acba-48deaca63386}
++contract @mozilla.org/profile/migrator;1?app=browser&type=self {91185366-ba97-4438-acba-48deaca63386}
+ #ifdef HAS_IE_MIGRATOR
+ component {3d2532e3-4932-4774-b7ba-968f5899d3a4} IEProfileMigrator.js
+ contract @mozilla.org/profile/migrator;1?app=browser&type=ie {3d2532e3-4932-4774-b7ba-968f5899d3a4}
+diff --git a/browser/components/migration/src/FirefoxProfileMigrator.js b/browser/components/migration/src/FirefoxProfileMigrator.js
+index 3db6720..a3b3dda 100644
+--- a/browser/components/migration/src/FirefoxProfileMigrator.js
++++ b/browser/components/migration/src/FirefoxProfileMigrator.js
+@@ -128,7 +128,7 @@ Object.defineProperty(FirefoxProfileMigrator.prototype, "startupOnlyMigrator", {
+
+
+ FirefoxProfileMigrator.prototype.classDescription = "Firefox Profile Migrator";
+-FirefoxProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=firefox";
++FirefoxProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=self";
+ FirefoxProfileMigrator.prototype.classID = Components.ID("{91185366-ba97-4438-acba-48deaca63386}");
+
+ this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FirefoxProfileMigrator]);
+diff --git a/browser/components/migration/src/MigrationUtils.jsm b/browser/components/migration/src/MigrationUtils.jsm
+index 2c91e9a..08962c4 100644
+--- a/browser/components/migration/src/MigrationUtils.jsm
++++ b/browser/components/migration/src/MigrationUtils.jsm
+@@ -405,12 +405,6 @@ this.MigrationUtils = Object.freeze({
+ * @see nsIStringBundle
+ */
+ getLocalizedString: function MU_getLocalizedString(aKey, aReplacements) {
+- const OVERRIDES = {
+- "4_firefox": "4_firefox_history_and_bookmarks",
+- "64_firefox": "64_firefox_other"
+- };
+- aKey = OVERRIDES[aKey] || aKey;
+-
+ if (aReplacements === undefined)
+ return getMigrationBundle().GetStringFromName(aKey);
+ return getMigrationBundle().formatStringFromName(
+@@ -625,6 +619,17 @@ this.MigrationUtils = Object.freeze({
+ },
+
+ /**
++ * Returns whether a given migration type is supported.
++ *
++ * @param aKey Migrator key
++ * @returns whether the migrator key is supported.
++ */
++ canMigrate:
++ function MU_canMigrate(aMigratorKey) {
++ return "@mozilla.org/profile/migrator;1?app=browser&type=" + aMigratorKey in Cc;
++ },
++
++ /**
+ * Cleans up references to migrators and nsIProfileInstance instances.
+ */
+ finishMigration: function MU_finishMigration() {
+diff --git a/browser/components/migration/src/ProfileMigrator.js b/browser/components/migration/src/ProfileMigrator.js
+index f67823b..36016b8 100644
+--- a/browser/components/migration/src/ProfileMigrator.js
++++ b/browser/components/migration/src/ProfileMigrator.js
+@@ -12,6 +12,7 @@ function ProfileMigrator() {
+
+ ProfileMigrator.prototype = {
+ migrate: MigrationUtils.startupMigration.bind(MigrationUtils),
++ canMigrate: MigrationUtils.canMigrate.bind(MigrationUtils),
+ QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIProfileMigrator]),
+ classDescription: "Profile Migrator",
+ contractID: "@mozilla.org/toolkit/profile-migrator;1",
+diff --git a/browser/locales/en-US/chrome/browser/migration/migration.dtd b/browser/locales/en-US/chrome/browser/migration/migration.dtd
+index 21cf405..f3c1a6b 100644
+--- a/browser/locales/en-US/chrome/browser/migration/migration.dtd
++++ b/browser/locales/en-US/chrome/browser/migration/migration.dtd
+@@ -17,8 +17,6 @@
+ <!ENTITY importFromSafari.accesskey "S">
+ <!ENTITY importFromChrome.label "Chrome">
+ <!ENTITY importFromChrome.accesskey "C">
+-<!ENTITY importFromFirefox.label "Firefox">
+-<!ENTITY importFromFirefox.accesskey "X">
+
+ <!ENTITY noMigrationSources.label "No programs that contain bookmarks, history or password data could be found.">
+
+diff --git a/browser/locales/en-US/chrome/browser/migration/migration.properties b/browser/locales/en-US/chrome/browser/migration/migration.properties
+index 094a9dc..a620905 100644
+--- a/browser/locales/en-US/chrome/browser/migration/migration.properties
++++ b/browser/locales/en-US/chrome/browser/migration/migration.properties
+@@ -24,30 +24,30 @@ importedSafariReadingList=Reading List (From Safari)
+ 2_ie=Cookies
+ 2_safari=Cookies
+ 2_chrome=Cookies
+-2_firefox=Cookies
++2_self=Cookies
+
+ 4_ie=Browsing History
+ 4_safari=Browsing History
+ 4_chrome=Browsing History
+-4_firefox_history_and_bookmarks=Browsing History and Bookmarks
++4_self=Browsing History and Bookmarks
+
+ 8_ie=Saved Form History
+ 8_safari=Saved Form History
+ 8_chrome=Saved Form History
+-8_firefox=Saved Form History
++8_self=Saved Form History
+
+ 16_ie=Saved Passwords
+ 16_safari=Saved Passwords
+ 16_chrome=Saved Passwords
+-16_firefox=Saved Passwords
++16_self=Saved Passwords
+
+-32_ie=Favorites
++32_ie=Favourites
+ 32_safari=Bookmarks
+ 32_chrome=Bookmarks
+
+ 64_ie=Other Data
+ 64_safari=Other Data
+ 64_chrome=Other Data
+-64_firefox_other=Other Data
++64_self=Other Data
+
+-128_firefox=Windows and Tabs
++128_self=Windows and Tabs
+diff --git a/toolkit/content/resetProfile.js b/toolkit/content/resetProfile.js
+index d46b43b..2253994 100644
+--- a/toolkit/content/resetProfile.js
++++ b/toolkit/content/resetProfile.js
+@@ -28,6 +28,58 @@ function onResetProfileLoad() {
+ populateResetPane("migratedItems");
+ }
+
++<<<<<<< HEAD
++=======
++/**
++ * Check if reset is supported for the currently running profile.
++ *
++ * @return boolean whether reset is supported.
++ */
++function resetSupported() {
++ let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].
++ getService(Ci.nsIToolkitProfileService);
++ let currentProfileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
++
++ // Reset is only supported for the default profile if the self-migrator used for reset exists.
++ try {
++ if (currentProfileDir.equals(profileService.selectedProfile.rootDir) &&
++ "@mozilla.org/toolkit/profile-migrator;1" in Cc) {
++ let pm = Cc["@mozilla.org/toolkit/profile-migrator;1"].createInstance(Ci.nsIProfileMigrator);
++ return ("canMigrate" in pm) && pm.canMigrate("self");
++ }
++ } catch (e) {
++ // Catch exception when there is no selected profile.
++ Cu.reportError(e);
++ }
++ return false;
++}
++
++function getMigratedData() {
++ Components.utils.import("resource:///modules/MigrationUtils.jsm");
++
++ // From migration.properties
++ const MIGRATED_TYPES = [
++ 4, // History and Bookmarks
++ 16, // Passwords
++ 8, // Form History
++ 2, // Cookies
++ ];
++
++ // Loop over possible data to migrate to give the user a list of what will be preserved.
++ let dataTypes = [];
++ for (let itemID of MIGRATED_TYPES) {
++ try {
++ let typeName = MigrationUtils.getLocalizedString(itemID + "_self");
++ dataTypes.push(typeName);
++ } catch (x) {
++ // Catch exceptions when the string for a data type doesn't exist.
++ Components.utils.reportError(x);
++ }
++ }
++ return dataTypes;
++}
++
++>>>>>>> Bug 756390 - Make the "Reset Firefox" feature more generic
+ function onResetProfileAccepted() {
+ let retVals = window.arguments[0];
+ retVals.reset = true;
+diff --git a/toolkit/profile/nsIProfileMigrator.idl b/toolkit/profile/nsIProfileMigrator.idl
+index f35c227..7062886 100644
+--- a/toolkit/profile/nsIProfileMigrator.idl
++++ b/toolkit/profile/nsIProfileMigrator.idl
+@@ -37,7 +37,7 @@ interface nsIProfileStartup : nsISupports
+ * @client Toolkit (Startup code)
+ * @obtainable service, contractid("@mozilla.org/toolkit/profile-migrator;1")
+ */
+-[scriptable, uuid(3df284a5-2258-4d46-a664-761ecdc04c22)]
++[scriptable, uuid(96d9ab66-082c-4a9e-82ad-f8c21b391342)]
+ interface nsIProfileMigrator : nsISupports
+ {
+ /**
+@@ -60,6 +60,14 @@ interface nsIProfileMigrator : nsISupports
+ * @note The startup code ignores COM exceptions thrown from this method.
+ */
+ void migrate(in nsIProfileStartup aStartup, in ACString aKey);
++
++ /**
++ * Returns whether a given migration type is supported.
++ *
++ * @param aKey Migrator key
++ * @returns whether the migrator key is supported.
++ */
++ bool canMigrate(in ACString aKey);
+ };
+
+ %{C++
+diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
+index 20a3d6e..87e351d 100644
+--- a/toolkit/xre/nsAppRunner.cpp
++++ b/toolkit/xre/nsAppRunner.cpp
+@@ -3843,7 +3843,7 @@ XREMain::XRE_mainRun()
+ if (gDoProfileReset) {
+ // Automatically migrate from the current application if we just
+ // reset the profile.
+- aKey = MOZ_APP_NAME;
++ aKey = "self";
+ }
+ pm->Migrate(&mDirProvider, aKey);
+ }