Closed Bug 458098 Opened 16 years ago Closed 16 years ago

js_DumpObject can't handle objects that share proto's scope

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

Attachments

(1 file)

Attached patch fixSplinter Review
Objects with no 'own properties' share their proto's scope; calling js_DumpObject on such an object can crash because the object doesn't have the slots that the scope describes.

With the patch, it'll print "no own properties - see proto".

(trivial) The patch also adds a newline that was missing before.
Attachment #341314 - Flags: review?(crowder)
Attachment #341314 - Flags: review?(crowder) → review+
Comment on attachment 341314 [details] [diff] [review]
fix

>diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp
>+        sharesScope = (proto && scope == OBJ_SCOPE(proto));

Drive-by question: this could also be written as 'sharesScope = scope->obj == obj;' right?
(In reply to comment #1)
> (From update of attachment 341314 [details] [diff] [review])
> >diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp
> >+        sharesScope = (proto && scope == OBJ_SCOPE(proto));
> 
> Drive-by question: this could also be written as 'sharesScope = scope->obj ==
> obj;' right?

That's the faster way (and clearer, maybe) way to test.

/be
I changed that line to say
  sharesScope = (scope->obj != obj);

http://hg.mozilla.org/mozilla-central/rev/765855ec09b0
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Flags: in-litmus-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: