Compare commits

...

36 Commits

Author SHA1 Message Date
Sosuke Suzuki
9c72d5a6d7 Merge branch 'main' into upgrade-webkit-20251007 2025-11-25 15:13:00 +09:00
Sosuke Suzuki
59ce88ec55 Update preview build 2025-11-12 10:47:08 +09:00
Sosuke Suzuki
28f8869877 Merge branch 'main' into upgrade-webkit-20251007 2025-11-12 10:09:41 +09:00
Sosuke Suzuki
1ef3e10714 Update preview build 2025-11-02 10:39:19 +09:00
Sosuke Suzuki
2584acac8e Merge branch 'main' into upgrade-webkit-20251007 2025-11-02 10:38:33 +09:00
Sosuke Suzuki
a1977030b0 Merge branch 'main' into upgrade-webkit-20251007 2025-10-27 10:33:20 +09:00
Sosuke Suzuki
d900aa2eeb Revert gc related change 2025-10-26 17:36:03 +09:00
Sosuke Suzuki
9950f3c43e Merge branch 'main' into upgrade-webkit-20251007 2025-10-26 17:34:36 +09:00
Sosuke Suzuki
c63ed310b1 Fix gc related timeout 2025-10-25 12:04:04 +09:00
autofix-ci[bot]
db31d567c0 [autofix.ci] apply automated fixes 2025-10-25 02:51:31 +00:00
Sosuke Suzuki
0f0fc06416 Attempt to fix gc related timeout 2025-10-25 11:47:54 +09:00
SUZUKI Sosuke
3d7ff83be9 Merge branch 'main' into upgrade-webkit-20251007 2025-10-24 13:20:08 +09:00
autofix-ci[bot]
9d4ec5a03a [autofix.ci] apply automated fixes 2025-10-21 23:48:31 +00:00
Sosuke Suzuki
b87f1271eb Add missing exception check 2025-10-22 08:45:53 +09:00
Sosuke Suzuki
45f73b76da Update preview build 2025-10-21 18:23:22 +09:00
Sosuke Suzuki
327c36d1df Merge branch 'main' into upgrade-webkit-20251007 2025-10-21 18:22:41 +09:00
Sosuke Suzuki
ac44c949c9 Update preview build 2025-10-17 16:13:44 +09:00
Sosuke Suzuki
eb08be1837 Update preview build 2025-10-17 10:27:23 +09:00
Sosuke Suzuki
6272602699 Update preview build 2025-10-16 00:53:44 +09:00
Sosuke Suzuki
172e1b689c Merge branch 'main' into upgrade-webkit-20251007 2025-10-15 20:28:36 +09:00
Sosuke Suzuki
e0d007d2fd Use globalObject->promiseEmptyOnRejectedFunction() 2025-10-15 20:28:05 +09:00
Sosuke Suzuki
c1bb595919 Skip internal promise in promiseRejectionTracker 2025-10-15 18:48:23 +09:00
Sosuke Suzuki
11d0e46164 Use markAsHandled 2025-10-15 16:29:39 +09:00
Sosuke Suzuki
79a037adbb Revert "Fix handling"
This reverts commit ff71061c4f.
2025-10-15 15:33:08 +09:00
Sosuke Suzuki
5198f68acf Update JSType.zig 2025-10-15 13:31:06 +09:00
Sosuke Suzuki
e715972373 Update preview build 2025-10-15 11:17:07 +09:00
Sosuke Suzuki
ff71061c4f Fix handling 2025-10-15 10:34:53 +09:00
Sosuke Suzuki
eb415d5f35 Use BunInvokeJobWithArguments 2025-10-14 22:15:29 +09:00
Sosuke Suzuki
d7628af4bc Update preview build 2025-10-14 17:42:12 +09:00
Sosuke Suzuki
fd960237c0 Use internal microtasks for bun 2025-10-14 16:54:20 +09:00
Sosuke Suzuki
d4ee0c0ffd Use preview build 2025-10-14 12:48:07 +09:00
Sosuke Suzuki
0eef6c4fae Merge branch 'main' into upgrade-webkit-20251007 2025-10-14 12:47:55 +09:00
Sosuke Suzuki
12b2f36de5 Attempt to fix segv 2025-10-10 14:21:22 +09:00
Sosuke Suzuki
78eeacc102 Attempt to fix build 2025-10-10 00:19:44 +09:00
Sosuke Suzuki
ddc75afdc9 Fix queueMicrotask issues 2025-10-09 22:57:01 +09:00
Sosuke Suzuki
9930d9d689 Attempt to fix build for passing vm params on promise related functions 2025-10-09 16:21:33 +09:00
10 changed files with 72 additions and 65 deletions

View File

@@ -2,7 +2,7 @@ option(WEBKIT_VERSION "The version of WebKit to use")
option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading")
if(NOT WEBKIT_VERSION)
set(WEBKIT_VERSION 6d0f3aac0b817cc01a846b3754b21271adedac12)
set(WEBKIT_VERSION preview-pr-113-e7231e3f)
endif()
string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)

View File

@@ -594,15 +594,15 @@ extern "C" JSC_DEFINE_HOST_FUNCTION(JSMock__jsModuleMock, (JSC::JSGlobalObject *
if (result && result.isObject()) {
while (JSC::JSPromise* promise = jsDynamicCast<JSC::JSPromise*>(result)) {
switch (promise->status(vm)) {
switch (promise->status()) {
case JSC::JSPromise::Status::Rejected: {
result = promise->result(vm);
result = promise->result();
scope.throwException(globalObject, result);
return {};
break;
}
case JSC::JSPromise::Status::Fulfilled: {
result = promise->result(vm);
result = promise->result();
break;
}
// TODO: blocking wait for promise
@@ -741,13 +741,13 @@ EncodedJSValue BunPlugin::OnLoad::run(JSC::JSGlobalObject* globalObject, BunStri
RETURN_IF_EXCEPTION(scope, {});
if (auto* promise = JSC::jsDynamicCast<JSPromise*>(result)) {
switch (promise->status(vm)) {
switch (promise->status()) {
case JSPromise::Status::Rejected:
case JSPromise::Status::Pending: {
return JSValue::encode(promise);
}
case JSPromise::Status::Fulfilled: {
result = promise->result(vm);
result = promise->result();
break;
}
}
@@ -827,18 +827,18 @@ EncodedJSValue BunPlugin::OnResolve::run(JSC::JSGlobalObject* globalObject, BunS
}
if (auto* promise = JSC::jsDynamicCast<JSPromise*>(result)) {
switch (promise->status(vm)) {
switch (promise->status()) {
case JSPromise::Status::Pending: {
JSC::throwTypeError(globalObject, scope, "onResolve() doesn't support pending promises yet"_s);
return {};
}
case JSPromise::Status::Rejected: {
promise->internalField(JSC::JSPromise::Field::Flags).set(vm, promise, jsNumber(static_cast<unsigned>(JSC::JSPromise::Status::Fulfilled)));
result = promise->result(vm);
result = promise->result();
return JSValue::encode(result);
}
case JSPromise::Status::Fulfilled: {
result = promise->result(vm);
result = promise->result();
break;
}
}
@@ -914,13 +914,13 @@ JSC::JSValue runVirtualModule(Zig::GlobalObject* globalObject, BunString* specif
RETURN_IF_EXCEPTION(throwScope, JSC::jsUndefined());
if (auto* promise = JSC::jsDynamicCast<JSPromise*>(result)) {
switch (promise->status(vm)) {
switch (promise->status()) {
case JSPromise::Status::Rejected:
case JSPromise::Status::Pending: {
return promise;
}
case JSPromise::Status::Fulfilled: {
result = promise->result(vm);
result = promise->result();
break;
}
}

View File

@@ -14,6 +14,7 @@
#include <JavaScriptCore/LazyProperty.h>
#include <JavaScriptCore/JSCJSValueInlines.h>
#include <JavaScriptCore/JSInternalPromise.h>
#include <JavaScriptCore/JSPromiseConstructor.h>
#include <JavaScriptCore/LazyPropertyInlines.h>
#include <JavaScriptCore/VMTrapsInlines.h>
#include <JavaScriptCore/Weak.h>
@@ -968,6 +969,7 @@ JSC_DEFINE_HOST_FUNCTION(jsMockFunctionCall, (JSGlobalObject * lexicalGlobalObje
}
case JSMockImplementation::Kind::RejectedValue: {
JSValue rejectedPromise = JSC::JSPromise::rejectedPromise(globalObject, impl->underlyingValue.get());
RETURN_IF_EXCEPTION(scope, {});
setReturnValue(createMockResult(vm, globalObject, "return"_s, rejectedPromise));
return JSValue::encode(rejectedPromise);
}

View File

@@ -488,13 +488,17 @@ pub const JSType = enum(u8) {
/// Internal object used to track the state of Promise.all() resolution.
PromiseAllContext = 77,
/// Promise reaction object for tracking promise callbacks.
/// Internal object used in the promise resolution mechanism.
PromiseReaction = 78,
/// JavaScript Map object for key-value storage.
/// ```js
/// new Map()
/// map.set(key, value)
/// map.get(key)
/// ```
Map = 78,
Map = 79,
/// JavaScript Set object for unique value storage.
/// ```js
@@ -502,34 +506,34 @@ pub const JSType = enum(u8) {
/// set.add(value)
/// set.has(value)
/// ```
Set = 79,
Set = 80,
/// WeakMap for weak key-value references.
/// ```js
/// new WeakMap()
/// weakMap.set(object, value)
/// ```
WeakMap = 80,
WeakMap = 81,
/// WeakSet for weak value references.
/// ```js
/// new WeakSet()
/// weakSet.add(object)
/// ```
WeakSet = 81,
WeakSet = 82,
WebAssemblyModule = 82,
WebAssemblyInstance = 83,
WebAssemblyGCObject = 84,
WebAssemblyModule = 83,
WebAssemblyInstance = 84,
WebAssemblyGCObject = 85,
/// Boxed String object.
/// ```js
/// new String("hello")
/// ```
StringObject = 85,
StringObject = 86,
DerivedStringObject = 86,
InternalFieldTuple = 87,
DerivedStringObject = 87,
InternalFieldTuple = 88,
MaxJS = 0b11111111,
Event = 0b11101111,

View File

@@ -676,11 +676,11 @@ JSValue fetchCommonJSModule(
RELEASE_AND_RETURN(scope, target);
}
JSPromise* promise = jsCast<JSPromise*>(promiseOrCommonJSModule);
switch (promise->status(vm)) {
switch (promise->status()) {
case JSPromise::Status::Rejected: {
uint32_t promiseFlags = promise->internalField(JSPromise::Field::Flags).get().asUInt32AsAnyInt();
promise->internalField(JSPromise::Field::Flags).set(vm, promise, jsNumber(promiseFlags | JSPromise::isHandledFlag));
JSC::throwException(globalObject, scope, promise->result(vm));
JSC::throwException(globalObject, scope, promise->result());
RELEASE_AND_RETURN(scope, JSValue {});
}
case JSPromise::Status::Pending: {
@@ -693,7 +693,7 @@ JSValue fetchCommonJSModule(
RELEASE_AND_RETURN(scope, {});
}
if (!wasModuleMock) {
auto* jsSourceCode = jsCast<JSSourceCode*>(promise->result(vm));
auto* jsSourceCode = jsCast<JSSourceCode*>(promise->result());
globalObject->moduleLoader()->provideFetch(globalObject, specifierValue, jsSourceCode->sourceCode());
RETURN_IF_EXCEPTION(scope, {});
}
@@ -727,11 +727,11 @@ JSValue fetchCommonJSModule(
RELEASE_AND_RETURN(scope, target);
}
JSPromise* promise = jsCast<JSPromise*>(promiseOrCommonJSModule);
switch (promise->status(vm)) {
switch (promise->status()) {
case JSPromise::Status::Rejected: {
uint32_t promiseFlags = promise->internalField(JSPromise::Field::Flags).get().asUInt32AsAnyInt();
promise->internalField(JSPromise::Field::Flags).set(vm, promise, jsNumber(promiseFlags | JSPromise::isHandledFlag));
JSC::throwException(globalObject, scope, promise->result(vm));
JSC::throwException(globalObject, scope, promise->result());
RELEASE_AND_RETURN(scope, JSValue {});
}
case JSPromise::Status::Pending: {
@@ -744,7 +744,7 @@ JSValue fetchCommonJSModule(
RELEASE_AND_RETURN(scope, {});
}
if (!wasModuleMock) {
auto* jsSourceCode = jsCast<JSSourceCode*>(promise->result(vm));
auto* jsSourceCode = jsCast<JSSourceCode*>(promise->result());
globalObject->moduleLoader()->provideFetch(globalObject, specifierValue, jsSourceCode->sourceCode());
RETURN_IF_EXCEPTION(scope, {});
}

View File

@@ -319,7 +319,7 @@ static JSInternalPromise* importModuleInner(JSGlobalObject* globalObject, JSStri
promise->fulfill(globalObject, result);
RETURN_IF_EXCEPTION(scope, nullptr);
promise = promise->then(globalObject, transformer, nullptr);
promise = promise->then(globalObject, transformer, globalObject->promiseEmptyOnRejectedFunction());
RETURN_IF_EXCEPTION(scope, nullptr);
RELEASE_AND_RETURN(scope, promise);

View File

@@ -852,6 +852,13 @@ void GlobalObject::promiseRejectionTracker(JSGlobalObject* obj, JSC::JSPromise*
// Do this in C++ for now
auto* globalObj = static_cast<GlobalObject*>(obj);
// JSInternalPromise should not be tracked through the normal promise rejection mechanism
// as they are internal to the engine and should not be exposed to user space.
// See: JSInternalPromise.h - "CAUTION: Must not leak the JSInternalPromise to the user space"
if (jsDynamicCast<JSC::JSInternalPromise*>(promise))
return;
switch (operation) {
case JSPromiseRejectionOperation::Reject:
globalObj->m_aboutToBeNotifiedRejectedPromises.append(obj->vm(), globalObj, promise);
@@ -1061,8 +1068,9 @@ JSC_DEFINE_HOST_FUNCTION(functionQueueMicrotask,
}
// This is a JSC builtin function
lexicalGlobalObject->queueMicrotask(function, callback, asyncContext,
JSC::JSValue {}, JSC::JSValue {});
// BunPerformMicrotaskJob expects: performMicrotask, job, asyncContext, arg0, arg1
JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, globalObject, function, callback, asyncContext };
globalObject->vm().queueMicrotask(WTFMove(task));
return JSC::JSValue::encode(JSC::jsUndefined());
}
@@ -2982,7 +2990,7 @@ void GlobalObject::handleRejectedPromises()
JSC::VM& virtual_machine = vm();
auto scope = DECLARE_CATCH_SCOPE(virtual_machine);
while (auto* promise = m_aboutToBeNotifiedRejectedPromises.takeFirst(this)) {
if (promise->isHandled(virtual_machine))
if (promise->isHandled())
continue;
Bun__handleRejectedPromise(this, promise);
@@ -3091,7 +3099,9 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskCallback(Zig::GlobalObject* g
#endif
// Do not use JSCell* here because the GC will try to visit it.
globalObject->queueMicrotask(function, JSValue(std::bit_cast<double>(reinterpret_cast<uintptr_t>(ptr))), JSValue(std::bit_cast<double>(reinterpret_cast<uintptr_t>(callback))), jsUndefined(), jsUndefined());
// Use BunInvokeJobWithArguments to pass the two arguments (ptr and callback) to the trampoline function
JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunInvokeJobWithArguments, globalObject, function, JSValue(std::bit_cast<double>(reinterpret_cast<uintptr_t>(ptr))), JSValue(std::bit_cast<double>(reinterpret_cast<uintptr_t>(callback))) };
globalObject->vm().queueMicrotask(WTFMove(task));
}
JSC::Identifier GlobalObject::moduleLoaderResolve(JSGlobalObject* jsGlobalObject,

View File

@@ -46,6 +46,7 @@
#include "JavaScriptCore/JSArray.h"
#include "JavaScriptCore/JSArrayBuffer.h"
#include "JavaScriptCore/JSArrayInlines.h"
#include "JavaScriptCore/JSFunction.h"
#include "JavaScriptCore/ErrorInstanceInlines.h"
#include "JavaScriptCore/BigIntObject.h"
#include "JavaScriptCore/OrderedHashTableHelper.h"
@@ -2902,12 +2903,12 @@ JSC::EncodedJSValue JSC__JSModuleLoader__evaluate(JSC::JSGlobalObject* globalObj
promise->rejectWithCaughtException(globalObject, scope);
}
auto status = promise->status(vm);
auto status = promise->status();
if (status == JSC::JSPromise::Status::Fulfilled) {
return JSC::JSValue::encode(promise->result(vm));
return JSC::JSValue::encode(promise->result());
} else if (status == JSC::JSPromise::Status::Rejected) {
*arg6 = JSC::JSValue::encode(promise->result(vm));
*arg6 = JSC::JSValue::encode(promise->result());
return JSC::JSValue::encode(JSC::jsUndefined());
} else {
return JSC::JSValue::encode(promise);
@@ -3309,7 +3310,7 @@ JSC__JSModuleLoader__loadAndEvaluateModule(JSC::JSGlobalObject* globalObject,
JSC::JSNativeStdFunction* resolverFunction = JSC::JSNativeStdFunction::create(
vm, globalObject, 1, String(), resolverFunctionCallback);
auto* newPromise = promise->then(globalObject, resolverFunction, nullptr);
auto* newPromise = promise->then(globalObject, resolverFunction, globalObject->promiseEmptyOnRejectedFunction());
EXCEPTION_ASSERT(!!scope.exception() == !newPromise);
return newPromise;
}
@@ -3409,7 +3410,7 @@ JSC::EncodedJSValue JSC__JSPromise__wrap(JSC::JSGlobalObject* globalObject, void
ASSERT_WITH_MESSAGE(!value.isEmpty(), "Promise.reject cannot be called with a empty JSValue");
auto& vm = JSC::getVM(globalObject);
ASSERT_WITH_MESSAGE(arg0->inherits<JSC::JSPromise>(), "Argument is not a promise");
ASSERT_WITH_MESSAGE(arg0->status(vm) == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected");
ASSERT_WITH_MESSAGE(arg0->status() == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected");
JSC::Exception* exception = nullptr;
if (!value.inherits<JSC::Exception>()) {
@@ -3424,7 +3425,7 @@ JSC::EncodedJSValue JSC__JSPromise__wrap(JSC::JSGlobalObject* globalObject, void
[[ZIG_EXPORT(check_slow)]] void JSC__JSPromise__rejectAsHandled(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2)
{
ASSERT_WITH_MESSAGE(arg0->inherits<JSC::JSPromise>(), "Argument is not a promise");
ASSERT_WITH_MESSAGE(arg0->status(arg0->vm()) == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected");
ASSERT_WITH_MESSAGE(arg0->status() == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected");
arg0->rejectAsHandled(arg1, JSC::JSValue::decode(JSValue2));
}
@@ -3439,7 +3440,7 @@ JSC::JSPromise* JSC__JSPromise__rejectedPromise(JSC::JSGlobalObject* arg0, JSC::
JSValue target = JSValue::decode(JSValue2);
ASSERT_WITH_MESSAGE(arg0->inherits<JSC::JSPromise>(), "Argument is not a promise");
ASSERT_WITH_MESSAGE(arg0->status(arg0->vm()) == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected");
ASSERT_WITH_MESSAGE(arg0->status() == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected");
ASSERT(!target.isEmpty());
ASSERT_WITH_MESSAGE(arg0 != target, "Promise cannot be resolved to itself");
@@ -3502,12 +3503,8 @@ void JSC__JSPromise__rejectOnNextTickWithHandled(JSC::JSPromise* promise, JSC::J
value = jsUndefined();
}
globalObject->queueMicrotask(
microtaskFunction,
rejectPromiseFunction,
globalObject->m_asyncContextData.get()->getInternalField(0),
promise,
value);
JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, globalObject, microtaskFunction, rejectPromiseFunction, globalObject->m_asyncContextData.get()->getInternalField(0), promise, value };
globalObject->vm().queueMicrotask(WTFMove(task));
RETURN_IF_EXCEPTION(scope, );
}
}
@@ -3527,7 +3524,7 @@ JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObjec
// if the promise is rejected we automatically mark it as handled so it
// doesn't end up in the promise rejection tracker
switch (promise->status(vm)) {
switch (promise->status()) {
case JSC::JSPromise::Status::Rejected: {
uint32_t flags = promise->internalField(JSC::JSPromise::Field::Flags).get().asUInt32();
if (!(flags & JSC::JSPromise::isFirstResolvingFunctionCalledFlag)) {
@@ -3536,7 +3533,7 @@ JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObjec
}
// fallthrough intended
case JSC::JSPromise::Status::Fulfilled: {
return JSValue::encode(promise->result(vm));
return JSValue::encode(promise->result());
}
default:
return JSValue::encode(JSValue {});
@@ -3545,7 +3542,7 @@ JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObjec
[[ZIG_EXPORT(nothrow)]] uint32_t JSC__JSPromise__status(const JSC::JSPromise* arg0, JSC::VM* arg1)
{
switch (arg0->status(*arg1)) {
switch (arg0->status()) {
case JSC::JSPromise::Status::Pending:
return 0;
case JSC::JSPromise::Status::Fulfilled:
@@ -3558,13 +3555,11 @@ JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObjec
}
[[ZIG_EXPORT(nothrow)]] bool JSC__JSPromise__isHandled(const JSC::JSPromise* arg0, JSC::VM* arg1)
{
return arg0->isHandled(*arg1);
return arg0->isHandled();
}
[[ZIG_EXPORT(nothrow)]] void JSC__JSPromise__setHandled(JSC::JSPromise* promise, JSC::VM* arg1)
{
auto& vm = *arg1;
auto flags = promise->internalField(JSC::JSPromise::Field::Flags).get().asUInt32();
promise->internalField(JSC::JSPromise::Field::Flags).set(vm, promise, jsNumber(flags | JSC::JSPromise::isHandledFlag));
promise->markAsHandled();
}
#pragma mark - JSC::JSInternalPromise
@@ -3623,11 +3618,11 @@ JSC::JSInternalPromise* JSC__JSInternalPromise__resolvedPromise(JSC::JSGlobalObj
JSC::EncodedJSValue JSC__JSInternalPromise__result(const JSC::JSInternalPromise* arg0, JSC::VM* arg1)
{
return JSC::JSValue::encode(arg0->result(*arg1));
return JSC::JSValue::encode(arg0->result());
}
uint32_t JSC__JSInternalPromise__status(const JSC::JSInternalPromise* arg0, JSC::VM* arg1)
{
switch (arg0->status(*arg1)) {
switch (arg0->status()) {
case JSC::JSInternalPromise::Status::Pending:
return 0;
case JSC::JSInternalPromise::Status::Fulfilled:
@@ -3640,7 +3635,7 @@ uint32_t JSC__JSInternalPromise__status(const JSC::JSInternalPromise* arg0, JSC:
}
bool JSC__JSInternalPromise__isHandled(const JSC::JSInternalPromise* arg0, JSC::VM* arg1)
{
return arg0->isHandled(*arg1);
return arg0->isHandled();
}
void JSC__JSInternalPromise__setHandled(JSC::JSInternalPromise* promise, JSC::VM* arg1)
{
@@ -5370,7 +5365,7 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0
if (microtaskArgs[3].isEmpty()) {
microtaskArgs[3] = jsUndefined();
}
auto microTaskFunction = globalObject->performMicrotaskFunction();
JSC::JSFunction* microTaskFunction = globalObject->performMicrotaskFunction();
#if ASSERT_ENABLED
ASSERT_WITH_MESSAGE(microTaskFunction, "Invalid microtask function");
auto& vm = globalObject->vm();
@@ -5392,12 +5387,8 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0
#endif
globalObject->queueMicrotask(
microTaskFunction,
WTFMove(microtaskArgs[0]),
WTFMove(microtaskArgs[1]),
WTFMove(microtaskArgs[2]),
WTFMove(microtaskArgs[3]));
JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, globalObject, microTaskFunction, WTFMove(microtaskArgs[0]), WTFMove(microtaskArgs[1]), WTFMove(microtaskArgs[2]), WTFMove(microtaskArgs[3]) };
globalObject->vm().queueMicrotask(WTFMove(task));
}
extern "C" WebCore::AbortSignal* WebCore__AbortSignal__new(JSC::JSGlobalObject* globalObject)

View File

@@ -76,12 +76,12 @@ auto DOMPromise::whenPromiseIsSettled(JSDOMGlobalObject* globalObject, JSC::JSOb
JSC::JSValue DOMPromise::result() const
{
return promise()->result(m_globalObject->vm());
return promise()->result();
}
DOMPromise::Status DOMPromise::status() const
{
switch (promise()->status(m_globalObject->vm())) {
switch (promise()->status()) {
case JSC::JSPromise::Status::Pending:
return Status::Pending;
case JSC::JSPromise::Status::Fulfilled:

View File

@@ -801,7 +801,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionRunMain, (JSGlobalObject * globalObject, JSC:
RETURN_IF_EXCEPTION(scope, {});
JSC::JSNativeStdFunction* resolverFunction = JSC::JSNativeStdFunction::create(vm, globalObject, 1, String(), resolverFunctionCallback);
auto result = promise->then(globalObject, resolverFunction, nullptr);
auto result = promise->then(globalObject, resolverFunction, globalObject->promiseEmptyOnRejectedFunction());
RETURN_IF_EXCEPTION(scope, {});
Bun__VirtualMachine__setOverrideModuleRunMainPromise(defaultGlobalObject(globalObject)->bunVM(), result);