Closed
Bug 840400
Opened 11 years ago
Closed 11 years ago
Add an IsObject(v) method to self-hosted Utilities.js
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: Waldo, Assigned: Waldo)
References
Details
Attachments
(1 file, 1 obsolete file)
2.61 KB,
patch
|
mozillabugs
:
review+
|
Details | Diff | Splinter Review |
Checking whether a value is an object is non-trivial on multiple levels. And judging by even a subset of the patches in bug 769872, that test is going to end up being performed in a lot of places, even if many are assertions. Abstractions to the rescue!
Attachment #712764 -
Flags: review?(mozillabugs)
Comment 1•11 years ago
|
||
Comment on attachment 712764 [details] [diff] [review] Patch Review of attachment 712764 [details] [diff] [review]: ----------------------------------------------------------------- Good idea. ::: js/src/builtin/Utilities.js @@ +107,4 @@ > } > > > +/********** Abstract operations defined in ECMAScript Language Specification **********/ You mean "Common operations not defined..."? @@ +109,5 @@ > > +/********** Abstract operations defined in ECMAScript Language Specification **********/ > + > + > +/* Spec: ECMAScript Language Specification, 5.1 edition, 8.12.6 and 11.8.7 */ These sections don't say anything relevant to IsObject. 11.4.3 is relevant, but part of the behavior depends on a non-standard SpiderMonkey extension. @@ +114,5 @@ > +function IsObject(v) { > + // Watch out for |typeof null === "object"| as the most obvious pitfall. > + // But also be careful of SpiderMonkey's objects that emulate undefined > + // (i.e. |document.all|), which have bogus |typeof| behavior. Detect > + // these objects using strict equality, which said bogosity doesn't affect. There's some loss of information compared to my previous comment, but maybe that's OK.
Attachment #712764 -
Flags: review?(mozillabugs) → review-
Assignee | ||
Comment 2•11 years ago
|
||
Oops, I should have updated the comments when I copy-pasted from earlier.
Attachment #712764 -
Attachment is obsolete: true
Attachment #713529 -
Flags: review?(mozillabugs)
Updated•11 years ago
|
Attachment #713529 -
Flags: review?(mozillabugs) → review+
Assignee | ||
Comment 3•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/6be86adf9bf2
Target Milestone: --- → mozilla21
Comment 4•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6be86adf9bf2
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•