W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2015

RE: Figuring out the behavior of WindowProxy in the face of non-configurable properties

From: Domenic Denicola <d@domenic.me>
Date: Wed, 28 Jan 2015 19:08:13 +0000
To: "Mark S. Miller" <erights@google.com>
CC: Boris Zbarsky <bzbarsky@mit.edu>, es-discuss <es-discuss@mozilla.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Domenic Denicola <domenic@domenicdenicola.com>
Message-ID: <CY1PR0501MB13692BBBB7E50A97C8CB4B06DF330@CY1PR0501MB1369.namprd05.prod.outlook.com>
From: Mark S. Miller [mailto:erights@google.com] 

> In this situation, it will try and succeed. This more closely obeys the intent in the original code (e.g., the comment in the jQuery code), since it creates a non-configurable property on the *Window* W. It does not violate any invariant, since all that's observable on the *WindowProxy* (given the rest of your draft spec, which remain unchanged) is a configurable property of the same name.

Ah, I see! So then another non-intuitive (but invariant-preserving) consequence would be:

Object.defineProperty(window, "prop", { value: "foo" });

var propDesc = Object.getOwnPropertyDescriptor(window, "prop");

if (propDesc.configurable) {
  Object.defineProperty(window, "prop", { value: "bar" });

  // this will fail, even though the property is supposedly configurable,
  // since when it forwards from the WindowProxy `window` to the underlying
  // Window object, it the Window's [[DefineOwnProperty]] fails.

Am I getting this right?
Received on Wednesday, 28 January 2015 19:08:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC