Closed Bug 787262 Opened 13 years ago Closed 10 years ago

re-defineProperty on Window fails when enumerable unspecified

Categories

(Core :: JavaScript Engine, defect)

15 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: felix8a, Unassigned)

Details

(Whiteboard: [js:p2])

Attachments

(1 file)

Attached file example.html
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
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
Seems likely.
Whiteboard: [js:p2]
Assignee: general → nobody
What is the status of this?
Eric, do you have time to take a look at this?
Flags: needinfo?(efaustbmo)
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
Flags: needinfo?(efaustbmo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: