mirror of
https://github.com/oven-sh/bun
synced 2026-02-03 07:28:53 +00:00
Compare commits
36 Commits
dylan/pyth
...
upgrade-we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c72d5a6d7 | ||
|
|
59ce88ec55 | ||
|
|
28f8869877 | ||
|
|
1ef3e10714 | ||
|
|
2584acac8e | ||
|
|
a1977030b0 | ||
|
|
d900aa2eeb | ||
|
|
9950f3c43e | ||
|
|
c63ed310b1 | ||
|
|
db31d567c0 | ||
|
|
0f0fc06416 | ||
|
|
3d7ff83be9 | ||
|
|
9d4ec5a03a | ||
|
|
b87f1271eb | ||
|
|
45f73b76da | ||
|
|
327c36d1df | ||
|
|
ac44c949c9 | ||
|
|
eb08be1837 | ||
|
|
6272602699 | ||
|
|
172e1b689c | ||
|
|
e0d007d2fd | ||
|
|
c1bb595919 | ||
|
|
11d0e46164 | ||
|
|
79a037adbb | ||
|
|
5198f68acf | ||
|
|
e715972373 | ||
|
|
ff71061c4f | ||
|
|
eb415d5f35 | ||
|
|
d7628af4bc | ||
|
|
fd960237c0 | ||
|
|
d4ee0c0ffd | ||
|
|
0eef6c4fae | ||
|
|
12b2f36de5 | ||
|
|
78eeacc102 | ||
|
|
ddc75afdc9 | ||
|
|
9930d9d689 |
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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, {});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user