Closed
Bug 53037
Opened 25 years ago
Closed 25 years ago
Call object not censored for Array.prototype.sort comparison function
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
M18
People
(Reporter: brendan, Assigned: brendan)
Details
(Keywords: js1.5)
Attachments
(1 file)
640 bytes,
patch
|
Details | Diff | Splinter Review |
Thanks to rogerc@geocast.com for finding this.
var a = [2,1];
function C(m) { this.m=m; this.cmp=function (a,b) {print(this);return a-b}}
var c = new C;
a.sort(c.cmp);
prints [object Call] twice. It should print [object global], I believe (ECMA
buddies, double-check me please).
/be
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → M18
Comment 1•25 years ago
|
||
The spec. doesn't say how the compare function is called other than 'call
comparefn'. I think the implication would have to be that there was an implicit
NULL this, hence the global object as you say. The call object doesn't seem
useful in any case.
Assignee | ||
Comment 2•25 years ago
|
||
The spec does say that activation objects should never be exposed. I think the
patch is a virtual "one-liner". See next attachment, someone give me an r= so
we can get this in for js1.5 and ECMA purity of essence.
/be
Assignee | ||
Comment 3•25 years ago
|
||
Comment 4•25 years ago
|
||
Why was there a check for GetPrivate on thisp?
Assignee | ||
Comment 5•25 years ago
|
||
Norris wrote that code, and IIRC he was trying to hide only those Call objects
representing active JSStackFrames (which are LIFO allocated and which are the
private data of their Call object, if they represent heavyweight function calls,
only while active). But I think ECMA mandates activation censoring everywhere.
/be
Assignee | ||
Comment 6•25 years ago
|
||
r=, anyone?
/be
Comment 7•25 years ago
|
||
ok, i'll buy that
r=rogerl
Assignee | ||
Comment 8•25 years ago
|
||
Fix was checked in on 9/18, but I forgot to close this one. Thanks to
pschwartau for reminding me.
/be
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•