Closed Bug 1514153 Opened 6 years ago Closed 5 years ago

Loader global check in Cu.permitCPOWsInScope is broken

Categories

(Core :: XPConnect, enhancement, P3)

enhancement

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jandem, Unassigned)

References

Details

We assert !mozJSComponentLoader::Get()->IsLoaderGlobal(scopeObj), but callers typically pass |this| and that's the JSM environment or something in the shared JSM global. We have a few modules like Task.jsm that call Cu.permitCPOWsInScope(this). Comments suggest we can probably remove at least some of these calls now, I'll see how far I get with that.
Also maybe we can make this use xpc::CrashIfNotInAutomation().
(In reply to Jan de Mooij [:jandem] from comment #1) > Also maybe we can make this use xpc::CrashIfNotInAutomation(). Oh evilpie already did something similar in the actual CPOW code in bug 1465911, by making it throw, so it seems the risk of this bug causing issues currently is pretty small.
Depends on: 1514195
Priority: -- → P3
(In reply to Jan de Mooij [:jandem] from comment #0) > We assert !mozJSComponentLoader::Get()->IsLoaderGlobal(scopeObj), but > callers typically pass |this| and that's the JSM environment or something in > the shared JSM global. The JSMs that call this should all be whitelisted to run in their own globals: https://searchfox.org/mozilla-central/rev/49e78df13e7a505827a3a86daae9efdf827133c6/js/xpconnect/loader/mozJSComponentLoader.cpp#626-632 So they shouldn't be running in the shared JSM global. > We have a few modules like Task.jsm that call Cu.permitCPOWsInScope(this). > Comments suggest we can probably remove at least some of these calls now, > I'll see how far I get with that. Task.jsm is basically dead at this point, except for some odd references from test code and Android.
(To be clear, I agree this check is broken, and that we need to remove calls in places like Task.jsm and Promise-backend.js.)

Gijs removed this method in bug 1620226.

Status: NEW → RESOLVED
Closed: 5 years ago
Depends on: 1620226
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.