
Loading…
Fix for #1017 (and #1001) #1021
Also tested to fix #1019
loadContext.DOMWindowID probably won't work with e10s, so this may be just a temporary fix.
I can't find any documentation that states definitively what is and is not accessible to the content or chrome processes without CPOW. I can say that when I tried accessing it through the console in Nightly with e10s turned on it never gave me a warning, but that's the best I can do until e10s is available on Fennec.
Neither I got a warning, I got undefined instead. However, I tried on the desktop browser, but since those part should be the same, I assumed that this will happen in Fennec too (that's why I said "probably" and "may").
I've got another idea I can take a look at when I next get some time - it's looking like Firefox may not actually provide us with any usable ID, but perhaps we don't need it to. I was thinking that if we set up a weakmap of browser to an incrementing ID we assign ourselves, it can be looked up by just iterating over open tabs and looking up the ID we assigned them from the map. The access pattern is quite a lot of looking up ID from browser, and very little looking up browser from ID, so it shouldn't be too much of a hit.
Wasn't the problem with Fennec, that it made the main_frame request before the tab opened? Because you need the tab to tell if a request is made in a tab, the browser may be ready, but behind-the-scene requests have browser objects too, but they don't have a tab.
Yeah, when the new tab is opened the browser is available but the tab is not yet. So any ID that hangs off the tab object is unusable.
I stand corrected, behind-the-scene requests don't have a browser object (as far as I can tell), so this may work.
I've made some tests, and it seems it will be viable.
While I played with it, I kind of implemented it, so you can test it on this branch.
Great, that's just what I had in mind. I've tested it on Fennec and it appears to be working fine - I'll keep running with it for a while and see if I run into any problems, but otherwise I like this as a solution.
Using
.loadContext.DOMWindowIDas an ID instead oftab.idresolves issues with new tabs in Firefox being seen as behind the scenes. Not re-binding to about:blank during load resolves further issues with opening new tabs from 3rd party intents