Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8ed6b76ec394845da5f1f694d529e535f1b05277
      
https://github.com/WebKit/WebKit/commit/8ed6b76ec394845da5f1f694d529e535f1b05277
  Author: Kai Tamkun <[email protected]>
  Date:   2026-03-02 (Mon, 02 Mar 2026)

  Changed paths:
    A JSTests/stress/capturing-native-function.js
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/runtime/JSNativeStdFunction.cpp
    M Source/JavaScriptCore/runtime/JSNativeStdFunction.h

  Log Message:
  -----------
  [JSC] JSNativeStdFunction should be able to safely capture
https://bugs.webkit.org/show_bug.cgi?id=308686
rdar://171220159

Reviewed by Keith Miller and Yusuke Suzuki.

Currently, there's no way to safely keep the captures of lambdas passed to 
JSNativeStdFunction::create alive
other than use of Strong, which has its own problems. This PR allows captured 
JSValues to be passed along to
JSNativeStdFunction::create and stored in a FixedVector of WriteBarriers.

Test: JSTests/stress/capturing-native-function.js

* JSTests/stress/capturing-native-function.js: Added.
(assertNotUndefined):
(setTimeout):
* Source/JavaScriptCore/jsc.cpp:
(JSC_DEFINE_HOST_FUNCTION): Added createNoopNativeFunctionWithCapture for tests.
* Source/JavaScriptCore/runtime/JSNativeStdFunction.cpp:
(JSC::JSNativeStdFunction::visitChildrenImpl): Visit captures.
(JSC::JSNativeStdFunction::getHostFunction):
(JSC::JSNativeStdFunction::JSNativeStdFunction): Deleted.
* Source/JavaScriptCore/runtime/JSNativeStdFunction.h:

Canonical link: https://commits.webkit.org/308472@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to