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: Mark S. Miller <erights@google.com>
Date: Wed, 28 Jan 2015 10:57:29 -0800
Message-ID: <CABHxS9iORG3EFJ4TBckZWUDBc5upXHDhGhK1PoGEh-ZXs_WCeg@mail.gmail.com>
To: Domenic Denicola <d@domenic.me>
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>
On Wed, Jan 28, 2015 at 8:51 AM, Domenic Denicola <d@domenic.me> wrote:

> From: Mark S. Miller [mailto:erights@google.com]
>
> > On Tue, Jan 27, 2015 at 5:53 PM, Boris Zbarsky <bzbarsky@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?
>

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.




>
> 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).
>



-- 
    Cheers,
    --MarkM
Received on Wednesday, 28 January 2015 18:57:56 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 28 January 2015 18:57:57 UTC