Closed Bug 1415317 Opened 8 years ago Closed 8 years ago

Accessing WebExtension API in Web Workers

Categories

(WebExtensions :: Untriaged, enhancement)

58 Branch
enhancement
Not set
normal

Tracking

(firefox57 wontfix)

RESOLVED WONTFIX
Tracking Status
firefox57 --- wontfix

People

(Reporter: kicsy87, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20171107122447 Steps to reproduce: Hey, I hope this is the right place to bring this up. Right now, the browser namespace for the WebExtension API is not present in a Worker's scope. For some use cases, it would be nice to run some more intensive queries in a background thread, so it does not make the page unresponsive - like issuing continous history.search() queries while the user is typing. Is there some policy or technological limitation on this? Would adding the API to the WindowOrWorkerGlobalScope context be possible?
You can use your background page to achieve this, the message-passing flow would be almost identical to what you want with web workers. Unless I'm missing something (or you have a more specific use case) this will probably be a WONTFIX.
Flags: needinfo?(kicsy87)
Specifically, this is on a New Tab page, and it appears that tasks running in the background page are still blocking. I assumed the background page and other "priviliged scripts" are running on the same thread as they can access the background page's scope via runtime.getBackgroundPage().
Flags: needinfo?(kicsy87)
Well, most API calls are async, and most of the implementation is in the parent process anyway, which would either be in the same process as your extension code (in which case it might still compete with your New Tab page), or with OOP extensions, will always be in a different process from your code, and is unlikely to affect it. Can you test on Windows, or switch the `extensions.webextensions.remote` pref to true on Linux/OSX to see if this helps with the responsiveness?
Indeed, enabling OOP with the switch helps, and it did feel snappier when I tested on Windows earlier. That solves the use case then, I assume this will be rolled out as the default some time in the future. Thanks for your help and the fast response!
Is this now resolved?
Yeah, I was waiting for someone to chime in with something i missed. It's hard to come up with a situation where this would matter in OOP extensions, so closing.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
(In reply to Peter Kiss from comment #4) > I assume this will be rolled out as the default some time in the future. Yes, this is the goal.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.