"'getPrototypeOf' on proxy: trap returned neither object nor null" on Chrome 77
🐛 Bug Report
isPlainObject method throws a "'getPrototypeOf' on proxy: trap returned neither object nor null" on Chrome 77, with my current observation.
I haven't locate the problem precisely, but I'll try to describe the whole progress at my best.
When manipulating a draft, I traced my code into a isPlainObject call on a draft, and an error above was thrown on the line:
var proto = Object.getPrototypeOf(value);.

value is a draft and when I digging in, into the getPrototypeOf trap:
Object.getPrototypeOf(target.base) correctly evaluates and returns null in the devtool. After the trap returns, the error was thrown on the next step.

What's worth noting is the error raised only on Chrome 77.
To Reproduce
Still trying to minimize reproduce.
Expected behavior
As the getPrototypeOf trap returns null, the "'getPrototypeOf' on proxy: trap returned neither object nor null" error should not be thrown.
Link to repro (highly encouraged)
Please provide either a CodeSandbox demo or a minimal repository on GitHub.
Environment
- Immer version: 4.0.0
- [ ] Occurs with
setUseProxies(true) - [ ] Occurs with
setUseProxies(false)(ES5 only) with default settings
Could you provide a small reproduction, for example in a code sandbox?
Same issue in my project, but I can not reproduce it in the CodeSandbox demo.
So it is not just the browser? Then some deeper diving is needed I fear. Are there any polyfills active that could hamper the situation, cross document transportation of the objects, etc etc?
On Fri, Sep 20, 2019 at 9:08 AM Zhao [email protected] wrote:
Same issue in my project, but I can not reproduce it in the CodeSandbox demo.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/immerjs/immer/issues/428?email_source=notifications&email_token=AAN4NBBTWPSWKOJ5AGVQ43TQKSAHRA5CNFSM4IXNLMA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7F553A#issuecomment-533454572, or mute the thread https://github.com/notifications/unsubscribe-auth/AAN4NBFJOYQAAGU52VHGPITQKSAHRANCNFSM4IXNLMAQ .
I got here because I'm having the same issue in node 12.11.0, and I think that you may find this useful.
Here's how to reproduce it.
Open a node v12.11.0 and paste this:
Object.getPrototypeOf(new Proxy(Object.create(null), {
getPrototypeOf(target) {
return Reflect.getPrototypeOf(target)
}
}))
I think it's a regression in v8 that shipped in chrome 77 and node v12.11.0.
PS: I just updated chrome to 77 and I can reproduce. I couldn't before, with 76. PS2: https://github.com/nodejs/node/issues/29730
@alcuadrado But this only happens in Node.js and Chrome. Is this a bug of V8? PS: I test your code in Firefox Developer Edition 70.0b7 and Safari 13.0.1, it both works fine.
Seems like it! Probably best report it there. In my experience they are quite receptive for this kind of pin-point accurate bugs and fix it quickly
Op vr 27 sep. 2019 03:50 schreef Zhao [email protected]:
@alcuadrado https://github.com/alcuadrado But this only happens in Node.js and Chrome. Is this a bug of V8?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/immerjs/immer/issues/428?email_source=notifications&email_token=AAN4NBGZEMNYVXCFMSW7KVLQLVYIPA5CNFSM4IXNLMA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7XRYGY#issuecomment-535763995, or mute the thread https://github.com/notifications/unsubscribe-auth/AAN4NBH6DES74LZNKWJ6BE3QLVYIPANCNFSM4IXNLMAQ .
But this only happens in Node.js and Chrome. Is this a bug of V8?
Yes, it's a bug in v8.
Probably best report it there
I did: https://bugs.chromium.org/p/v8/issues/detail?id=9781
Awesome, thanks!
On Fri, Sep 27, 2019 at 4:00 PM Patricio Palladino [email protected] wrote:
But this only happens in Node.js and Chrome. Is this a bug of V8?
Yes, it's a bug in v8.
Probably best report it there
I did: https://bugs.chromium.org/p/v8/issues/detail?id=9781
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/immerjs/immer/issues/428?email_source=notifications&email_token=AAN4NBENX27W7F3RJIT2GQDQLYNX7A5CNFSM4IXNLMA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7ZFUJA#issuecomment-535976484, or mute the thread https://github.com/notifications/unsubscribe-auth/AAN4NBBW4I32YVK7XBWLDB3QLYNX7ANCNFSM4IXNLMAQ .
Closing now, as this is beyond Immer. Let's hope they ship soon, but at least the fix landed quickly :)