Figuring out the behavior of WindowProxy in the face of non-configurable properties
d at domenic.me
Wed Jan 28 08:51:43 PST 2015
From: Mark S. Miller [mailto:erights at google.com]
> On Tue, Jan 27, 2015 at 5:53 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>> I'd like to understand better the suggestion here, because I'm not sure I'm entirely following it. Specifically, I'd like to understand it in terms of the internal methods defined by <https://github.com/domenic/window-proxy-spec>.
>> Presumably you're proposing that we keep all of that as-is except for [[DefineOwnProperty]], right?
>> For [[DefineOwnProperty]], are we basically talking about changing step 1 to:
>> 1) If the [[Configurable]] field of Desc is present and Desc.[[Configurable]] is false, then throw a TypeError exception.
>> while keeping everything else as-is,
> Exactly correct. I didn't realize until reading your reply is that this is all that's necessary -- that it successfully covers all the cases I was thinking about without any further case division.
I'm having a bit of trouble understanding how this maps to the solution described in your previous message, Mark. Your "I didn't realize until reading your reply is that this is all that's necessary" indicates I'm probably just missing something, so help appreciated.
My question is, what happens if Desc.[[Configurable]] is not present, and P does not already exist on W? By my reading, we then fall through to calling the [[DefineOwnProperty]] internal method of W with arguments P and Desc.
Assuming W's [[DefineOwnProperty]] is that of an ordinary object, I believe that takes us through OrdinaryDefineOwnProperty(W, P, Desc). Since P does not exist on W, and W is extensible, that takes us to ValidateAndApplyPropertyDescriptor(O, P, true, Desc, undefined). Then according to step 2.c, " If the value of an attribute field of Desc is absent, the attribute of the newly created property is set to its default value." The default value is false, right? So won't this try to define a non-configurable property on W?
I would have thought the modification needed to be more like:
[[DefineOwnProperty]] (P, Desc)
1. If desc.[[Configurable]] is not present, set desc.[[Configurable]] to true.
2. If desc.[[Configurable]] is false, then throw a TypeError exception.
3. Return the result of calling the [[DefineOwnProperty]] internal method of W with arguments P and Desc.
(here I have inserted step 1, but step 2 and 3 are unchanged from the previous incarnation).
More information about the es-discuss