-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Structured cloning of errors makes invalid assumptions about [[GetPrototypeOf]] #4991
Comments
value has an [[ErrorData]] internal slot, so it is an ordinary object and [[GetPrototypeOf]] never throws. Should we use OrdinaryGetPrototypeOf? |
Ah, I see. That might be clearer, yes. |
I prefer not bypassing the [[ methods, so instead I guess we could add a note explaining the assert. |
That would be fine too, thank you. |
The fix here would be adding something like "value is an ordinary object due to its [[ErrorData]] internal slot." as a note below the text quoted in OP. |
I don't think an implementation is necessarily disallowed from creating an exotic object with [[ErrorData]] internal slot. I'd suggest the following fix: -if value has an [[ErrorData]] internal slot and value is not a platform object, then:
+if value is an ordinary object, has an [[ErrorData]] internal slot, and is not a platform object, then: |
This is obsolete now that #5150 is merged. We could open a new issue/PR for the issue @TimothyGu raised, but that would be a separate normative change (of not structured-cloning exotic objects with an [[ErrorData]] internal slot), and a rather theoretical one. |
https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal step 17 (the [[ErrorData]] case) substep 2 does:
But [[GetPrototypeOf]] can in fact return an abrupt completion, so this step can't use
!
. Does it mean to use?
or do something else? Are there tests for the throwing case here?@yutakahirano @TimothyGu @domenic
The text was updated successfully, but these errors were encountered: