Can someone explain the new "frozen" property?

181 views
Skip to first unread message

Juraj M.

unread,
Feb 22, 2025, 10:19:05 AM2/22/25
to Chromium Extensions
I'm reading there is now this new "frozen" boolean flag:

Whether the tab is frozen. A frozen tab cannot execute tasks, including event handlers or timers. It is visible in the tab strip and its content is loaded in memory. It is unfrozen on activation.

It looks and sounds like the "discarded":

Whether the tab is discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content is reloaded the next time it is activated.

But I'm a bit puzzled about it's purpose and how it affects extensions:
1. is this some new browser feature to save power? Or what's the motivation?
2. how is frozen tab created?
3. are discarded tabs also frozen?
4. does this include unfocused extension tabs? If yes, is there some trick to keep them unfrozen?
5. what happens if I call "executeScript" on a frozen tab?

kg_17

unread,
Feb 22, 2025, 11:18:45 AM2/22/25
to Chromium Extensions, Juraj M.
Frozen tabs are different than discarded tabs in that they are still loaded and may use the same amount of memory.  Its just that their CPU activity will be frozen or much reduced.
 
You can use the chrome://discards page to get a good idea how they work.  In Chrome, tabs often freeze after a tab group is collapsed.  They may unfreeze when the tab group expands.  

Unloaded or discarded tabs can't be frozen.  Frozen tabs can't be created.  Extension tabs can be frozen.  Execute script on frozen tab probably hangs ( https://issues.chromium.org/issues/40901394 ).  

Note that Edge has the sleeping tabs feature which is somewhat equivalent to Chromes memory saver feature.  Instead of discarding tabs, Edge puts them to sleep (frozen property is true).  I believe Edges frozen tabs are a little more aggressive then Chromes, and may reduce memory.  I haven't looked at them in a while, though...

Juraj M.

unread,
Feb 22, 2025, 12:47:34 PM2/22/25
to Chromium Extensions, kg_17, Juraj M.
Thanks!
The "chrome://discards/" is pretty informative!
And it looks like I'll have to update some of my code now.

Oh, I really hate that tabs.query fails when there is unsupported property:
TypeError: Error in invocation of tabs.query(object queryInfo, function callback): Error at parameter 'queryInfo': Unexpected property: 'frozen'.
(when running in older Chrome or in Firefox)

Oliver Dunk

unread,
Feb 24, 2025, 5:15:01 AM2/24/25
to Juraj M., Chromium Extensions, kg_17
Oh, I really hate that tabs.query fails when there is unsupported property.

Is there behavior that you would prefer? I agree that it is slightly convoluted to handle, but the alternatives (returning nothing, or ignoring the condition) both seem like they might lead to unexpected behavior.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/472aaceb-e5ee-4b4e-b5af-e63ab4194685n%40chromium.org.

Juraj M.

unread,
Feb 24, 2025, 5:28:16 AM2/24/25
to Chromium Extensions, Oliver Dunk, Chromium Extensions, kg_17, Juraj M.
I've actually tried to wrote a proposal:
But it's not great.
Maybe the best solution would be if all browsers implemented as much properties as possible, even if they don't support the specific flag.

Oliver Dunk

unread,
Feb 24, 2025, 5:33:38 AM2/24/25
to Juraj M., Chromium Extensions, kg_17
That's great - thank you so much for opening it.

I expect we will discuss it in more detail at the meeting this week.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

Reply all
Reply to author
Forward
0 new messages