This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21929 - named properties object should disallow definition of non-configurable properties
Summary: named properties object should disallow definition of non-configurable proper...
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard: [v1]
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-05 02:31 UTC by Cameron McCormack
Modified: 2013-10-08 07:48 UTC (History)
5 users (show)

See Also:


Attachments

Description Cameron McCormack 2013-05-05 02:31:07 UTC
The named properties object exposes named properties as configurable data properties.  There is no special [[DefineOwnProperty]], so we can still define our own on the object.  [[DefineOwnProperty]] can successfully set an own property on the object, although named properties will still shadow them when you get them.  This allows [[DefineOwnProperty]] to set a non-configurable property, which then can be exposed as configurable if a named property starts existing with the same name later.  This breaks an invariant on [[Configurable]].  We could have [[DefineOwnProperty]] force [[Configurable]] = true, just like [[DefineOwnProperty]] for platform objects implementing interfaces that support named properties.  Or we could disallow expandos on the named properties object.
Comment 1 Cameron McCormack 2013-08-04 07:52:01 UTC
I decided just to disallow expando properties altogether on the named properties object.

http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.xml.diff?r1=1.681;r2=1.682;f=h
http://dev.w3.org/cvsweb/2006/webapi/WebIDL/v1.xml.diff?r1=1.123;r2=1.124;f=h
Comment 2 Boris Zbarsky 2013-08-09 19:10:23 UTC
The [[Delete]] defined in the spec now works for ES5 but not ES6: in ES6 [[Delete]] just returns a boolean indicating success or not and the caller throws or not based on strict mode...
Comment 3 Travis Leithead [MSFT] 2013-10-07 21:07:46 UTC
Is this behavior for [[DefineOwnProperty]], now basically the same as if the named properties object were considered non-extensible? e.g., it seems weird to get this behavior, yet Object.isExtensible() would still say true? If we changed this to simply mark the option (internally) as preventExtensions() would that do the trick?

Of course, it's weird to have own properties magically come and go too, so I'm not sure what's more or less consistent here...?
Comment 4 Tom Van Cutsem 2013-10-08 07:48:40 UTC
(In reply to Travis Leithead [MSFT] from comment #3)
> Is this behavior for [[DefineOwnProperty]], now basically the same as if the
> named properties object were considered non-extensible?

No, an object marked non-extensible cannot acquire new own properties (whether via [[DefineOwnProperty]] or via some external means). That's what it means to be non-extensible.

I believe Cameron's fix of simply making [[DefineOwnProperty]] reject any updates is fine in terms of ES6 invariants. This could be self-hosted as a proxy that just returns 'false' from its defineOwnProperty trap.