Closed Bug 1054976 Opened 10 years ago Closed 9 years ago

Simplify compartment entering in WorkerRunnable::Run

Categories

(Core :: DOM: Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bobowen, Unassigned)

References

Details

A follow-up to bug 1050795, to look at simplifying the compartment entering in WorkerRunnable::Run. See bug 1050795 for further details,
Note that bug 1248737 adds more documentation and asserts around this stuff. In particular, quoting what I think are the relevant parts of bug 1050795.... > I'd think you could add: > > MOZ_ASSERT_IF(globalObject, > js::GetGlobalForObjectCrossCompartment(WorkerPrivate->GetWrapper()) == > globalObject->GetGlobalJSObject()); As noted in the patch for bug 1248737, you can't, because mWorkerPrivate->GetWrapper() can be null at this point. You can only assert this if mWorkerPrivate->GetWrapper() is non-null. And then you can only do it if !targetIsWorkerThread. > which only happens if globalObject is null, which only happens in the targetIsWorkerThread case This is not true either: globalObject is null if we're !targetIsWorkerThread but are a dedicated worker started from a JSM or some other non-window context. So the upshot is that we may or may not have a GetWrapper(), and we may or may not have a globalObject. We may even be lacking both (and the only saving grace there is that the relevant runnables can't run script so don't care that our cx is in the null compartment). We _may_ be able to still simplify something here, but it's not entirely obvious what that something is. :(
We can call this done now, right?
Flags: needinfo?(bzbarsky)
I don't see an obvious way to simplify it, at least...
Flags: needinfo?(bzbarsky)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.