Export ActorChild so it can be imported as symbol

RESOLVED FIXED in Firefox 66

Status

()

enhancement
P1
normal
RESOLVED FIXED
7 months ago
7 months ago

People

(Reporter: ato, Assigned: ato)

Tracking

unspecified
mozilla66
Points:
---

Firefox Tracking Flags

(firefox66 fixed)

Details

Attachments

(1 attachment)

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: 7 months 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.