Closed
Bug 787262
Opened 13 years ago
Closed 10 years ago
re-defineProperty on Window fails when enumerable unspecified
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: felix8a, Unassigned)
Details
(Whiteboard: [js:p2])
Attachments
(1 file)
|
431 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0
Build ID: 20120821170930
Steps to reproduce:
<script>
Object.defineProperty(window, 'x', {configurable: false, enumerable: true});
try {
Object.defineProperty(window, 'x', {}); // fails
} catch (e) { console.log(e); }
var o = {};
Object.defineProperty(o, 'x', {configurable: false, enumerable: true});
try {
Object.defineProperty(o, 'x', {}); // works
} catch (e) { console.log(e); }
</script>
Actual results:
The console shows that
Object.defineProperty(window, 'x', {});
fails with "TypeError: can't redefine non-configurable property 'x'", but
Object.defineProperty(o, 'x', {});
succeeds.
Expected results:
Both defineProperty calls should succeed. Ecma-262 5th edition, section 8.12.9, when the new property descriptor lacks a value for enumerable, it doesn't matter what the current enumerable value is, because it won't be modified.
Attachment #657075 -
Attachment mime type: text/plain → text/html
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Comment 1•13 years ago
|
||
I wonder whether this has to do with Window being a proxy...
Summary: re-defineProperty fails when enumerable unspecified → re-defineProperty on Window fails when enumerable unspecified
Comment 2•13 years ago
|
||
Seems likely.
Updated•13 years ago
|
Whiteboard: [js:p2]
| Assignee | ||
Updated•11 years ago
|
Assignee: general → nobody
Comment 3•10 years ago
|
||
What is the status of this?
Comment 5•10 years ago
|
||
I think this bug was fixed a while ago. -> RESO WORKSFORME.
Recently we deliberately broke the first line of the example, the setup line:
Object.defineProperty(window, 'x', {configurable: false, enumerable: true});
TypeError: Not allowed to define a non-configurable property on the WindowProxy object
The combination of ES6 object invariants and age-old window object behavior implies this TypeError. ES6 says non-configurable properties can't go away; but all of a window object's properties go away when the window navigates.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
Updated•10 years ago
|
Flags: needinfo?(efaustbmo)
You need to log in
before you can comment on or make changes to this bug.
Description
•