Symbol.hasInstance and [[Get]] vs [[GetOwnProperty]]

Claude Pache claude.pache at gmail.com
Wed Aug 24 05:59:31 UTC 2016


>> ```js
>> Uncaught TypeError: Cannot read property 'call' of undefined
>> ```
>> 
> 
> (...)
> 
> Also, reading the message of your TypeError, I wonder if Babel may also fail unexpectedly in case SomeClass does not inherit the standard `Function#call`, as in: ```class SomeClass { static call() { throw "Pwnd!" } }```.

Correction: The potential issue I was thinking of, is when `SomeClass[Symbol.hasInstance]` does not inherit the standard `Function#call`:

```js
class SomeClass { 
    static [Symbol.hasInstance]() { /* foo */ }
}
SomeClass[Symbol.hasInstance].call = function () { throw "Pwnd!" }
```

which is quite a corner case.

—Claude


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160824/92858854/attachment.html>


More information about the es-discuss mailing list