Open Bug 756390 Opened 12 years ago Updated 2 years ago

"Reset Firefox" doesn't show up for rebranding and ff-on-xr

Categories

(Firefox :: Migration, defect)

13 Branch
defect

Tracking

()

People

(Reporter: glandium, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

"Reset Firefox" relies on MOZ_APP_NAME and MOZ_BUILD_APP to build the string used to find the profile migrator component. This comes with several drawbacks:
- When building Firefox as a xulrunner application, both are set to xulrunner when building toolkit, and about:support then searches the @mozilla.org/profile/migrator;1?app=xulrunner&type=xulrunner contract.
- When building Firefox without the Firefox branding (think Iceweasel, Icecat, and many others), MOZ_APP_NAME is usually not "firefox". This means searching a contract that is not @mozilla.org/profile/migrator;1?app=browser&type=firefox.

I think an easy way out would be to use prefs instead of hardcoding the values at build time, or extend nsIXULAppInfo to contain this information. Gavin, any preference?
Another possibility, which I think I like better:
- change the "firefox" profile migrator key to be "$MOZ_APP_NAME"
- add a bool canMigrate(in ACString aKey) to nsIProfileMigrator
- instead of checking if @mozilla.org/profile/migrator;1?app=browser&type=firefox is in Components.classes, we could ask the profile migrator if it canMigrate(Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).name.toLowerCase())
- instead of building the migration.properties bundle url from MOZ_BUILD_APP, start from the browser.chromeURL pref.
(In reply to Mike Hommey [:glandium] from comment #1)
> - instead of building the migration.properties bundle url from
> MOZ_BUILD_APP, start from the browser.chromeURL pref.

For the record, there is also the toolkit.defaultChromeURI pref, which, interestingly, browser/ doesn't set (but b2g and mobile do). That's the pref xulrunner apps are expected to set.
Comment on attachment 629706 [details] [diff] [review]
(PoC) Make the "Reset Firefox" feature more generic

This is a proof of concept.
Attachment #629706 - Flags: feedback?(gavin.sharp)
Attachment #629706 - Flags: feedback?(gavin.sharp) → feedback?(mnoorenberghe+bmo)
Matthew (MattN), when do you think you can take a look to this?
Comment on attachment 629706 [details] [diff] [review]
(PoC) Make the "Reset Firefox" feature more generic

Review of attachment 629706 [details] [diff] [review]:
-----------------------------------------------------------------

I think we should wait for bug 718280 to land since it will simplify this code a bit.

The reason I used MOZ_APP_NAME was because I thought a fork might have different toolkit components to migrate and would want their own self-migrator implementation which wouldn't conflict with Firefox's.  If there is more benefit to assume all builds of browser/ want to migrate the same data then this approach makes sense. f+ in that case for the overall approach changing Firefox/MOZ_APP_NAME references to "self". I'll want to take another look after taking the deCOM into account.

::: browser/components/migration/src/FirefoxProfileMigrator.js
@@ +92,1 @@
>  FirefoxProfileMigrator.prototype.classID = Components.ID("{91185366-ba97-4438-acba-48deaca63386}");

This is going away in bug 718280.

::: browser/components/migration/src/MigrationUtils.jsm
@@ +585,5 @@
> +   * @returns whether the migrator key is supported.
> +   */
> +  canMigrate:
> +  function MU_canMigrate(aMigratorKey) {
> +    return "@mozilla.org/profile/migrator;1?app=browser&type=" + aMigratorKey in Cc;

We should have MigrationUtils.resetSupported check getMigrator("self") instead (once bug 718280 lands). Then we don't need this helper.

::: toolkit/content/resetProfile.js
@@ +40,5 @@
>    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");

This is changing in bug 718280.
Attachment #629706 - Flags: feedback?(mnoorenberghe+bmo) → feedback+
Assignee: mh+mozilla → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: