From ffb727d2321e85a1e340815237da41e3cc28e9d2 Mon Sep 17 00:00:00 2001 From: Nicholas Rishel Date: Thu, 16 May 2024 00:42:53 +0000 Subject: [PATCH] Bug 1896030 - Don't open new window on `-os-autostart` if the application has already started. r=nalexander,firefox-desktop-core-reviewers Differential Revision: https://phabricator.services.mozilla.com/D210253 --- browser/components/BrowserContentHandler.sys.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/browser/components/BrowserContentHandler.sys.mjs b/browser/components/BrowserContentHandler.sys.mjs index 6c156d170069..f5d215f0d077 100644 --- a/browser/components/BrowserContentHandler.sys.mjs +++ b/browser/components/BrowserContentHandler.sys.mjs @@ -1130,6 +1130,14 @@ nsDefaultCommandLineHandler.prototype = { var urilist = []; var principalList = []; + if ( + cmdLine.state != Ci.nsICommandLine.STATE_INITIAL_LAUNCH && + cmdLine.findFlag("os-autostart", true) != -1 + ) { + // Relaunching after reboot (or quickly opening the application on reboot) and launch-on-login interact. If we see an after reboot command line while already running, ignore it. + return; + } + if (AppConstants.platform == "win") { // Windows itself does disk I/O when the notification service is // initialized, so make sure that is lazy.