What is the state of the extension when the browser does not have any windows?

116 views
Skip to first unread message

Jackie Han

unread,
Oct 25, 2022, 12:58:54 AM10/25/22
to Chromium Extensions
When the user closes the last tab, the browser does not have any windows, and the browser does not completely exit, what is the state of the extension at this time?

Screen Shot 2022-10-25 at 12.52.27.png

From the Chrome task manager and extensions' behavior, I found, all extensions do not exist (killed) and do not work at this time. No MV2/MV3 background process, no browser action, no chrome.idle state, no events, no alarms.

At this time, open a new window, all extensions start like Chrome first launch.

Jackie Han

Stefan Van Damme

unread,
Oct 25, 2022, 2:15:22 AM10/25/22
to Chromium Extensions, Jackie Han
Hi Jackie,

That is a Mac thing/feature (and not Chrome on Windows computer)?

Thanks,
Stefan vd

Jackie Han

unread,
Oct 25, 2022, 8:10:14 AM10/25/22
to Stefan Van Damme, Chromium Extensions
Sorry, I don't have a Windows computer.
On macOS, it is. For example, if the extension uses `chrome.power` to let the computer keep awake, when closing the last tab, it loses this effect.

wOxxOm

unread,
Oct 25, 2022, 10:43:08 AM10/25/22
to Chromium Extensions, Jackie Han, Chromium Extensions, stefa...@gmail.com
You need to add "background" to "permissions" in manifest.json to keep the extension run and react to events in this scenario.

wOxxOm

unread,
Oct 25, 2022, 10:44:32 AM10/25/22
to Chromium Extensions, wOxxOm, Jackie Han, Chromium Extensions, stefa...@gmail.com
And "Continue running background apps when Google Chrome is closed" must be enabled in Chrome's settings. It's on by default unless pre-configured via policies, AFAIK.

Jackie Han

unread,
Oct 25, 2022, 10:59:39 AM10/25/22
to wOxxOm, Chromium Extensions, stefa...@gmail.com
Thanks! It works.
I noticed only one extension added the "background" permission, all extensions background scripts and general websites service worker can live.

There is a document for it.

Jackie Han

unread,
Nov 11, 2022, 11:46:56 PM11/11/22
to wOxxOm, Chromium Extensions, stefa...@gmail.com
After half a month, unfortunately, the "background" permission will be cut off starting with Chrome 109 on macOS.

Jackie Han

unread,
Nov 11, 2022, 11:47:11 PM11/11/22
to wOxxOm, Chromium Extensions, stefa...@gmail.com
Reply all
Reply to author
Forward
0 new messages