Closed Bug 809666 Opened 9 years ago Closed 9 years ago

Cu.import("resource:///modules/ctypes.jsm").ctypes is undefined when jsloader.reuseGlobal = true

Categories

(Core :: js-ctypes, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: philikon, Assigned: khuey)

References

Details

Attachments

(1 file)

In B2G, we have set jsloader.reuseGlobal = true which means all JSMs are executed in a function scope using a shared global (see bug 798491). In this scenario, Cu.import()ing ctypes.jsm no longer exports the 'ctypes' symbol. Cu.import("resource:///modules/ctypes.jsm").ctypes is undefined. I suspect this is because the initializer [1] that scribbles the 'ctypes' object into the JSM scope explicitly gets the global, not the function scope. Maybe the helper proposed in bug 807845 could help here?


[1] https://mxr.mozilla.org/mozilla-central/source/toolkit/components/ctypes/ctypes.jsm#21
[2] https://mxr.mozilla.org/mozilla-central/source/toolkit/components/ctypes/ctypes.cpp#121
We have to make the same changes to toolkit/components/perf too.
Duplicate of this bug: 809717
Assignee: nobody → khuey
Nom'ing for basecampl. This blocks running the RIL xpcshell tests (they are not enabled yet on the infra, but developers are encouraged to run them to hunt down regressions.)
blocking-basecamp: --- → ?
blocking-basecamp: ? → +
Attachment #680707 - Flags: review?(mrbkap) → review+
https://hg.mozilla.org/mozilla-central/rev/aea9de89b9f1
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Unfortunately, this fails to build on Aurora. Backed out.
https://hg.mozilla.org/releases/mozilla-aurora/rev/133dfa6f8039

https://tbpl.mozilla.org/php/getParsedLog.php?id=17009985&tree=Mozilla-Aurora

ctypes.cpp

e:/builds/moz2_slave/m-aurora-w32/build/toolkit/components/ctypes/ctypes.cpp(126) : error C2039: 'Get' : is not a member of 'mozJSComponentLoader'

        e:\builds\moz2_slave\m-aurora-w32\build\js\xpconnect\loader\mozJSComponentLoader.h(37) : see declaration of 'mozJSComponentLoader'

e:/builds/moz2_slave/m-aurora-w32/build/toolkit/components/ctypes/ctypes.cpp(126) : error C3861: 'Get': identifier not found

e:/builds/moz2_slave/m-aurora-w32/build/toolkit/components/ctypes/ctypes.cpp(127) : error C2039: 'FindTargetObject' : is not a member of 'mozJSComponentLoader'

        e:\builds\moz2_slave\m-aurora-w32\build\js\xpconnect\loader\mozJSComponentLoader.h(37) : see declaration of 'mozJSComponentLoader'
+  bool reusingGlobal = Preferences::GetBool("jsloader.reuseGlobal");
Where is this variable used?
Depends on: 825467
(In reply to Masatoshi Kimura [:emk] from comment #11)
> +  bool reusingGlobal = Preferences::GetBool("jsloader.reuseGlobal");
> Where is this variable used?

(It's not. I filed bug 825467 w/ a patch to drop it.)
You need to log in before you can comment on or make changes to this bug.