Open Bug 1507181 Opened 7 years ago Updated 3 years ago

Make JsPropertyProvider work the same for regular and Worker context

Categories

(DevTools :: Console, enhancement, P3)

65 Branch
enhancement

Tracking

(Not tracked)

People

(Reporter: nchevobbe, Unassigned)

References

Details

We currently _can't have nice things_ in worker context because Parser.jsm relies on ChromeUtils, which is not accessible in Worker context. The potential fixes are: 1. Make ChromeUtils available in worker context 2. Use acorn instead of Parser.jsm in JsPropertyProvider Doing 1. would be nicer because it already has everything we want (as opposed to acorn being a third party library that needs to be updated when there are new JS syntax)

ChromeUtils was made available in worker context in Bug 1533202, which is awesome and might help us here.
Unfortunately, we cant fix this bug yet, because lazyImporter throws in devtools/shared/worker/loader.js#419-421.

I guess it's because ChromeUtils wasn't available, since the function used in "regular" context use it devtools/shared/builtin-modules.js#141-189.

Brian, do you know if there is any other blockers to load jsm files in worker context?

Flags: needinfo?(bhackett1024)

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #1)

Brian, do you know if there is any other blockers to load jsm files in worker context?

Sorry, I don't have enough familiarity with the module loading code to say either way. What API is used to load JSMs on the main thread?

Flags: needinfo?(bhackett1024)

mozJSComponentLoader is the thing that deals with loading JSMs. kmag might have a better sense of what would be needed to use them on workers, but off hand it seems like it would be a fair amount of work, because there's a lot of XPConnect stuff involved.

Flags: needinfo?(kmaglione+bmo)

(In reply to Andrew McCreight [:mccr8] from comment #3)

kmag might have a better sense of what would be needed to use them on workers, but off hand it seems like it would be a fair amount of work, because there's a lot of XPConnect stuff involved.

This is pretty much a non-starter. Just about every part of the component loader relies on having a single instance running on the main thread. We'd need an entirely separate implementation for worker threads, and I'm not even really sure what it would look like.

At that point, it would make more sense to put the work into getting an ES6 module loader working on worker threads, and converting JSMs to ES6-module-like semantics.

Flags: needinfo?(kmaglione+bmo)

Thanks for the info all

Maybe Bug 1568823 will help us here, as we may turn the file into regular js

Depends on: 1568823
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.