Closed Bug 892187 Opened 11 years ago Closed 3 years ago

Fix spurious uses of ExclusiveContext->asJSContext()

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bhackett1024, Assigned: bhackett1024)

References

Details

(Whiteboard: [leave open])

Attachments

(2 files)

Attached patch patchSplinter Review
Bug 885758 added a fair number of uses of cx->asJSContext() for ExclusiveContext or ThreadSafeContext.  Some of these calls are not justified and would lead to a null crash if they executed with an ExclusiveContext which is not a JSContext.  The attached patch goes through all these uses and either adds appropriate checks or restructures the code so that the asJSContext() is not necessary.
Attachment #773663 - Flags: review?(wmccloskey)
Attached patch Fix GGC builds.Splinter Review
bhackett, GGC builds are busted on inbound at the moment.  This patch fixes it,
though I'm not sure if it's the right fix w.r.t. the patch you have in this
bug.  Either way, if you could fix GGC builds as part of this bug that would be
helpful.  Thanks.
Assignee: general → n.nethercote
Comment on attachment 774183 [details] [diff] [review]
Fix GGC builds.

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

This looks good, though it's independent from the existing patch in this bug and can land now.  Strange, I did a local ggc build before landing 885758 and it worked...

::: js/src/jsobj.cpp
@@ +2858,5 @@
>                     uint32_t oldCount, uint32_t newCount)
>  {
>  #ifdef JSGC_GENERATIONAL
>      if (cx->isJSContext()) {
> +        return cx->asJSContext()->runtime()-> gcNursery.reallocateElements(cx->asJSContext(), obj, oldHeader,

Can you rm the extra space on this line?
Attachment #774183 - Flags: review+
Assignee: n.nethercote → bhackett1024
https://hg.mozilla.org/integration/mozilla-inbound/rev/ec136828f42a


> Can you rm the extra space on this line?

Ugh, I forgot to do that.  Can you do it in your patch?  Thanks.
Whiteboard: [leave open]
Attachment #773663 - Flags: review?(wmccloskey) → review+
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: