Closed Bug 1521385 Opened 5 years ago Closed 5 years ago

Export ActorChild so it can be imported as symbol

Categories

(Toolkit :: Async Tooling, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: ato, Assigned: ato)

Details

Attachments

(1 file)

Classes are not automatically assigned to the globally exported
symbol, despite being listed in EXPORTED_SYMBOLS.

For example it is currently not possible to extract ActorChild this
way:

const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm", {});
Assignee: nobody → ato
Status: NEW → ASSIGNED
Priority: -- → P1

Example of error message:

JavaScript error: chrome://remote/content/Actor.jsm, line 10: TypeError: class heritage ActorChild is not an object or null

JS classes, unlike var or const, are not automatically made part
of the global scope in JSMs. This makes it impossible to import
ActorChild this way:

const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm", {});

By assigning the ActorChild class to this we work around this problem.

Pushed by atolfsen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4b6549b8a601
toolkit: export ActorChild in global scope; r=Felipe

I don’t expect this is a failure of the patch, but of the hg checkout
on the Android builder. Pushing again.

Flags: needinfo?(ato)
Pushed by dvarga@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2b62559fb02b
toolkit: export ActorChild in global scope; r=Felipe

It seems there was a issue with the instance on witch Android build were running from and the backout wasn't really necessary.

After figuring that out, we grafted and push your patch onto autoland.

Sorry for that.

Flags: needinfo?(ato)
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66

dluca: Thanks for that!

Flags: needinfo?(ato)
You need to log in before you can comment on or make changes to this bug.