mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
update webkit (#19238)
This commit is contained in:
@@ -222,6 +222,9 @@ $ git -C vendor/WebKit checkout <commit_hash>
|
||||
# Optionally, you can use `make jsc` for a release build
|
||||
$ make jsc-debug && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
|
||||
|
||||
# After an initial run of `make jsc-debug`, you can rebuild JSC with:
|
||||
$ cmake --build vendor/WebKit/WebKitBuild/Debug --target jsc && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
|
||||
|
||||
# Build bun with the local JSC build
|
||||
$ bun run build:local
|
||||
```
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1392,7 +1392,7 @@ jsc-build-linux-compile-build-debug:
|
||||
cmake --build $(WEBKIT_DEBUG_DIR) --config Debug --target jsc
|
||||
|
||||
|
||||
jsc-build-mac: jsc-force-fastjit jsc-build-mac-compile jsc-build-copy
|
||||
jsc-build-mac: jsc-force-fastjit jsc-build-mac-compile
|
||||
jsc-build-mac-debug: jsc-force-fastjit jsc-build-mac-compile-debug
|
||||
|
||||
jsc-build-linux: jsc-build-linux-compile-config jsc-build-linux-compile-build jsc-build-copy
|
||||
|
||||
@@ -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 06820714a7990ea77c78157f9eeaabaf56c2098a)
|
||||
set(WEBKIT_VERSION 74f9b63795643765f601068191c3f9ae4596976b)
|
||||
endif()
|
||||
|
||||
string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)
|
||||
|
||||
@@ -907,7 +907,7 @@ JSC::EncodedJSValue INVALID_ARG_VALUE(JSC::ThrowScope& throwScope, JSC::JSGlobal
|
||||
{
|
||||
WTF::StringBuilder builder;
|
||||
builder.append("The "_s);
|
||||
if (WTF::StringView(name).contains('.')) {
|
||||
if (WTF::find(name.span(), '.') != WTF::notFound) {
|
||||
builder.append("property '"_s);
|
||||
} else {
|
||||
builder.append("argument '"_s);
|
||||
@@ -935,7 +935,7 @@ JSC::EncodedJSValue INVALID_ARG_VALUE(JSC::ThrowScope& throwScope, JSC::JSGlobal
|
||||
{
|
||||
WTF::StringBuilder builder;
|
||||
builder.append("The "_s);
|
||||
if (WTF::StringView(name).contains('.')) {
|
||||
if (WTF::find(name.span(), '.') != WTF::notFound) {
|
||||
builder.append("property '"_s);
|
||||
} else {
|
||||
builder.append("argument '"_s);
|
||||
|
||||
@@ -122,11 +122,10 @@ void JSCStackTrace::getFramesForCaller(JSC::VM& vm, JSC::CallFrame* callFrame, J
|
||||
WTF::String callerName {};
|
||||
if (JSC::JSFunction* callerFunction = JSC::jsDynamicCast<JSC::JSFunction*>(caller)) {
|
||||
callerName = callerFunction->name(vm);
|
||||
if (callerName.isEmpty() && callerFunction->jsExecutable()) {
|
||||
if (callerName.isEmpty() && !callerFunction->isHostFunction() && callerFunction->jsExecutable()) {
|
||||
callerName = callerFunction->jsExecutable()->name().string();
|
||||
}
|
||||
}
|
||||
if (JSC::InternalFunction* callerFunctionInternal = JSC::jsDynamicCast<JSC::InternalFunction*>(caller)) {
|
||||
} else if (JSC::InternalFunction* callerFunctionInternal = JSC::jsDynamicCast<JSC::InternalFunction*>(caller)) {
|
||||
callerName = callerFunctionInternal->name();
|
||||
}
|
||||
|
||||
@@ -255,116 +254,6 @@ void JSCStackTrace::getFramesForCaller(JSC::VM& vm, JSC::CallFrame* callFrame, J
|
||||
});
|
||||
}
|
||||
|
||||
JSCStackTrace JSCStackTrace::captureCurrentJSStackTrace(Zig::GlobalObject* globalObject, JSC::CallFrame* callFrame, size_t frameLimit, JSC::JSValue caller)
|
||||
{
|
||||
auto& vm = JSC::getVM(globalObject);
|
||||
if (!callFrame) {
|
||||
return JSCStackTrace();
|
||||
}
|
||||
|
||||
WTF::Vector<JSCStackFrame> stackFrames;
|
||||
size_t framesCount = 0;
|
||||
|
||||
bool belowCaller = false;
|
||||
int32_t skipFrames = 0;
|
||||
|
||||
WTF::String callerName {};
|
||||
if (JSC::JSFunction* callerFunction = JSC::jsDynamicCast<JSC::JSFunction*>(caller)) {
|
||||
callerName = callerFunction->name(vm);
|
||||
if (!callerFunction->name(vm).isEmpty() || callerFunction->isHostOrBuiltinFunction()) {
|
||||
callerName = callerFunction->name(vm);
|
||||
} else {
|
||||
callerName = callerFunction->jsExecutable()->name().string();
|
||||
}
|
||||
}
|
||||
if (JSC::InternalFunction* callerFunctionInternal = JSC::jsDynamicCast<JSC::InternalFunction*>(caller)) {
|
||||
callerName = callerFunctionInternal->name();
|
||||
}
|
||||
|
||||
if (!callerName.isEmpty()) {
|
||||
JSC::StackVisitor::visit(callFrame, vm, [&](JSC::StackVisitor& visitor) -> WTF::IterationStatus {
|
||||
if (isImplementationVisibilityPrivate(visitor)) {
|
||||
return WTF::IterationStatus::Continue;
|
||||
}
|
||||
|
||||
framesCount += 1;
|
||||
|
||||
// skip caller frame and all frames above it
|
||||
if (!belowCaller) {
|
||||
skipFrames += 1;
|
||||
|
||||
if (visitor->functionName() == callerName) {
|
||||
belowCaller = true;
|
||||
return WTF::IterationStatus::Continue;
|
||||
}
|
||||
}
|
||||
|
||||
return WTF::IterationStatus::Continue;
|
||||
});
|
||||
} else if (caller && caller.isCell()) {
|
||||
JSC::StackVisitor::visit(callFrame, vm, [&](JSC::StackVisitor& visitor) -> WTF::IterationStatus {
|
||||
if (isImplementationVisibilityPrivate(visitor)) {
|
||||
return WTF::IterationStatus::Continue;
|
||||
}
|
||||
|
||||
framesCount += 1;
|
||||
|
||||
// skip caller frame and all frames above it
|
||||
if (!belowCaller) {
|
||||
auto callee = visitor->callee();
|
||||
skipFrames += 1;
|
||||
if (callee.isCell() && callee.asCell() == caller) {
|
||||
belowCaller = true;
|
||||
return WTF::IterationStatus::Continue;
|
||||
}
|
||||
}
|
||||
|
||||
return WTF::IterationStatus::Continue;
|
||||
});
|
||||
} else if (caller.isEmpty() || caller.isUndefined()) {
|
||||
// Skip the first frame.
|
||||
JSC::StackVisitor::visit(callFrame, vm, [&](JSC::StackVisitor& visitor) -> WTF::IterationStatus {
|
||||
if (isImplementationVisibilityPrivate(visitor)) {
|
||||
return WTF::IterationStatus::Continue;
|
||||
}
|
||||
|
||||
framesCount += 1;
|
||||
|
||||
if (!belowCaller) {
|
||||
skipFrames += 1;
|
||||
belowCaller = true;
|
||||
}
|
||||
|
||||
return WTF::IterationStatus::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
framesCount = std::min(frameLimit, framesCount);
|
||||
|
||||
// Create the actual stack frames
|
||||
size_t i = 0;
|
||||
stackFrames.reserveInitialCapacity(framesCount);
|
||||
JSC::StackVisitor::visit(callFrame, vm, [&](JSC::StackVisitor& visitor) -> WTF::IterationStatus {
|
||||
// Skip native frames
|
||||
if (isImplementationVisibilityPrivate(visitor)) {
|
||||
return WTF::IterationStatus::Continue;
|
||||
}
|
||||
|
||||
// Skip frames if needed
|
||||
if (skipFrames > 0) {
|
||||
skipFrames--;
|
||||
return WTF::IterationStatus::Continue;
|
||||
}
|
||||
|
||||
stackFrames.constructAndAppend(vm, visitor);
|
||||
i++;
|
||||
|
||||
return (i == framesCount) ? WTF::IterationStatus::Done : WTF::IterationStatus::Continue;
|
||||
});
|
||||
|
||||
return JSCStackTrace(stackFrames);
|
||||
}
|
||||
|
||||
JSCStackTrace JSCStackTrace::getStackTraceForThrownValue(JSC::VM& vm, JSC::JSValue thrownValue)
|
||||
{
|
||||
const WTF::Vector<JSC::StackFrame>* jscStackTrace = nullptr;
|
||||
@@ -752,6 +641,25 @@ String functionName(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, JSC::
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (functionName.isEmpty()) {
|
||||
if (jstype == JSC::JSFunctionType) {
|
||||
auto* function = jsCast<JSC::JSFunction*>(object);
|
||||
if (function) {
|
||||
functionName = function->nameWithoutGC(vm);
|
||||
if (functionName.isEmpty() && !function->isHostFunction()) {
|
||||
functionName = function->jsExecutable()->ecmaName().string();
|
||||
}
|
||||
}
|
||||
} else if (jstype == JSC::InternalFunctionType) {
|
||||
auto* function = jsCast<JSC::InternalFunction*>(object);
|
||||
if (function) {
|
||||
functionName = function->name();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return functionName;
|
||||
}
|
||||
|
||||
@@ -813,14 +721,17 @@ String functionName(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, const
|
||||
|
||||
// Lastly, try type-specific properties.
|
||||
if (jstype == JSC::JSFunctionType) {
|
||||
auto* function = jsDynamicCast<JSC::JSFunction*>(object);
|
||||
auto* function = jsCast<JSC::JSFunction*>(object);
|
||||
if (function) {
|
||||
functionName = function->nameWithoutGC(vm);
|
||||
if (functionName.isEmpty() && !function->isHostFunction()) {
|
||||
functionName = function->jsExecutable()->ecmaName().string();
|
||||
}
|
||||
setTypeFlagsIfNecessary();
|
||||
return functionName;
|
||||
}
|
||||
} else if (jstype == JSC::InternalFunctionType) {
|
||||
auto* function = jsDynamicCast<JSC::InternalFunction*>(object);
|
||||
auto* function = jsCast<JSC::InternalFunction*>(object);
|
||||
if (function) {
|
||||
functionName = function->name();
|
||||
setTypeFlagsIfNecessary();
|
||||
|
||||
@@ -179,15 +179,6 @@ public:
|
||||
|
||||
static JSCStackTrace fromExisting(JSC::VM& vm, const WTF::Vector<JSC::StackFrame>& existingFrames);
|
||||
|
||||
/* This is based on JSC::Interpreter::getStackTrace, but skips native (non js and not wasm)
|
||||
* frames, which is what v8 does. Note that we could have just called JSC::Interpreter::getStackTrace
|
||||
* and and filter it later (or let our callers filter it), but that would have been both inefficient, and
|
||||
* problematic with the requested stack size limit (as it should only refer to the non-native frames,
|
||||
* thus we would have needed to pass a large limit to JSC::Interpreter::getStackTrace, and filter out
|
||||
* maxStackSize non-native frames).
|
||||
*
|
||||
* Return value must remain stack allocated. */
|
||||
static JSCStackTrace captureCurrentJSStackTrace(Zig::GlobalObject* globalObject, JSC::CallFrame* callFrame, size_t frameLimit, JSC::JSValue caller);
|
||||
static void getFramesForCaller(JSC::VM& vm, JSC::CallFrame* callFrame, JSC::JSCell* owner, JSC::JSValue caller, WTF::Vector<JSC::StackFrame>& stackTrace, size_t stackTraceLimit);
|
||||
|
||||
/* In JSC, JSC::Exception points to the actual value that was thrown, usually
|
||||
|
||||
@@ -659,7 +659,7 @@ JSC::EncodedJSValue V::validateOneOf(JSC::ThrowScope& scope, JSC::JSGlobalObject
|
||||
|
||||
JSC::JSString* valueStr = value.toString(globalObject);
|
||||
RETURN_IF_EXCEPTION(scope, JSValue::encode({}));
|
||||
WTF::StringView valueView = valueStr->view(globalObject);
|
||||
auto valueView = valueStr->view(globalObject);
|
||||
|
||||
for (ASCIILiteral oneOfStr : oneOf) {
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ JSC_DEFINE_HOST_FUNCTION(jsHashProtoFuncUpdate, (JSC::JSGlobalObject * globalObj
|
||||
return Bun::ERR::INVALID_ARG_VALUE(scope, globalObject, "encoding"_s, encodingValue, makeString("is invalid for data of length "_s, inputString->length()));
|
||||
}
|
||||
|
||||
WTF::StringView inputView = inputString->view(globalObject);
|
||||
auto inputView = inputString->view(globalObject);
|
||||
RETURN_IF_EXCEPTION(scope, {});
|
||||
|
||||
JSValue converted = JSValue::decode(WebCore::constructFromEncoding(globalObject, inputView, encoding));
|
||||
|
||||
@@ -140,7 +140,7 @@ JSC_DEFINE_HOST_FUNCTION(jsHmacProtoFuncUpdate, (JSC::JSGlobalObject * globalObj
|
||||
return Bun::ERR::INVALID_ARG_VALUE(scope, globalObject, "encoding"_s, encodingValue, makeString("is invalid for data of length "_s, inputString->length()));
|
||||
}
|
||||
|
||||
WTF::StringView inputView = inputString->view(globalObject);
|
||||
auto inputView = inputString->view(globalObject);
|
||||
RETURN_IF_EXCEPTION(scope, {});
|
||||
|
||||
JSValue converted = JSValue::decode(WebCore::constructFromEncoding(globalObject, inputView, encoding));
|
||||
|
||||
@@ -45,7 +45,7 @@ template<>
|
||||
struct DirectConverter<IDLAtomStringAdaptor<IDLDOMString>> {
|
||||
static AtomString directConvert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSString* string)
|
||||
{
|
||||
return string->toAtomString(&lexicalGlobalObject);
|
||||
return string->toAtomString(&lexicalGlobalObject).data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ template<>
|
||||
struct DirectConverter<IDLRequiresExistingAtomStringAdaptor<IDLDOMString>> {
|
||||
static AtomString directConvert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSString* string)
|
||||
{
|
||||
return string->toExistingAtomString(&lexicalGlobalObject);
|
||||
return string->toExistingAtomString(&lexicalGlobalObject).data;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ AtomString valueToByteAtomString(JSC::JSGlobalObject& lexicalGlobalObject, JSC::
|
||||
VM& vm = lexicalGlobalObject.vm();
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
|
||||
auto string = value.toString(&lexicalGlobalObject)->toAtomString(&lexicalGlobalObject);
|
||||
AtomString string = value.toString(&lexicalGlobalObject)->toAtomString(&lexicalGlobalObject).data;
|
||||
RETURN_IF_EXCEPTION(scope, {});
|
||||
|
||||
if (UNLIKELY(throwIfInvalidByteString(lexicalGlobalObject, scope, string.string())))
|
||||
@@ -114,7 +114,7 @@ AtomString valueToUSVAtomString(JSGlobalObject& lexicalGlobalObject, JSValue val
|
||||
auto string = value.toString(&lexicalGlobalObject)->toAtomString(&lexicalGlobalObject);
|
||||
RETURN_IF_EXCEPTION(scope, {});
|
||||
|
||||
return replaceUnpairedSurrogatesWithReplacementCharacter(WTFMove(string));
|
||||
return replaceUnpairedSurrogatesWithReplacementCharacter(AtomString(string));
|
||||
}
|
||||
|
||||
} // namespace WebCore
|
||||
|
||||
@@ -194,7 +194,7 @@ template<typename T> struct Converter<IDLAtomStringAdaptor<T>> : DefaultConverte
|
||||
{
|
||||
static_assert(std::is_same<T, IDLDOMString>::value, "This adaptor is only supported for IDLDOMString at the moment.");
|
||||
|
||||
return value.toString(&lexicalGlobalObject)->toAtomString(&lexicalGlobalObject);
|
||||
return value.toString(&lexicalGlobalObject)->toAtomString(&lexicalGlobalObject).data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -267,7 +267,7 @@ template<typename T> struct Converter<IDLRequiresExistingAtomStringAdaptor<T>> :
|
||||
{
|
||||
static_assert(std::is_same<T, IDLDOMString>::value, "This adaptor is only supported for IDLDOMString at the moment.");
|
||||
|
||||
return value.toString(&lexicalGlobalObject)->toExistingAtomString(&lexicalGlobalObject);
|
||||
return value.toString(&lexicalGlobalObject)->toExistingAtomString(&lexicalGlobalObject).data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -283,4 +283,4 @@ template<typename T> struct JSConverter<IDLRequiresExistingAtomStringAdaptor<T>>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace WebCore
|
||||
} // namespace WebCore
|
||||
|
||||
@@ -24,6 +24,7 @@ test("reportError", () => {
|
||||
^
|
||||
error: reportError Test!
|
||||
at [file]:1:13
|
||||
at loadAndEvaluateModule (2:1)
|
||||
error: true
|
||||
true
|
||||
error: false
|
||||
|
||||
@@ -119,6 +119,7 @@ Quote"Backslash
|
||||
"Warning log
|
||||
warn: console.warn an error
|
||||
at <file>:56:14
|
||||
at loadAndEvaluateModule (2:1)
|
||||
|
||||
52 | console.group("Different logs");
|
||||
53 | console.log("Regular log");
|
||||
@@ -129,6 +130,7 @@ Quote"Backslash
|
||||
^
|
||||
error: console.error an error
|
||||
at <file>:57:15
|
||||
at loadAndEvaluateModule (2:1)
|
||||
|
||||
41 | console.groupEnd(); // Extra
|
||||
42 | console.groupEnd(); // Extra
|
||||
@@ -140,10 +142,12 @@ error: console.error an error
|
||||
NamedError: console.error a named error
|
||||
at new NamedError (<file>:46:5)
|
||||
at <file>:58:15
|
||||
at loadAndEvaluateModule (2:1)
|
||||
|
||||
NamedError: console.warn a named error
|
||||
at new NamedError (<file>:46:5)
|
||||
at <file>:59:14
|
||||
at loadAndEvaluateModule (2:1)
|
||||
|
||||
Error log"
|
||||
`);
|
||||
|
||||
Reference in New Issue
Block a user