Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 616723d96e05251f39c3def2fa1790da67feec2d https://github.com/WebKit/WebKit/commit/616723d96e05251f39c3def2fa1790da67feec2d Author: Sosuke Suzuki <sos...@bun.sh> Date: 2025-08-28 (Thu, 28 Aug 2025)
Changed paths: A JSTests/stress/destructuring-assignment-require-object-coercible-params.js A JSTests/stress/destructuring-assignment-require-object-coercible-symbol-private.js M JSTests/stress/destructuring-assignment-require-object-coercible.js M JSTests/stress/object-rest-deconstruct.js M LayoutTests/imported/w3c/web-platform-tests/digital-credentials/allow-attribute-with-create.https-expected.txt M LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/vp8-fmtp-expected.txt M LayoutTests/platform/ios/imported/w3c/web-platform-tests/digital-credentials/allow-attribute-with-create.https-expected.txt M LayoutTests/platform/ipad/imported/w3c/web-platform-tests/digital-credentials/allow-attribute-with-create.https-expected.txt M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp Log Message: ----------- [JSC] Improve error messages for destructuring null or undefined values https://bugs.webkit.org/show_bug.cgi?id=297773 Reviewed by Yusuke Suzuki. Destructuring null or undefined values is invalid: ({ a } = null); JSC throws a TypeError with the message "Right side of assignment cannot be destructured" for such code. However, this error is thrown not only for assignments but also for function calls, making it not a good error message. This patch fixes that issue. Additionally, this patch includes the name of the first destructured variable in the error message, similar to V8. This information is helpful for debugging. * JSTests/stress/destructuring-assignment-require-object-coercible-params.js: Added. (testTypeError): (testTypeError.fn): * JSTests/stress/destructuring-assignment-require-object-coercible-symbol-private.js: Added. (shouldThrow): (throw.new.Error): * JSTests/stress/destructuring-assignment-require-object-coercible.js: * JSTests/stress/object-rest-deconstruct.js: (catch): * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/allow-attribute-with-create.https-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/webrtc/protocol/vp8-fmtp-expected.txt: * LayoutTests/platform/ios/imported/w3c/web-platform-tests/digital-credentials/allow-attribute-with-create.https-expected.txt: * LayoutTests/platform/ipad/imported/w3c/web-platform-tests/digital-credentials/allow-attribute-with-create.https-expected.txt: * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitRequireObjectCoercibleForDestructuring): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h: * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::ObjectPatternNode::bindValue const): Canonical link: https://commits.webkit.org/299244@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes