Closed
Bug 720760
Opened 13 years ago
Closed 10 years ago
Object.defineProperty get function has incorrect `this`
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: benjamin, Assigned: Waldo)
Details
Attachments
(1 file, 1 obsolete file)
582 bytes,
text/html
|
Details |
I'm filing this bug report from a newsgroup post in mozilla.dev.apps.firefox:
Object.defineProperty(String.prototype, "com_example_bool", {
get : function() {
return (/^(true|1)$/i).test(this);
}
});
alert("true".com_example_bool);
That returns true in Opera, IE9, Chrome Canary and Safari, but returns
false in Firefox (at least latest trunk).
Anyone know why?
A quick investigation shows that in the get() function, uneval(this) gives me:
(new String("")) instead of the "true" string I would expect. I don't think this has anything to do with the regex part of the testcase.
Comment 1•13 years ago
|
||
Comment 2•13 years ago
|
||
Attachment #591181 -
Attachment is obsolete: true
Comment 3•13 years ago
|
||
System doesn't want to set text/html mime type for the attachment, even if I try explicitly.
Updated•13 years ago
|
Attachment #591182 -
Attachment mime type: text/plain → text/html
Assignee | ||
Comment 4•13 years ago
|
||
Yeah, getters and setters on the boxed-type prototypes get a boxed |this| when invoked through property accesses on primitive values. Known, certainly needs fixing. I'll take this and see what I can do for it.
Assignee: general → jwalden+bmo
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Comment 5•10 years ago
|
||
It returns true now in firefox too.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•