Closed Bug 735126 Opened 8 years ago Closed 8 years ago

NS_ERROR_FAILURE from GetSelectedProfile if second profile added after non-default


(Toolkit :: Startup and Profile System, defect)

Not set



Tracking Status
firefox13 + verified


(Reporter: MattN, Assigned: MattN)




(Whiteboard: [qa!])


(1 file)

Reported by kilara1988 on mozillaZine:

I asked for details through a PM which I'm paraphrasing here:

1.go to about:support rest profile button
3.warning window shows up telling me what will be kept and that everything else will be wiped.
4.confirm the reset.
5.nightly restarts into the new profile
6.nothing from the list of kept items is saved/migrated.

Error console output:
Timestamp: 12.3.2012 г. 15:41:59 ч.
Error: Error detecting Firefox profiles: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIToolkitProfileService.selectedProfile]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource:///components/FirefoxProfileMigrator.js :: <TOP_LEVEL> :: line 414" data: no]
Source File: resource:///components/FirefoxProfileMigrator.js
Line: 423

Timestamp: 12.3.2012 г. 15:41:59 ч.
Error: Invalid migrator key specified or source does not exist.
Source File: resource:///components/ProfileMigrator.js
Line: 29

Expected result:
migrator window appears after step 5 and data is migrated. If the user is not in the default profile, the reset option should not appear in about:support.

Actual result:
Reset button appeared in about:support but the migrator could not get the default profile.

Reproducible: Always (for this user on Windows 7 Home Premium SP1 x64)

"I forgot to also mention that my current and only profile is not the nightly default profile(the one you get when first installing nightly).I made this profile some time ago and gave it a Default User(i think it was a default name btw) and deleted the other profile.I don't know if this could be the problem,but i thought i should mention this.Also i use mozbackup to backup and restore my profile.I haven't used it after the Reset Profile feature landed so i don't know if it is related to the problem."


Name=Default User
Path=Profiles/7wntuaj1.Default User

(I assume this is after the user deleted the newly created "reset" profile).
Btw i do get the Default=1 line at the end of the data about the migrated profile in the profile.ini file,but i still don't get anything migrated.
I tried to uninstall my nightly and make clean installation with clean profile but still no dice.I get the same errors in the console.
GetSelectedProfile was returning NS_ERROR_FAILURE from the Firefox profile migrator using MOZ_RESET_PROFILE_RESTART when a user didn't have any profiles set as their default (Default=1) in profiles.ini.  This means that mChosen is NULL at the end of init.  Then ResetProfile creates a new profile but the call to GetSelectedProfile returned NS_ERROR_FAILURE since mChosen is still NULL and we no longer hit the condition for when there is only one profile.  This patch handles the one profile case at the end of Init.

1) Should I remove the one profile check from GetSelectedProfile?  I don't think it'll hurt to leave it.
2) Another solution would be to change GetSelectedProfile to default to mFirst even if there is more than one profile. (remove |&& !mFirst->mNext|). I think this is more error prone compared to the attached patch.
Attachment #605634 - Flags: review?(benjamin)
Requesting tracking-firefox13 because this causes the profile reset feature to not migrate any data since the profile migrator only supports migrating from the default profile NS_ERROR_FAILURE is returned when trying to check if the current profile is the default.  This will affect all users using the profile reset feature that don't have more than one profile and haven't use the profile manager.
Component: General → Startup and Profile System
OS: Windows 7 → All
Product: Firefox → Toolkit
QA Contact: general → startup
Summary: NS_ERROR_FAILURE from nsIToolkitProfileService.selectedProfile running migrator for profile reset → NS_ERROR_FAILURE from GetSelectedProfile if second profile added after non-default
Version: unspecified → Trunk
Attachment #605634 - Flags: review?(benjamin) → review+
Comment on attachment 605634 [details] [diff] [review]
v.1 Set mChosen at the end of Init

[Approval Request Comment]
Regression caused by (bug #): bug 717070 made this become a problem
User impact if declined: Reset profile feature won't migrate any data if the user has the default profiles.ini with only one profile. (Almost all of our users)
Testing completed (on m-c, etc.): m-c
Risk to taking this patch (and alternatives if risky): Low risk, just sets the chosen profile after reading profiles.ini rather than just at first access.
String changes made by this patch: None
Attachment #605634 - Flags: approval-mozilla-aurora?
Comment on attachment 605634 [details] [diff] [review]
v.1 Set mChosen at the end of Init

[Triage Comment]
Approved for Aurora 13 in support of a new feature.
Attachment #605634 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Closed: 8 years ago
Resolution: --- → FIXED
The reporter from the post in the URL field and comment 1 confirmed that this was fixed with today's nightly.
Verified as fixed on:
Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20120318 Firefox/13.0a2
Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120319 Firefox/13.0a2
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120318 Firefox/13.0a2

The Reset option is displayed and it works as expected.
Whiteboard: [qa!]
You need to log in before you can comment on or make changes to this bug.