Closed
Bug 289933
Opened 20 years ago
Closed 20 years ago
new Script objects are callable but report typeof object instead of function
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.8beta4
People
(Reporter: bc, Assigned: mrbkap)
References
()
Details
(Keywords: fixed1.8)
Attachments
(1 file, 3 obsolete files)
1.21 KB,
patch
|
brendan
:
review+
brendan
:
approval1.8b4+
|
Details | Diff | Splinter Review |
1.7 builds report typeof (new Script()) as 'function', but 1.8 builds report
'object'.
Assignee | ||
Comment 1•20 years ago
|
||
Shaver tells me that Script does implement [[Call]], and so by the table in
11.4.3, typeof should, in fact, be returning "function". The regression is from
bug 246441. Brendan, why was the older version (just checking clasp->call !=
NULL) insufficient? This patch just fixes 'typeof(new Script())'.
Assignee | ||
Updated•20 years ago
|
Assignee: general → mrbkap
Status: NEW → ASSIGNED
Assignee | ||
Updated•20 years ago
|
Attachment #186607 -
Flags: review?(brendan)
Assignee | ||
Updated•20 years ago
|
Target Milestone: --- → mozilla1.8beta3
Assignee | ||
Comment 2•20 years ago
|
||
IE reports |typeof /a/| as "object". I'm not sure if we want to dogmatically
stick to the spec here, or go for an (arguably more intuitive) interpretation
and emulate IE.
Assignee | ||
Comment 3•20 years ago
|
||
patch v1 calls all of: regexps, scripts (in the new Script() sense), and
functions "function".
this patch calls only functions "function". I'll also attach a patch that makes
scripts and functions "function".
Assignee | ||
Comment 4•20 years ago
|
||
This makes regexps "object", script and functions "function".
Assignee | ||
Updated•20 years ago
|
Attachment #186607 -
Flags: review?(brendan)
Assignee | ||
Comment 5•20 years ago
|
||
For the record: I tested IE, Opera, and Safari, and all three browsers report
|typeof /a/| as being "object". Since Script is one of our things, we can do
whatever we want with it, which is why I've attached all 3 versions of the patch.
Assignee | ||
Updated•20 years ago
|
Attachment #186837 -
Flags: review?(brendan)
Comment 7•20 years ago
|
||
Comment on attachment 186837 [details] [diff] [review]
just functions are functions
I'll try to get ECMA TG1 to specify this in a future Edition.
/be
Attachment #186837 -
Flags: review?(brendan)
Attachment #186837 -
Flags: review+
Attachment #186837 -
Flags: approval1.8b4+
Assignee | ||
Comment 8•20 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: mozilla1.8beta3 → mozilla1.8beta4
Comment 10•20 years ago
|
||
Can we please back this out again?
This patch breaks a ton of my sip code (http://www.croczilla.com/zap) which for
one reason or another needs to discriminate between objects and regexps.
I don't know how common this pattern is, but silently changing the behavior
without bumping the JS version is likely to lead to confusion more than anything
else.
Even the checkin comment is confused about what behaviour we now implement:
revision 3.211
date: 2005/07/16 02:03:26; author: mrbkap%gmail.com; state: Exp; lines: +1 -3
bug 289933: make regexps and script objects be of type 'function' to imitate IE.
r+a=brendan
Status: RESOLVED → REOPENED
OS: Windows XP → All
Resolution: FIXED → ---
Assignee | ||
Comment 11•20 years ago
|
||
Yeah, I kind of botched that checkin message. I think backwards compat. with
Firefox 1.0.x might take precedence over compat. with other browsers. Brendan,
this would suggest that RegExp and Script should both be functions. What do you
think?
Assignee | ||
Comment 12•20 years ago
|
||
Attachment #186607 -
Attachment is obsolete: true
Attachment #186837 -
Attachment is obsolete: true
Attachment #186838 -
Attachment is obsolete: true
Attachment #192852 -
Flags: review?(brendan)
Assignee | ||
Updated•20 years ago
|
Status: REOPENED → ASSIGNED
Comment 13•20 years ago
|
||
Comment on attachment 192852 [details] [diff] [review]
functions, script objects, and regular expressions are functions
No need to over-parenthesize the || expression. Also, I'm guessing that dynamic
frequency of function object operand to typeof is higher than other classes, so
transpose the || operands. Finally, how about a comment before the clasp =
OBJ_GET_CLASS(cx, obj) line that starts the block, talking about ECMA [[Call]]
and citing chapter and verse?
Fix those and r+a=me, thanks!
/be
Attachment #192852 -
Flags: review?(brendan)
Attachment #192852 -
Flags: review+
Attachment #192852 -
Flags: approval1.8b4+
Assignee | ||
Comment 14•20 years ago
|
||
Checked into MOZILLA_1_8_BRANCH and trunk. RegExps, Scripts, and functions are
all of type "function" now.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago → 20 years ago
Keywords: fixed1.8
Resolution: --- → FIXED
Comment 15•20 years ago
|
||
FYI, this change broke view source after a form submission. See Bug 305959 for
details.
You need to log in
before you can comment on or make changes to this bug.
Description
•