Closed Bug 841197 Opened 7 years ago Closed 7 years ago

Upgrading from older nightly that has been set as default browser does not show nightly for metro tile after upgrade

Categories

(Firefox for Metro Graveyard :: General, defect, P2)

x86_64
Windows 8.1
defect

Tracking

(Not tracked)

VERIFIED FIXED
Firefox 21

People

(Reporter: jbecerra, Assigned: bbondy)

References

Details

(Whiteboard: feature=work)

Attachments

(2 files, 1 obsolete file)

If you install an older nightly on Windows 8 and set it up as your default browser at the prompt, and then upgrade to the latest (which supports Firefox for Metro), the nightly tile for Metro does not appear in the Start page.

Resetting all defaults for the program didn't show the Nightly tile.

Installing the latest nightly (pave-over) on top of the version resulting from the upgrade works.
Please bear with me for a few bugs while I get used to the flow.
No longer blocks: 831495, 831497, metrov1it2
No longer depends on: enable-metro, 831590
Whiteboard: feature=story c=Install_and_setup u=browser_user p=8 → feature=defect c=Install_and_setup u=browser_user p=8
Duplicate of this bug: 841203
Assignee: nobody → netzen
Blocks: 831590
Whiteboard: feature=defect c=Install_and_setup u=browser_user p=8 → feature=work
Manual workaround: Go into the desktop Control Panel, Programs, set Default Programs. Select Internet Explorer, and set that as the default. Then restart Firefox, it will ask whether to make itself the default - do that.
Attached patch Patch v1.Splinter Review
This wasn't really triaged, but it's completely apparent that this is an important task so I went ahead with doing this fix now.
Attachment #713939 - Flags: review?(jmathies)
Attachment #713939 - Flags: review?(jmathies) → review+
https://hg.mozilla.org/mozilla-central/rev/2902b3e73b92
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
Kamil would you mind testing this one?
This mostly passes but there is still an issue.
The Nightly Metro browser now works after upgrading but if you don't have the Metro tile in your cache the user won't see the Metro tile until rebooting your computer.  The user can use the Metro browser from the Firefox icon on the start screen though even before the reboot.

To clear your Tile cache:
- Go to the settings charm from the Windows 8 Start Screen and select Tiles and then click the Clear button.
- Delete this folder: C:\ProgramData\PRICache
- Reboot if you previously had Nightly Metro installed

This issue still happens intermittently even if you have no cache, but clearing the tile may help.

System Used:
Windows 8 x86 (Completely Updated) in a VM hosted in Virtual Box

Downloaded the following build:
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2013-02-08-03-10-53-mozilla-central/firefox-21.0a1.en-US.win32.installer.exe

- Installed the above build, selected "Launch Nightly now" and then selected "Finish"
- Once Firefox has launched, selected "Yes" to set Firefox as the default browser
- Selected the "Nighty" icon when prompted by Windows 8 on how to open http links
- Completely closed Firefox and switched to Windows Metro mode
- Selected the Firefox Nightly tile and the application ran in windows mode (in the Desktop)
- Back on Desktop, selected Help -> About Nightly and updated to the latest version of Firefox Nightly (21.0a1 2013-02-15)
- Once the update has been completed, selected "Restart to Update"
- Once Firefox relaunched, closed the application and switched into Windows Metro mode
- Selected the Firefox tile and Firefox opened in Windows Metro mode (**Note: the icon appears the same as before, using the nightly icon)
- Ran Firefox several times in Windows Metro mode and the icon still appeared the same as before (Firefox Nightly icon not Win8 tile)
- Restarted the Windows 8 x86
- Once the machine has been restarted, the Firefox tile has changed to the "Blue Firefox Win 8 Tile"
- Launched Firefox once again using the new icon to ensure that the application still launches in Windows Metro mode without any
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 842039
Let me see if I understand this. You're saying that if a user ignores the restart warning on the Firefox update, that she won't see the Metro tile for Metro Firefox until after a restart? If so, that's expected behavior.
I was able to reproduce what Kamil said. 
The fix I did allows you to launch the metro browser after update, but the icon *sometimes* doesn't update to a metro tile until you physically reboot your machine.  

i.e. after upgrading and restarting the browser, when you go to the start screen you still see a nightly icon instead of a metro Firefox tile.  But if you click it you go into the metro browser.

There's a shell notification call that is documented in the "Developing a Metro style enabled Desktop browser" doc that may help this that I'll try calling after updating.  Unfortunately I can only reproduce what Kamil said about 1 out of 10 times so it'll be hard for me to tell if the change actually does fix it.
You should be able to reproduce this consistently 100% of the time if you use a fresh install that has never had Firefox Metro on it before. Just use a VM and take a snapshot after installing the OS, then revert back to it each time you need to test.
Changes:
- Removed the delete of the start menu tile.  It isn't needed and it causes problems like in bug 842039 (we can close that bug after this lands too)

- Now only set the start menu appusermodel ID on PostUpdate if the browser being updated is the default.  This is for multiple installs we don't want to keep flipping the app user model id for the last browser updated.

- I was able to reproduce the Metro tile not showing until the computer was physically rebooted consistently by using a fresh VM like Kamil suggested. I was hoping for a fix without a Sleep but it just simply won't work without it.  It's like Windows doesn't actually do the appusermodelid change right away.  The RegisterCEH stuff makes the tile refresh but if it's done too close to the appusermodelid change it won't show the tile. I can always reproduce without this patch with a fresh VM and I can always confirm this patch works with a fresh VM showing the tile right away.
Attachment #715497 - Flags: review?(jmathies)
Comment on attachment 715497 [details] [diff] [review]
Patch v1 - Fix for no cache re-creating tile

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

::: browser/installer/windows/nsis/shared.nsh
@@ +190,5 @@
>  !endif
>  
> +  ; If RegisterCEH is called too close to changing the shortcut AppUserModelID
> +  ; and if the tile image is not already in cache.  Then Windows won't refresh
> +  ; the tile image on the start screen.  So wait before calling RegisterCEH.

Are we sure there isn't something here we can just delete from the reg, like we do for the splash?

http://mxr.mozilla.org/mozilla-central/source/browser/installer/windows/nsis/shared.nsh#728

@@ +193,5 @@
> +  ; and if the tile image is not already in cache.  Then Windows won't refresh
> +  ; the tile image on the start screen.  So wait before calling RegisterCEH.
> +!ifdef MOZ_METRO
> +  ${If} ${AtLeastWin8}
> +    Sleep 3000

Does this mean that little progress dialog that sometimes shows up will be visible for at least three seconds?
> Does this mean that little progress dialog that sometimes shows up 
> will be visible for at least three seconds?

No the progress dialog is before this code. This code runs in the background after an update and the user doesn't know. 


> Are we sure there isn't something here we can just delete from the reg, 
> like we do for the splash?

The problems seems to be that the setting of the app user model id doesn't happen right away even know it is called. Then the code that actually does the refresh at the end refreshes the tile fine, but it happens before the appusermodel id is actually set by windows.
The update doesn't wait for this to finish either by the way.
I could add code to make sure it only happens exactly once maybe?
I only do the sleep now if the user doesn't have have a DEH. 
I think this has to do with when the shortcut changes dual mode but I'm not sure exactly. 

I think we should land this and pass it back through testing to see if it works in both cases of i) fresh computer and ii) has had metro on it before to see if it works.  Works for me locally but this changed v2 patch I'm worried about case ii) intermittently.
Attachment #715497 - Attachment is obsolete: true
Attachment #715497 - Flags: review?(jmathies)
Attachment #715550 - Flags: review?(jmathies)
Attachment #715550 - Flags: review?(jmathies) → review+
Using procmon by the way shows that explorer.exe changes nightly.lnk.  So what probably happens is that the COM call passes the work of setting the appusermodelID and dualmode bit to explorer.exe, and then it's a race condition to see if we refresh the icon first or explorer.exe finishes its work first.  The sleep 3000 makes it so explorer.exe will finish first and then the refresh happens after.
https://hg.mozilla.org/mozilla-central/rev/71e84eb9db9f

Kamil you'll have to wait until tomorrow's nightly build is built to test this.
When testing please test both a fresh machine that hasn't had metro firefox on it, and also a machine that has had it on it.

Also if you could verify that bug 842039 no longer happens that would be awesome. Just mark it as Resolved / Works for me if you can no longer reproduce that one.
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → FIXED
Downloaded and installed the following build:
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2013-02-08-03-10-53-mozilla-central/firefox-21.0a1.en-US.win32.installer.exe

Updated to the following build using "Help -> About Nightly": 22.0a1 (2013-02-20)

Works:
- Update fresh computer WITHOUT the maintenance service DOES give a metro tile.

Doesn't work:
- Update fresh computer WITH the maintenance service DOES NOT give a metro tile.

Will create a new bug regarding maintenance service and the metro tile.
marking as verified
Status: RESOLVED → VERIFIED
Depends on: 843248
Interesting about the maintenance service.

helper.exe is run from both the system account and user account with the maintenance service.

So I think what's happening is that there's a file in use error when the user helper.exe process runs and tries to set the appusermodelid on the shortcut.
No longer depends on: 843248
Depends on: 843248
See Also: → 915761
OS: Windows 8 Metro → Windows 8.1
You need to log in before you can comment on or make changes to this bug.