Although Android doesn’t have windows and Firefox for Android is currently missing the whole browser.windows API (actually whole namespace is not there), the windowId
is there when you get work with tabs.
I was expecting all tabs are opened in the same “default” window, but it looks like they are all a separate windows:
This has some interesting consequences, for example these two wont work as expected:
await browser.tabs.query({lastFocusedWindow: true});
await browser.tabs.query({currentWindow: true});
EDIT:
So, apart from the bad consequences, this has also some advantages!
Since “tabs === windows”, you can write a polyfill for the missing browser.windows
API using the browser.tabs
API!
For example like this:
(I’m missing event handlers, but those could be added too!)