Closed Bug 1167468 Opened 9 years ago Closed 9 years ago

Assert that JSCompartment::objectMetadataTable never holds wrappers

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: jimb, Assigned: jimb)

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Attachment #8609111 - Flags: review?(nfitzgerald)
Comment on attachment 8609111 [details] [diff] [review]
Assert that JSObjects and their metadata are always in the same compartment.

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

Awesome, thanks!

::: js/src/jscompartment.cpp
@@ +724,3 @@
>  
>      if (JSObject* metadata = objectMetadataCallback(cx, obj)) {
> +        MOZ_ASSERT(this == metadata->compartment());

Is there a reason why we aren't using assertSameCompartment for these checks (and the existing one)? When should I prefer one over the other?
Attachment #8609111 - Flags: review?(nfitzgerald) → review+
Assignee: nobody → jimb
(In reply to Nick Fitzgerald [:fitzgen][:nf] from comment #2)
> Is there a reason why we aren't using assertSameCompartment for these checks
> (and the existing one)? When should I prefer one over the other?

I was just blindly imitating what I saw around me; assertSameCompartment is almost certainly better. I've changed the patch.
That last try push was a total mess for extraneous reasons, so here's another attempt:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=46dc3f9580a0

I've also added an assertion that DebuggerObject_getAllocationSite never retrieves a wrapper; I think we'd agreed to do that on IRC originally.
Status: NEW → ASSIGNED
Flags: in-testsuite-
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: