Creating new Incognito window "windows.create" returns null, but why?

218 views
Skip to first unread message

Juraj M.

unread,
Jun 1, 2023, 9:41:38 AM6/1/23
to Chromium Extensions
Is this ok?

Screenshot 2023-06-01 153403.png

In Firefox it returns window object.

The Chrome docs says that the returned value is optional, although it doesn't say when:

MDN says the window object is always there:

Oliver Dunk

unread,
Jun 1, 2023, 10:03:09 AM6/1/23
to Juraj M., Chromium Extensions
Hi Juraj,

Looking at the code again, we specifically return an empty value if you create an incognito window but are not using an extension that spans in to incognito profiles: https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:chrome/browser/extensions/api/tabs/tabs_api.cc;l=853

This definitely seems like an inconsistency though and could be an interesting issue to open here: https://github.com/w3c/webextensions
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 on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/45767d29-6910-4709-917a-f44b8c12a7a3n%40chromium.org.

hrg...@gmail.com

unread,
Jun 2, 2023, 1:55:10 AM6/2/23
to Chromium Extensions, Oliver Dunk, Chromium Extensions, Juraj M.
Incognito windows are invisible to an extension without incognito access, therefore chrome.windows.create() must not return a window ID in that case.
Whether to return null or not in that case is debatable, but it must definitely not return the window ID.

Reply all
Reply to author
Forward
0 new messages