Skip to content

Stage 2.7 review #17

Description

@nicolo-ribaudo

HasPropertyWhichCouldRunUserCode

  • In step 4, it should then default to returning false.
  • (minor) I would prefer to call this PropertyAccessCouldRunUserCode

I have a larger concern about how this AO assumes a lot abuot the object that is passed to it, without actually requiring anything from its callers.

  • Is this AO meant to be safe to call without triggering user code, or is it expected that it could run user code in order to tell if a future access would run user code? (I assume the answer is "yes"?)
  • The note says that that AO relies on the fact that ordinary [[GetPrototypeOf]] never runs user code, but the AO itself does not check that the object is an ordinary object.

I think we should also add a check along the lines of:

  • If o's [[GetPrototypeOf]] is not one of the internal [[GetPrototypeOf]] methods defined in sections 1.a.i, 3.c.ii, ..., then
    • If o's [[GetPrototypeOf]] is not defined by this specification, return a host-defined Boolean.
    • Return true.

And similar for [[GetOwnProperty]], if we rely on that being side-effect free. For example, the [[GetOwnProperty]] as extended by https://tc39.es/proposal-defer-import-eval/ can run user code.

That list might get hard to maintain, so we might also decide to instead mark whether a [[GetPrototypeOf]]/[[GetOwnProperty]] internal method can trigger side effects or not in the method definition itself. I'm curious to hear what the other @tc39/ecma262-editors think about this.

RequiresDeferredPromiseResolution

  • Nit: nest this inside SafePromiseResolve.

PerformPromiseResolution

  • Nit: I would find it clearer if called was renamed to thenTiming or thenCallTiming.
  • Most of the errors generated by this AO are reported by rejecting promise, but the error step 8.a re-returns a potential throw completion instead. Is it intentional? Or should you handle that completion by potentially rejecting the promise too?

CreateResolvingFunctions

  • (depending on the changes to PerformPromiseResolution) It does not return a completion record, so you cannot do call PerformPromiseResolution with ?. You need to handle its completion and properly reject the promise, as the old CreateResolvingFunctions does.

SafePromiseResolve

  • In step 3, onFulfilled and onRejected are unused.
  • Nit: Remove the acknowledgement of Justin from the note :) We have <emu-note type="editor"> for notes that are just meant as editorial comments about the proposal itself and not to actually be considered as part of the spec text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions