Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Implement in two browsers #14

Closed
8 of 12 tasks
ljharb opened this issue Feb 2, 2016 · 18 comments
Closed
8 of 12 tasks

Implement in two browsers #14

ljharb opened this issue Feb 2, 2016 · 18 comments

Comments

@ljharb
Copy link
Member

ljharb commented Feb 2, 2016

In order to progress to stage 4, this proposal must be implemented in two stable browsers, not behind any flags.

Implemented:

  • Firefox / SpiderMonkey [bug]
  • Chrome / V8 [patch]
  • Safari + Webkit / JavaScriptCore [patch]
  • Edge / Chakra [issue / PR]

At least behind a flag:

  • Firefox / SpiderMonkey
  • Chrome / V8
  • Safari + Webkit / JavaScriptCore
  • Edge / Chakra

Shipped stable:

  • Firefox / SpiderMonkey
  • Chrome / V8
  • Safari + Webkit / JavaScriptCore
  • Edge / Chakra
@ljharb ljharb mentioned this issue Feb 2, 2016
13 tasks
@WebReflection
Copy link
Collaborator

I think the Chromium patch covers the "Behind a flag" check too.

@ljharb
Copy link
Member Author

ljharb commented Feb 2, 2016

Sure, I'll just check that off once it lands in Canary.

@mathiasbynens
Copy link
Member

Nit: It’s V8, not “v8”.

@WebReflection
Copy link
Collaborator

For record sake, I've filed a Firefox bug/request: https://bugzilla.mozilla.org/show_bug.cgi?id=1245024

@ljharb
Copy link
Member Author

ljharb commented Feb 2, 2016

@mathiasbynens fixed (altho that's sad, i really prefer the lowercase v aesthetically)

@caitp
Copy link

caitp commented Feb 3, 2016

landed in WebKit last night: https://webkit.org/b/153799 / https://webkit.org/b/153814

@WebReflection
Copy link
Collaborator

thanks @caitp is it behind a flag or enabled by default?

@caitp
Copy link

caitp commented Feb 3, 2016

It's on by default

@WebReflection
Copy link
Collaborator

👍

@ljharb
Copy link
Member Author

ljharb commented Feb 3, 2016

@caitp Awesome!!

@ljharb ljharb closed this as completed May 25, 2016
@ljharb
Copy link
Member Author

ljharb commented Jul 26, 2016

Linking to tc39/ecma262#593 (comment) since this feature's spec changed slightly in July 2016.

@WebReflection
Copy link
Collaborator

anything the polyfill should consider? I'm not sure I understand undefined descriptors ... are those neither data nor accessors ?

@caitp
Copy link

caitp commented Jul 27, 2016

@WebReflection EG, if Object.getOwnPropertyDescriptor returns undefined for a name, it is not added to the result object

@WebReflection
Copy link
Collaborator

I've got the idea behind, yet I don't know how that would be possible. Can you define a property without a descriptor? Any example in order to reproduce with a test and eventually update my code?

Thanks

@caitp
Copy link

caitp commented Jul 27, 2016

You can (under some conditions) lie about the properties a Proxy has.

var p = new Proxy({}, { ownKeys() { return ["fakeProperty"]; } });
Object.getOwnPropertyDescriptors(p);

// Let ownKeys be ? obj.[[OwnPropertyKeys]]() -> ["fakeProperty"]
// Let desc be ? obj.[[GetOwnProperty]]("fakeProperty") -> undefined
// Let descriptor be ! FromPropertyDescriptor(desc). -> undefined
// ...

We don't throw an exception for lying about property keys in this case, because invariants are not violated, so it's possible to get an undefined descriptor into the algorithm.

@caitp
Copy link

caitp commented Jul 27, 2016

or in a polyfill this might look like

let names = Reflect.ownKeys(p); // ["fakeProperty"]
for (let key of names) {
  // desc = p.[[GetOwnProperty]]("fakeProperty") -> undefined
  let desc = Reflect.getOwnPropertyDescriptor(p, key);
  // ...
}

@WebReflection
Copy link
Collaborator

got it, thanks

@ljharb
Copy link
Member Author

ljharb commented Jul 27, 2016

@WebReflection the polyfill is updated in ljharb/Object.getOwnPropertyDescriptors@fc060fc - i updated the reference implementation in c13d24e as well (thanks for the reminder).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants