Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorendorff/9536085 to your computer and use it in GitHub Desktop.
Save jorendorff/9536085 to your computer and use it in GitHub Desktop.

How it's written:

2. If O supports named properties, O does not implement an interface with the [Global] or [PrimaryGlobal] extended attribute and P is not an unforgeable property name of O, then:

    1. Let creating be true if P is not a supported property name, and false otherwise.
    2. If O implements an interface with the [OverrideBuiltins] extended attribute or O does not have an own property named P, then:
        1. If creating is false and O does not implement an interface with a named property setter, then Reject.
        2. If creating is false or O implements an interface with a named property creator, then:
            1. If the result of calling IsDataDescriptor(Desc) is false, then Reject.
            2. Let operation be the operation used to declare the named property creator if creating is true, or the named property setter if creating is false.
            3. Let T be the type of the second argument of operation.
            4. Let value be the result of converting Desc.[[Value]] to an IDL value of type T.
            5. If operation was defined without an identifier, then:
                1. If creating is true, then perform the steps listed in the interface description to set the value of a new named property with P as the name and value as the value.
                2. Otherwise, creating is false. Perform the steps listed in the interface description to set the value of an existing named property with P as the name and value as the value.
            6. Otherwise, operation was defined with an identifier. Perform the steps listed in the description of operation with index and value as the two argument values.
            7. Return true.

3. If O does not implement an interface with the [Global] or [PrimaryGlobal] extended attribute, then set Desc.[[Configurable]] to true.

I would like the "gauntlet" in step 2 to be written as a separate procedure, for sanity's sake:

  1. If O does not support named properties, return false.
  2. If O implements an interface with the [Global] or [PrimaryGlobal] extended attribute, return false.
  3. If P is an unforgeable property name of O, return false.
  4. If O does not implement any interface with the [OverrideBuiltins] extended attribute and O has an own property named P, return false.
  5. If P is a supported property name of O, then:
    1. If O does not implement an interface with a named property setter, Reject.
  6. Else:
    1. If O does not implement an interface with a named property creator, return false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment