Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"'getPrototypeOf' on proxy: trap returned neither object nor null" on Chrome 77 #428

Closed
2 tasks
Astra-RX opened this issue Sep 17, 2019 · 9 comments
Closed
2 tasks
Labels

Comments

@Astra-RX
Copy link

Astra-RX commented Sep 17, 2019

🐛 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);.
image

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.
image

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
@mweststrate
Copy link
Collaborator

Could you provide a small reproduction, for example in a code sandbox?

@hronro
Copy link

hronro commented Sep 20, 2019

Same issue in my project, but I can not reproduce it in the CodeSandbox demo.

@mweststrate
Copy link
Collaborator

mweststrate commented Sep 20, 2019 via email

@alcuadrado
Copy link

alcuadrado commented Sep 26, 2019

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: nodejs/node#29730

@hronro
Copy link

hronro commented Sep 27, 2019

@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.

@mweststrate
Copy link
Collaborator

mweststrate commented Sep 27, 2019 via email

@alcuadrado
Copy link

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

@mweststrate
Copy link
Collaborator

mweststrate commented Sep 27, 2019 via email

@mweststrate
Copy link
Collaborator

Closing now, as this is beyond Immer. Let's hope they ship soon, but at least the fix landed quickly :)

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

No branches or pull requests

4 participants