Don't save JSContext in nsSameProcessAsyncMessageBase

RESOLVED FIXED in Firefox 56

Status

()

enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: billm, Assigned: billm)

Tracking

unspecified
mozilla56
Points:
---

Firefox Tracking Flags

(firefox56 fixed)

Details

Attachments

(1 attachment)

Posted patch patchSplinter Review
Saving a JSContext in nsSameProcessAsyncMessageBase causes problems for Quantum DOM. A message (with CPOWs) might be received on a different cooperative thread than the one it was sent, which involves a different context. We should look up the JSContext in TLS instead (via AutoJSAPI). This patch does that.
Attachment #8875553 - Flags: review?(continuation)
Comment on attachment 8875553 [details] [diff] [review]
patch

Review of attachment 8875553 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/nsFrameMessageManager.cpp
@@ +2068,5 @@
>    MOZ_ASSERT(mCalledInit);
>    if (aManager) {
> +    AutoJSAPI jsapi;
> +    jsapi.Init();
> +    SameProcessCpowHolder cpows(jsapi.cx(), mCpows);

Can you just call dom::RootingCx() here? Do we really need a fully set up AutoJSAPI?
Attachment #8875553 - Flags: review?(continuation) → review+
Pushed by wmccloskey@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/207b0675c786
Stop saving JSContext in nsSameProcessAsyncMessageBase (r=mccr8)
https://hg.mozilla.org/mozilla-central/rev/207b0675c786
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.