Closed
Bug 577750
Opened 15 years ago
Closed 15 years ago
Get rid of weird checks in js_ComputeGlobalThis
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mrbkap, Assigned: mrbkap)
References
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
|
4.64 KB,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
Currently, ComputeGlobalThis has:
if (JSVAL_IS_PRIMITIVE(argv[-2]) || !JSVAL_TO_OBJECT(argv[-2])->getParent()) {
inner = cx->globalObject;
I don't know how this is possible, though. In global code, we don't have an argv (and we compute this eagerly there anyway) and I don't know why argv[-2] being a global object means we shouldn't use it, but I don't think we should have to support that anyway. In the interests of simplifying this code, we should just be more strict about what we accept/don't accept.
| Assignee | ||
Comment 1•15 years ago
|
||
This makes it so that you can't have a callable global object (and adds a couple other assertions).
Comment 2•15 years ago
|
||
Very cool. BTW, ECMA-262 stipulates that the global object has neither [[Call]] nor [[Construct]] internal methods.
/be
Comment 3•15 years ago
|
||
Comment on attachment 456621 [details] [diff] [review]
patch
> JS_SetParent(JSContext *cx, JSObject *obj, JSObject *parent)
> {
> CHECK_REQUEST(cx);
>+ JS_ASSERT(parent);
Please make this JS_ASSERT(parent || !obj->getParent()) just for compatibility.
> JS_NewGlobalObject(JSContext *cx, JSClass *clasp)
> {
> CHECK_REQUEST(cx);
> JS_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL);
>+ JS_ASSERT(!clasp->call);
We don't think this constraint is really necessary, do we? Let's drop it.
Much better! r=me.
Attachment #456621 -
Flags: review?(jorendorff) → review+
| Assignee | ||
Comment 4•15 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/4d411039d112
http://hg.mozilla.org/tracemonkey/rev/22502cfcd084 <-- fixes vim-o (deleted the wrong branch in the conditional the first time around).
| Assignee | ||
Updated•15 years ago
|
Whiteboard: fixed-in-tracemonkey
Comment 5•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•