1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
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 0e8ccf5..fa46c08 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 4bcc1d9..c4db956 100644
--- a/browser/components/migration/content/migration.xul
+++ b/browser/components/migration/content/migration.xul
@@ -74,7 +74,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 527771f..782b38f 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}
component {3d2532e3-4932-4774-b7ba-968f5899d3a4} IEProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=ie {3d2532e3-4932-4774-b7ba-968f5899d3a4}
component {4b609ecf-60b2-4655-9df4-dc149e474da1} SafariProfileMigrator.js
diff --git a/browser/components/migration/src/FirefoxProfileMigrator.js b/browser/components/migration/src/FirefoxProfileMigrator.js
index 8f14f49..8dc175d 100644
--- a/browser/components/migration/src/FirefoxProfileMigrator.js
+++ b/browser/components/migration/src/FirefoxProfileMigrator.js
@@ -88,7 +88,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}");
const NSGetFactory = XPCOMUtils.generateNSGetFactory([FirefoxProfileMigrator]);
diff --git a/browser/components/migration/src/MigrationUtils.jsm b/browser/components/migration/src/MigrationUtils.jsm
index 9460e6d..8db6827 100644
--- a/browser/components/migration/src/MigrationUtils.jsm
+++ b/browser/components/migration/src/MigrationUtils.jsm
@@ -403,11 +403,6 @@ let MigrationUtils = Object.freeze({
* @see nsIStringBundle
*/
getLocalizedString: function MU_getLocalizedString(aKey, aReplacements) {
- const OVERRIDES = {
- "4_firefox": "4_firefox_history_and_bookmarks"
- };
- aKey = OVERRIDES[aKey] || aKey;
-
if (aReplacements === undefined)
return getMigrationBundle().GetStringFromName(aKey);
return getMigrationBundle().formatStringFromName(
@@ -622,6 +617,17 @@ let 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 744f117..59e5a4c 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 0b4b776..ce26fbd 100644
--- a/browser/locales/en-US/chrome/browser/migration/migration.dtd
+++ b/browser/locales/en-US/chrome/browser/migration/migration.dtd
@@ -13,8 +13,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 f522a66..be26460 100644
--- a/browser/locales/en-US/chrome/browser/migration/migration.properties
+++ b/browser/locales/en-US/chrome/browser/migration/migration.properties
@@ -4,7 +4,6 @@ profileName_format=%S %S
sourceNameIE=Internet Explorer
sourceNameSafari=Safari
sourceNameChrome=Google Chrome
-sourceNameFirefox=Mozilla Firefox
importedBookmarksFolder=From %S
@@ -18,29 +17,29 @@ 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_safari=Bookmarks
32_chrome=Bookmarks
-32_firefox=Bookmarks
+32_self=Bookmarks
64_ie=Other Data
64_safari=Other Data
64_chrome=Other Data
-64_firefox=Bookmarks Backups
+64_self=Bookmarks Backups
diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js
index 957d4d8..1af3629 100644
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -616,13 +616,13 @@ function populateResetBox() {
.getService(Ci.nsIToolkitProfileService);
let currentProfileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
-#expand const MOZ_APP_NAME = "__MOZ_APP_NAME__";
-#expand const MOZ_BUILD_APP = "__MOZ_BUILD_APP__";
-
// Only show the reset box for the default profile if the self-migrator used for reset exists.
try {
if (!currentProfileDir.equals(profileService.selectedProfile.rootDir) ||
- !("@mozilla.org/profile/migrator;1?app=" + MOZ_BUILD_APP + "&type=" + MOZ_APP_NAME in Cc))
+ !("@mozilla.org/toolkit/profile-migrator;1" in Cc))
+ return;
+ let pm = Cc["@mozilla.org/toolkit/profile-migrator;1"].createInstance(Ci.nsIProfileMigrator);
+ if (!("canMigrate" in pm) || !pm.canMigrate("self"))
return;
document.getElementById("reset-box").style.visibility = "visible";
} catch (e) {
diff --git a/toolkit/content/resetProfile.js b/toolkit/content/resetProfile.js
index 84de6cd..3126da6 100644
--- a/toolkit/content/resetProfile.js
+++ b/toolkit/content/resetProfile.js
@@ -6,6 +6,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
// based on onImportItemsPageShow from migration.js
function onResetProfileLoad() {
+<<<<<<< HEAD
#expand const MOZ_BUILD_APP = "__MOZ_BUILD_APP__";
#expand const MOZ_APP_NAME = "__MOZ_APP_NAME__";
@@ -16,16 +17,22 @@ function onResetProfileLoad() {
"8_" + MOZ_APP_NAME, // Form History
"2_" + MOZ_APP_NAME, // Cookies
];
+=======
+ Components.utils.import("resource:///modules/MigrationUtils.jsm");
+ const MAX_MIGRATED_TYPES = 16;
+>>>>>>> Bug 756390 - Make the "Reset Firefox" feature more generic
var migratedItems = document.getElementById("migratedItems");
- var bundle = Services.strings.createBundle("chrome://" + MOZ_BUILD_APP +
- "/locale/migration/migration.properties");
// Loop over possible data to migrate to give the user a list of what will be preserved.
for (var itemStringName of MIGRATED_TYPES) {
try {
var checkbox = document.createElement("label");
+<<<<<<< HEAD
checkbox.setAttribute("value", bundle.GetStringFromName(itemStringName));
+=======
+ checkbox.setAttribute("value", MigrationUtils.getLocalizedString(itemID + "_self"));
+>>>>>>> Bug 756390 - Make the "Reset Firefox" feature more generic
migratedItems.appendChild(checkbox);
} catch (x) {
// Catch exceptions when the string for a data type doesn't exist.
diff --git a/toolkit/profile/nsIProfileMigrator.idl b/toolkit/profile/nsIProfileMigrator.idl
index e941336..5b264af 100644
--- a/toolkit/profile/nsIProfileMigrator.idl
+++ b/toolkit/profile/nsIProfileMigrator.idl
@@ -69,7 +69,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
{
/**
@@ -92,6 +92,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 d2db0e2..45a4b0d 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3642,7 +3642,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);
// Set the new profile as the default after migration.
rv = SetCurrentProfileAsDefault(mProfileSvc, mProfD);
|