Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 70c384691cea5902c989c46fe58067d1e90882c9
      
https://github.com/WebKit/WebKit/commit/70c384691cea5902c989c46fe58067d1e90882c9
  Author: Sosuke Suzuki <sos...@bun.sh>
  Date:   2025-08-31 (Sun, 31 Aug 2025)

  Changed paths:
    A JSTests/stress/stack-trace-error-subclasses.js
    M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/uncapturederror-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/createPipelineLayout-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/encoding/cmds/render/dynamic_state-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/image_copy/buffer_related-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/render_pipeline/inter_stage-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/bitwise_shift-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/workgroupUniformLoad-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/shader_io/workgroup_size-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/decl/var-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/expression/binary/short_circuiting_and_or-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/expression/call/builtin/value_constructor-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/functions/restrictions-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/blankspace-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/identifiers-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/interpolate-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/workgroup_size-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/statement/continuing-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/statement/for-expected.txt
    M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/statement/phony-expected.txt
    M Source/JavaScriptCore/runtime/Error.cpp
    M Source/JavaScriptCore/runtime/Error.h
    M Source/JavaScriptCore/runtime/ErrorConstructor.cpp
    M Source/JavaScriptCore/runtime/ErrorInstance.cpp
    M Source/JavaScriptCore/runtime/ErrorInstance.h

  Log Message:
  -----------
  [JSC] Error subclass stack traces should skip constructor frames
https://bugs.webkit.org/show_bug.cgi?id=266943

Reviewed by Yusuke Suzuki.

Currently, when Error subclasses are thrown, JSC includes the super() call
in the stack trace as the first frame, which provides unhelpful implementation
details to users. V8 skips these constructor frames.

This patch makes JSC match V8's behavior by detecting Error subclass
construction and skipping the constructor frame during stack trace generation.

For example, given this code:

  class MyError extends Error {}
  function throwMyError() {
      throw new MyError("my error");
  }
  throwMyError();

Before this patch, the stack trace would show:

  Exception: Error: my error
  MyError@
  throwMyError@./WebKitBuild/Debug/test.js:3:22
  global code@./WebKitBuild/Debug/test.js:5:13

After this patch, it correctly shows:

  Exception: Error: my error
  throwMyError@./WebKitBuild/Debug/test.js:3:22
  global code@./WebKitBuild/Debug/test.js:5:13

* JSTests/stress/stack-trace-error-subclasses.js: Added.
(shouldThrow):
(throw.new.Error):
(throw.new.Error.throwMyError):
(MyError2):
(throwMyError):
(i.shouldThrow):
(throwMyError.MyError):
(throwMyError.throwMyError):
* 
LayoutTests/http/tests/webgpu/webgpu/api/operation/uncapturederror-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/api/validation/createPipelineLayout-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/api/validation/encoding/cmds/render/dynamic_state-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/api/validation/image_copy/buffer_related-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/api/validation/render_pipeline/inter_stage-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/bitwise_shift-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/workgroupUniformLoad-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/shader_io/workgroup_size-expected.txt:
* LayoutTests/http/tests/webgpu/webgpu/shader/validation/decl/var-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/expression/binary/short_circuiting_and_or-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/expression/call/builtin/value_constructor-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/functions/restrictions-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/blankspace-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/identifiers-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/interpolate-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/workgroup_size-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/statement/continuing-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/statement/for-expected.txt:
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/statement/phony-expected.txt:
* Source/JavaScriptCore/runtime/Error.cpp:
(JSC::getStackTrace):
* Source/JavaScriptCore/runtime/Error.h:
* Source/JavaScriptCore/runtime/ErrorConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/ErrorInstance.cpp:
(JSC::ErrorInstance::create):
(JSC::ErrorInstance::finishCreation):
* Source/JavaScriptCore/runtime/ErrorInstance.h:
(JSC::ErrorInstance::create):

Canonical link: https://commits.webkit.org/299375@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

Reply via email to