Closed Bug 1595237 Opened 6 years ago Closed 2 years ago

Auto-closing the Firefox window by closing the last tab triggers Firefox relaunch on Windows Restart

Categories

(Toolkit :: Startup and Profile System, defect, P3)

70 Branch
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: rhythmelody17, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

For Windows 10 x64 machines (I am not sure about other OSes or architecture):
I am currently running Windows 10 x64 on an HP ZBook G3.

  1. Launch Firefox.
  2. Close the Firefox window by clicking the "X" on the last open TAB.
  3. Reboot the machine.

Actual results:

On the OS boot, Firefox will automatically relaunch itself to the last open tab. Apparently, Firefox thinks it has been shut down incorrectly when the Firefox window is closed by clicking the "X" to close the last open tab.

Expected results:

Closing the last tab (resulting in the Firefox window closing) should not trigger a Firefox auto-relaunch on OS boot. Firefox should remain closed until it is launched by the user.

Component: Untriaged → Startup and Profile System
Product: Firefox → Toolkit

I just tried to recreate this bug again, and this time, it did not replicate...

I will continue to nail down the exact steps needed to duplicate the unexpected auto-launch of Firefox.

Note: https://www.ghacks.net/2018/09/18/prevent-firefox-from-reopening-on-windows-10-start/

Maybe check error, or firefox not properly closed yet when you restart the machine.

The priority flag is not set for this bug.
:mossop, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dtownsend)

Adam, any thoughts?

Flags: needinfo?(dtownsend) → needinfo?(agashlin)

I think Yang is right, this would happen if Firefox did not finish shutting down. The Windows restart manager will, to my knowledge, only restart applications that were running when Windows was shutting down. We always register for this (if pref toolkit.winRegisterApplicationRestart is true) but it's up to Windows whether it auto-starts Firefox on boot.

Flags: needinfo?(agashlin)

Ok so sounds like this would be caused by a slow shutdown issue. We would need to understand what is causing that slowness.

The priority flag is not set for this bug.
:mossop, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dtownsend)
Flags: needinfo?(dtownsend)
Priority: -- → P3

Would calling UnregisterApplicationRestart early in shutdown make sense (assuming we know it is from the user and not the OS shutting us down)?

Flags: needinfo?(agashlin)

(In reply to Dave Townsend [:mossop] (he/him) from comment #8)

Would calling UnregisterApplicationRestart early in shutdown make sense (assuming we know it is from the user and not the OS shutting us down)?

Good idea, that should work.

Flags: needinfo?(agashlin)

This happens every time. I just closed the one Firefox window by clicking the X in the title bar (several tabs were open, session restore is active). Then after a few seconds (this is usually enough to quit Firefox), I restarted Windows. After Windows login, Firefox started with the complete session.

My config setting toolkit.winRegisterApplicationRestart is set to false, yet it doesn't work. I've already watched this a few times (I rarely restart Windows).

Thank Yves, it's interesting that toolkit.winRegisterApplicationRestart isn't enough to prevent this. I wonder if something else is launching Firefox, or if the pref isn't working right. Did this start happening only recently? What version of Windows are you running? (running winver is the easiest way to get the precise version)

Please try running this command in PowerShell after Firefox has started automatically:

Get-WmiObject Win32_Process -Filter "name = 'firefox.exe'" | Select-Object CommandLine

This will list the command lines used to start every firefox proces. There should be one that doesn't have "-contentproc" after "firefox.exe" (should be the first), please copy that line here. When this is started by Windows, it will be like "...\firefox.exe" -os-restarted. If there is a URL in there, like "...\firefox.exe" http://example.com, that might indicate that something else is launching the process to view a URL. If neither of those are the case I'm not sure what could be going on...

Flags: needinfo?(_+bugzilla)

I can't say when it started happening because I can never remember when I've restarted Windows the last time. It usually runs very long here. I'm running Windows 10.1709 x64. I know it's long out of support but I don't need that support anyway. I'm going to reinstall the machine with .2004 as soon as all apps are compatible.

I've looked up the command line as you suggested and it seems that this time it was another issue. The command line says:

"C:\Program Files\Mozilla Firefox\firefox.exe" -url https://go.microsoft.com/fwlink/?LinkId=517009

The parent process doesn't exist anymore. It's good to know how to analyse this. I'll keep an eye on it and try to report back when I see something new. Maybe the bug also went away after I've set that config option. As I said, this happens so rarely that I can't remember anymore.

Flags: needinfo?(_+bugzilla)

Ah that's interesting, I've seen that URL on Windows startup as well, usually it's:

"C:\Program Files\Firefox Nightly\firefox.exe" -osint -url https://go.microsoft.com/fwlink/?LinkId=517009

(Your example didn't have -osint, which seems unusual)

I never did figure out why Windows is launching this help site sometimes. There are a several threads on Microsoft's support forums about this URL but no one seems to agree it's a Windows problem.

Severity: normal → S3

D, Yves,
Does this still reproduce for you when using a current version?

Flags: needinfo?(rhythmelody17)
Flags: needinfo?(_+bugzilla)

Haven't seen this happening in a while.

Flags: needinfo?(_+bugzilla)

Thanks for the update

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(rhythmelody17)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.