mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Bump WebKit (#13970)
This commit is contained in:
@@ -12,12 +12,12 @@ macro(setb variable)
|
||||
endmacro()
|
||||
|
||||
set(targets WIN32 APPLE UNIX LINUX)
|
||||
|
||||
foreach(target ${targets})
|
||||
setb(${target})
|
||||
endforeach()
|
||||
|
||||
# --- CPU target ---
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM|arm64|ARM64|aarch64|AARCH64")
|
||||
if(APPLE)
|
||||
register_compiler_flags(-mcpu=apple-m1)
|
||||
@@ -35,7 +35,6 @@ else()
|
||||
endif()
|
||||
|
||||
# --- MSVC runtime ---
|
||||
|
||||
if(WIN32)
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Use static MSVC runtime"
|
||||
@@ -46,7 +45,6 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
# --- Optimization level ---
|
||||
|
||||
if(DEBUG)
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Disable optimization"
|
||||
@@ -68,7 +66,6 @@ else()
|
||||
endif()
|
||||
|
||||
# --- Debug level ---
|
||||
|
||||
if(WIN32)
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Enable debug symbols (.pdb)"
|
||||
@@ -100,7 +97,6 @@ endif()
|
||||
# -fno-eliminate-unused-debug-types # Don't eliminate unused debug symbols
|
||||
|
||||
# --- C/C++ flags ---
|
||||
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Disable C/C++ exceptions"
|
||||
-fno-exceptions ${UNIX}
|
||||
@@ -155,7 +151,7 @@ register_compiler_flags(
|
||||
|
||||
# having this enabled in debug mode on macOS >=14 causes libarchive to fail to configure with the error:
|
||||
# > pid_t doesn't exist on this platform?
|
||||
if((DEBUG AND LINUX) OR ((NOT DEBUG) AND UNIX))
|
||||
if((DEBUG AND LINUX) OR((NOT DEBUG) AND UNIX))
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Emit an address-significance table"
|
||||
-faddrsig
|
||||
@@ -175,7 +171,6 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
# --- Linker flags ---
|
||||
|
||||
if(LINUX)
|
||||
register_linker_flags(
|
||||
DESCRIPTION "Disable relocation read-only (RELRO)"
|
||||
@@ -187,7 +182,6 @@ endif()
|
||||
|
||||
# Note: This is a helpful guide about assertions:
|
||||
# https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++
|
||||
|
||||
if(ENABLE_ASSERTIONS)
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Do not eliminate null-pointer checks"
|
||||
@@ -233,7 +227,6 @@ else()
|
||||
endif()
|
||||
|
||||
# --- Diagnostics ---
|
||||
|
||||
if(UNIX)
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Enable color diagnostics"
|
||||
@@ -247,7 +240,6 @@ register_compiler_flags(
|
||||
)
|
||||
|
||||
# --- LTO ---
|
||||
|
||||
if(ENABLE_LTO)
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Enable link-time optimization (LTO)"
|
||||
@@ -273,13 +265,11 @@ if(ENABLE_LTO)
|
||||
endif()
|
||||
|
||||
# --- Remapping ---
|
||||
|
||||
if(UNIX)
|
||||
register_compiler_flags(
|
||||
DESCRIPTION "Remap source files"
|
||||
-ffile-prefix-map=${CWD}=.
|
||||
-ffile-prefix-map=${VENDOR_PATH}=vendor
|
||||
-ffile-prefix-map=${BUILD_PATH}=build
|
||||
-ffile-prefix-map=${CACHE_PATH}=cache
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -35,7 +35,7 @@ foreach(i RANGE 10)
|
||||
STATUS GIT_DOWNLOAD_STATUS
|
||||
SHOW_PROGRESS
|
||||
)
|
||||
if(GIT_DOWNLOAD_STATUS MATCHES "^0")
|
||||
if(GIT_DOWNLOAD_STATUS MATCHES "^0" AND EXISTS GIT_DOWNLOAD_TMP_PATH)
|
||||
file(RENAME ${GIT_DOWNLOAD_TMP_PATH} ${GIT_DOWNLOAD_PATH})
|
||||
break()
|
||||
endif()
|
||||
|
||||
@@ -912,7 +912,7 @@ endif()
|
||||
|
||||
include_directories(${WEBKIT_INCLUDE_PATH})
|
||||
|
||||
if(WEBKIT_PREBUILT AND NOT APPLE)
|
||||
if(NOT WEBKIT_LOCAL AND NOT APPLE)
|
||||
include_directories(${WEBKIT_INCLUDE_PATH}/wtf/unicode)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
optionx(WEBKIT_VERSION STRING "The version of WebKit to use" DEFAULT "4db913769178d2aaae20413b995bb19e7801d7f7")
|
||||
optionx(WEBKIT_PREBUILT BOOL "If a pre-built version of WebKit should be used" DEFAULT ON)
|
||||
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(WEBKIT_PREBUILT)
|
||||
set(DEFAULT_WEBKIT_PATH ${CACHE_PATH}/webkit)
|
||||
else()
|
||||
set(DEFAULT_WEBKIT_PATH ${CWD}/src/bun.js/WebKit/WebKitBuild/${CMAKE_BUILD_TYPE})
|
||||
if(NOT WEBKIT_VERSION)
|
||||
set(WEBKIT_VERSION 4a2db3254a9535949a5d5380eb58cf0f77c8e15a)
|
||||
endif()
|
||||
|
||||
optionx(WEBKIT_PATH FILEPATH "The path to the WebKit directory" DEFAULT ${DEFAULT_WEBKIT_PATH})
|
||||
if(WEBKIT_LOCAL)
|
||||
set(DEFAULT_WEBKIT_PATH ${VENDOR_PATH}/WebKit/WebKitBuild/${CMAKE_BUILD_TYPE})
|
||||
else()
|
||||
set(DEFAULT_WEBKIT_PATH ${CACHE_PATH}/webkit-${WEBKIT_VERSION})
|
||||
endif()
|
||||
|
||||
setx(WEBKIT_INCLUDE_PATH ${WEBKIT_PATH}/include)
|
||||
setx(WEBKIT_LIB_PATH ${WEBKIT_PATH}/lib)
|
||||
option(WEBKIT_PATH "The path to the WebKit directory")
|
||||
|
||||
if(NOT WEBKIT_PREBUILT)
|
||||
if(NOT WEBKIT_PATH)
|
||||
set(WEBKIT_PATH ${DEFAULT_WEBKIT_PATH})
|
||||
endif()
|
||||
|
||||
set(WEBKIT_INCLUDE_PATH ${WEBKIT_PATH}/include)
|
||||
set(WEBKIT_LIB_PATH ${WEBKIT_PATH}/lib)
|
||||
|
||||
if(WEBKIT_LOCAL)
|
||||
if(EXISTS ${WEBKIT_PATH}/cmakeconfig.h)
|
||||
# You may need to run:
|
||||
# make jsc-compile-debug jsc-copy-headers
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
"build:logs": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_LOGS=ON -B build/release-logs",
|
||||
"build:safe": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Release -DZIG_OPTIMIZE=ReleaseSafe -B build/release-safe",
|
||||
"build:smol": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -B build/release-smol",
|
||||
"build:local": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Debug -DWEBKIT_PREBUILT=OFF -B build/debug",
|
||||
"build:release:local": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Release -DWEBKIT_PREBUILT=OFF -B build/release",
|
||||
"build:local": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Debug -DWEBKIT_LOCAL=ON -B build/debug",
|
||||
"build:release:local": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Release -DWEBKIT_LOCAL=ON -B build/release",
|
||||
"build:release:with_logs": "cmake . -DCMAKE_BUILD_TYPE=Release -DENABLE_LOGS=true -GNinja -Bbuild-release && ninja -Cbuild-release",
|
||||
"build:debug-zig-release": "cmake . -DCMAKE_BUILD_TYPE=Release -DZIG_OPTIMIZE=Debug -GNinja -Bbuild-debug-zig-release && ninja -Cbuild-debug-zig-release",
|
||||
"bump": "bun ./scripts/bump.ts",
|
||||
|
||||
@@ -173,7 +173,7 @@ static JSValue constructVersions(VM& vm, JSObject* processObject)
|
||||
object->putDirect(vm, JSC::Identifier::fromString(vm, "uwebsockets"_s),
|
||||
JSC::JSValue(JSC::jsString(vm, makeString(ASCIILiteral::fromLiteralUnsafe(Bun__versions_uws)))), 0);
|
||||
object->putDirect(vm, JSC::Identifier::fromString(vm, "webkit"_s),
|
||||
JSC::JSValue(JSC::jsString(vm, makeString(ASCIILiteral::fromLiteralUnsafe(Bun__versions_webkit)))), 0);
|
||||
JSC::JSValue(JSC::jsString(vm, makeString(ASCIILiteral::fromLiteralUnsafe(BUN_WEBKIT_VERSION)))), 0);
|
||||
object->putDirect(vm, JSC::Identifier::fromString(vm, "zig"_s),
|
||||
JSC::JSValue(JSC::jsString(vm, makeString(ASCIILiteral::fromLiteralUnsafe(Bun__versions_zig)))), 0);
|
||||
object->putDirect(vm, JSC::Identifier::fromString(vm, "zlib"_s),
|
||||
|
||||
@@ -3894,9 +3894,6 @@ JSC::JSInternalPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* j
|
||||
JSC::VM& vm = globalObject->vm();
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
|
||||
auto* promise = JSC::JSInternalPromise::create(vm, globalObject->internalPromiseStructure());
|
||||
RETURN_IF_EXCEPTION(scope, promise->rejectWithCaughtException(globalObject, scope));
|
||||
|
||||
if (globalObject->onLoadPlugins.hasVirtualModules()) {
|
||||
auto keyString = moduleNameValue->value(globalObject);
|
||||
if (auto resolution = globalObject->onLoadPlugins.resolveVirtualModule(keyString, sourceOrigin.url().protocolIsFile() ? sourceOrigin.url().fileSystemPath() : String())) {
|
||||
@@ -3904,8 +3901,10 @@ JSC::JSInternalPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* j
|
||||
|
||||
auto result = JSC::importModule(globalObject, resolvedIdentifier,
|
||||
JSC::jsUndefined(), parameters, JSC::jsUndefined());
|
||||
|
||||
RETURN_IF_EXCEPTION(scope, promise->rejectWithCaughtException(globalObject, scope));
|
||||
if (scope.exception()) {
|
||||
auto* promise = JSC::JSInternalPromise::create(vm, globalObject->internalPromiseStructure());
|
||||
return promise->rejectWithCaughtException(globalObject, scope);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -3943,7 +3942,7 @@ JSC::JSInternalPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* j
|
||||
ASSERT(startRefCount == moduleName.impl()->refCount());
|
||||
if (!resolved.success) {
|
||||
throwException(scope, resolved.result.err, globalObject);
|
||||
return promise->rejectWithCaughtException(globalObject, scope);
|
||||
return JSC::JSInternalPromise::rejectedPromiseWithCaughtException(globalObject, scope);
|
||||
}
|
||||
|
||||
JSC::Identifier resolvedIdentifier;
|
||||
@@ -3972,8 +3971,11 @@ JSC::JSInternalPromise* GlobalObject::moduleLoaderImportModule(JSGlobalObject* j
|
||||
|
||||
auto result = JSC::importModule(globalObject, resolvedIdentifier,
|
||||
JSC::jsUndefined(), parameters, jsUndefined());
|
||||
RETURN_IF_EXCEPTION(scope, promise->rejectWithCaughtException(globalObject, scope));
|
||||
if (scope.exception()) {
|
||||
return JSC::JSInternalPromise::rejectedPromiseWithCaughtException(globalObject, scope);
|
||||
}
|
||||
|
||||
ASSERT(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -264,6 +264,9 @@ const versions = existsSync(generated_versions_list);
|
||||
versions.ares = versions.c_ares;
|
||||
delete versions.c_ares;
|
||||
|
||||
// Handled by BUN_WEBKIT_VERSION #define
|
||||
delete versions.webkit;
|
||||
|
||||
for (const name in versions) {
|
||||
expect(process.versions).toHaveProperty(name);
|
||||
expect(process.versions[name]).toBe(versions[name]);
|
||||
|
||||
Reference in New Issue
Block a user