Closed Bug 1376558 Opened 7 years ago Closed 7 years ago

Should not migrate session for Firefox auto-refresh

Categories

(Firefox :: Migration, enhancement, P1)

55 Branch
enhancement

Tracking

()

VERIFIED FIXED
Firefox 56
Tracking Status
firefox56 --- fixed

People

(Reporter: Fischer, Assigned: Fischer)

References

Details

(Whiteboard: [photon-onboarding])

Attachments

(2 files)

Based on the 6/20 Photon Onboarding team meeting, we should show first run and don’t restore session (migrate sessionrestore) for Firefox auto-refresh (triggered by the sub-installer not manually chosen and triggered by user)
Assignee: nobody → fliu
Status: NEW → ASSIGNED
Component: Installer → General
Priority: -- → P1
Whiteboard: [photon-onboarding]
Blocks: 1268708
Summary: Should not restore session for Firefox auto-refresh → Should not migrate session for Firefox auto-refresh
Flags: qe-verify+
QA Contact: jwilliams
Target Milestone: --- → Firefox 56
Comment on attachment 8881506 [details]
Bug 1376558 - Should not migrate session for Firefox auto-refresh,

Hi Matt,

From the search results[1][2], the MOZ_RESET_PROFILE_RESTART is set on 
- the safeMode dialog
- the about:support page
- the reset-profile notification
- UITour
to restart Firefox to refresh Firefox.

This patch simply removes the code of unsetting MOZ_RESET_PROFILE_RESTART in nsAppRunner.cpp. So that we could check its existence in FirefoxProfileMigrator.js before migrating session, then unset it.

[1] https://dxr.mozilla.org/mozilla-central/search?q=MOZ_RESET_PROFILE_RESTART&redirect=false
[2] https://dxr.mozilla.org/mozilla-central/search?q=ResetProfile.jsm&redirect=false

Thank you
Attachment #8881506 - Flags: review?(MattN+bmo)
(In reply to Fischer [:Fischer] from comment #3)
> Comment on attachment 8881506 [details]
> Bug 1376558 - Should not migrate session for Firefox auto-refresh,
> 
> Review request updated; see interdiff:
> https://reviewboard.mozilla.org/r/152658/diff/1-2/
Hi Matt,
Updated the patch according to our offline discussion. Use another environment variable to decide if session migration is needed. Thank you.
Attached file windows_test_video
(In reply to Fischer [:Fischer] from comment #5)
> Created attachment 8882618 [details]: windows_test_video
Hi Matt,
Just tested this patch build on Windows. Please see attachment 8882618 [details]: windows_test_video.
In the video, we could see the about:welcomeback page(the old profile session migrated back) if the profile refresh was triggered through the refresh button on the troubleshooting page.
And no about:welcomeback(no old profile session migrated back) if the profile refresh was triggered through command[1] which is the case of the stub-installer.

[1] $ firefox.exe -reset-profile -migration

Thanks
Comment on attachment 8881506 [details]
Bug 1376558 - Should not migrate session for Firefox auto-refresh,

https://reviewboard.mozilla.org/r/152658/#review158876

::: browser/components/migration/FirefoxProfileMigrator.js:144
(Diff revision 2)
>    let dictionary = getFileResource(types.OTHERDATA, ["persdict.dat"]);
>  
> +  let session;
> +  let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
> +  if (env.get("MOZ_OLD_PROFILE_SESSION_MIGRATION")) {
> +    // XXX: Bug 1376558

Remove this line

::: browser/components/migration/FirefoxProfileMigrator.js:147
(Diff revision 2)
> +  let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
> +  if (env.get("MOZ_OLD_PROFILE_SESSION_MIGRATION")) {
> +    // XXX: Bug 1376558
> +    // We only want to restore the previous firefox session if the profile refresh was
> +    // triggered by user. The MOZ_OLD_PROFILE_SESSION_MIGRATION would be set when a user-triggered
> +    // profile refresh happend in nsAppRuner.cpp. Hence, we detec the MOZ_OLD_PROFILE_SESSION_MIGRATION

typo: happened

typo: detect

::: browser/components/migration/FirefoxProfileMigrator.js:147
(Diff revision 2)
> +  let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
> +  if (env.get("MOZ_OLD_PROFILE_SESSION_MIGRATION")) {
> +    // XXX: Bug 1376558
> +    // We only want to restore the previous firefox session if the profile refresh was
> +    // triggered by user. The MOZ_OLD_PROFILE_SESSION_MIGRATION would be set when a user-triggered
> +    // profile refresh happend in nsAppRuner.cpp. Hence, we detec the MOZ_OLD_PROFILE_SESSION_MIGRATION

Typo: nsAppRunner.cpp

::: toolkit/xre/nsAppRunner.cpp:2282
(Diff revision 2)
>  
>    if (EnvHasValue("MOZ_RESET_PROFILE_RESTART")) {
>      gDoProfileReset = true;
>      gDoMigration = true;
>      SaveToEnv("MOZ_RESET_PROFILE_RESTART=");
> +    // XXX: Bug 1376558

Remove this line since I don't think the bug number or XXX is necessary

::: toolkit/xre/nsAppRunner.cpp:2283
(Diff revision 2)
> +    // We only want to restore the previous firefox session if the profile refresh was
> +    // triggered by user. And if it was a user-triggered profile refresh
> +    // through, say, the safeMode dialog or the troubleshooting page, the MOZ_RESET_PROFILE_RESTART
> +    // env variable would be set. Hence we set MOZ_OLD_PROFILE_SESSION_MIGRATION here so that
> +    // Firefox profile migrator would migrate old session data later.

Don't mention the word Firefox in toolkit code

::: toolkit/xre/nsAppRunner.cpp:2288
(Diff revision 2)
> +    // We only want to restore the previous firefox session if the profile refresh was
> +    // triggered by user. And if it was a user-triggered profile refresh
> +    // through, say, the safeMode dialog or the troubleshooting page, the MOZ_RESET_PROFILE_RESTART
> +    // env variable would be set. Hence we set MOZ_OLD_PROFILE_SESSION_MIGRATION here so that
> +    // Firefox profile migrator would migrate old session data later.
> +    SaveToEnv("MOZ_OLD_PROFILE_SESSION_MIGRATION=1");

I think MOZ_RESET_PROFILE_MIGRATE_SESSION is a bit more consistent.
Attachment #8881506 - Flags: review?(MattN+bmo) → review+
Comment on attachment 8881506 [details]
Bug 1376558 - Should not migrate session for Firefox auto-refresh,

https://reviewboard.mozilla.org/r/152658/#review158876

> Remove this line

Thanks updated

> typo: happened
> 
> typo: detect

Thanks updated

> Typo: nsAppRunner.cpp

Thanks updated

> Remove this line since I don't think the bug number or XXX is necessary

Thanks updated

> Don't mention the word Firefox in toolkit code

Thanks updated

> I think MOZ_RESET_PROFILE_MIGRATE_SESSION is a bit more consistent.

Thanks updated
(In reply to Fischer [:Fischer] from comment #9)
> Comment on attachment 8881506 [details]
> Bug 1376558 - Should not migrate session for Firefox auto-refresh,
> 
> Review request updated; see interdiff:
> https://reviewboard.mozilla.org/r/152658/diff/2-3/
TRY looks good: https://treeherder.mozilla.org/#/jobs?repo=try&revision=5889653126bad2bbfea738bf6184ee33d58154dd
Keywords: checkin-needed
Blocks: 1369255
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/54b356661749
Should not migrate session for Firefox auto-refresh, r=MattN
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/54b356661749
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Hi Justin,

Here are the detailed expected behaviors for this bug:

1. Open the Nightly with an new profile
2. Make sure seeing the 1st-run page
3. Browse some websites and bookmark some websites
4. Open about:support in an new tab and click the refresh button to refresh Firefox
5. After restarting from the refresh, make sure seeing the about:welcomeback page
6. Restore the previous session and make sure previously-browsed websites are back
7. Make sure the bookmarked website exist
8. Close Firefox then reopen Firefox
9. Make sure the bookmarked website exist and Firefox runs as usual
10. Close Firefox and open the terminal
11. Launch Firefox with the command [1] or [2] to trigger auto-refresh
12. After Firefox starts up, make sure seeing the 1st-run page (not the about:welcomeback page)
13. Make sure the bookmarked website exist
14. Close Firefox then reopen Firefox
15. Make sure the bookmarked website exist and Firefox runs as usual
16. Done

[1] On Windows: <FOLDER_WHERE_FIREFOX_EXISTS>\firefox.exe -reset-profile -migration
[2] On Linux/Mac: <FOLDER_WHERE_FIREFOX_EXISTS>/firefox --reset-profile --migration

Thanks
Flags: needinfo?(jwilliams)
Depends on: 1381081
Flags: needinfo?(jwilliams)
No longer depends on: 1381081
Component: General → Migration
I have verified this issue is fixed.
Status: RESOLVED → VERIFIED
See Also: → 1403402
You need to log in before you can comment on or make changes to this bug.