Bump WebKit (#22957)

### What does this PR do?

### How did you verify your code works?

---------

Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2025-09-26 01:46:26 -07:00
committed by GitHub
parent 064ecc37fd
commit ea735c341f
7 changed files with 83 additions and 72 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 495c25e24927ba03277ae225cd42811588d03ff8)
set(WEBKIT_VERSION 69fa2714ab5f917c2d15501ff8cfdccfaea78882)
endif()
string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)

View File

@@ -33,7 +33,7 @@ public:
ncrypto::EVPKeyCtxPointer setup();
static std::optional<DhKeyPairJobCtx> fromJS(JSC::JSGlobalObject* globalObject, JSC::ThrowScope& scope, const JSC::GCOwnedDataScope<WTF::StringView>& typeView, JSC::JSValue optionsValue, const KeyEncodingConfig& config);
std::variant<ncrypto::BignumPointer, int> m_prime;
WTF::Variant<ncrypto::BignumPointer, int> m_prime;
uint32_t m_generator;
};

View File

@@ -57,14 +57,16 @@ JSC::JSValue JSMessageEvent::data(JSC::JSGlobalObject& lexicalGlobalObject) cons
{
auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject.vm());
return cachedPropertyValue(throwScope, lexicalGlobalObject, *this, wrapped().cachedData(), [this, &lexicalGlobalObject](JSC::ThrowScope&) {
return WTF::switchOn(
wrapped().data(), [this](MessageEvent::JSValueTag) -> JSC::JSValue { return wrapped().jsData().getValue(JSC::jsNull()); },
[this, &lexicalGlobalObject](const Ref<SerializedScriptValue>& data) {
// FIXME: Is it best to handle errors by returning null rather than throwing an exception?
return data->deserialize(lexicalGlobalObject, globalObject(), wrapped().ports(), SerializationErrorMode::NonThrowing); },
[&lexicalGlobalObject](const String& data) { return toJS<IDLDOMString>(lexicalGlobalObject, data); },
[this, &lexicalGlobalObject](const Ref<Blob>& data) { return toJS<IDLInterface<Blob>>(lexicalGlobalObject, *globalObject(), data); },
[this, &lexicalGlobalObject](const Ref<ArrayBuffer>& data) { return toJS<IDLInterface<ArrayBuffer>>(lexicalGlobalObject, *globalObject(), data); });
return std::visit(
WTF::makeVisitor(
[this](MessageEvent::JSValueTag) -> JSC::JSValue { return wrapped().jsData().getValue(JSC::jsNull()); },
[this, &lexicalGlobalObject](const Ref<SerializedScriptValue>& data) -> JSC::JSValue {
// FIXME: Is it best to handle errors by returning null rather than throwing an exception?
return data->deserialize(lexicalGlobalObject, globalObject(), wrapped().ports(), SerializationErrorMode::NonThrowing); },
[&lexicalGlobalObject](const String& data) -> JSC::JSValue { return toJS<IDLDOMString>(lexicalGlobalObject, data); },
[this, &lexicalGlobalObject](const Ref<Blob>& data) -> JSC::JSValue { return toJS<IDLInterface<Blob>>(lexicalGlobalObject, *globalObject(), data); },
[this, &lexicalGlobalObject](const Ref<ArrayBuffer>& data) -> JSC::JSValue { return toJS<IDLInterface<ArrayBuffer>>(lexicalGlobalObject, *globalObject(), data); }),
wrapped().data());
});
}

View File

@@ -146,12 +146,14 @@ EventInterface MessageEvent::eventInterface() const
size_t MessageEvent::memoryCost() const
{
Locker { m_concurrentDataAccessLock };
return WTF::switchOn(
m_data, [](JSValueTag) -> size_t { return 0; },
[](const Ref<SerializedScriptValue>& data) -> size_t { return data->memoryCost(); },
[](const String& string) -> size_t { return string.sizeInBytes(); },
[](const Ref<Blob>& blob) -> size_t { return blob->memoryCost(); },
[](const Ref<ArrayBuffer>& buffer) -> size_t { return buffer->byteLength(); });
return std::visit(
WTF::makeVisitor(
[](JSValueTag) -> size_t { return 0; },
[](const Ref<SerializedScriptValue>& data) -> size_t { return data->memoryCost(); },
[](const String& string) -> size_t { return string.sizeInBytes(); },
[](const Ref<Blob>& blob) -> size_t { return blob->memoryCost(); },
[](const Ref<ArrayBuffer>& buffer) -> size_t { return buffer->byteLength(); }),
m_data);
}
} // namespace WebCore

View File

@@ -142,9 +142,10 @@ void PerformanceUserTiming::clearMarks(const String& markName)
ExceptionOr<double> PerformanceUserTiming::convertMarkToTimestamp(const std::variant<String, double>& mark) const
{
return WTF::switchOn(mark, [&](auto& value) {
return std::visit([&](auto& value) {
return convertMarkToTimestamp(value);
});
},
mark);
}
ExceptionOr<double> PerformanceUserTiming::convertMarkToTimestamp(const String& mark) const
@@ -283,23 +284,24 @@ static bool isNonEmptyDictionary(const PerformanceMeasureOptions& measureOptions
ExceptionOr<Ref<PerformanceMeasure>> PerformanceUserTiming::measure(JSC::JSGlobalObject& globalObject, const String& measureName, std::optional<StartOrMeasureOptions>&& startOrMeasureOptions, const String& endMark)
{
if (startOrMeasureOptions) {
return WTF::switchOn(
*startOrMeasureOptions,
[&](const PerformanceMeasureOptions& measureOptions) -> ExceptionOr<Ref<PerformanceMeasure>> {
if (isNonEmptyDictionary(measureOptions)) {
if (!endMark.isNull())
return Exception { TypeError };
if (!measureOptions.start && !measureOptions.end)
return Exception { TypeError };
if (measureOptions.start && measureOptions.duration && measureOptions.end)
return Exception { TypeError };
}
return std::visit(
WTF::makeVisitor(
[&](const PerformanceMeasureOptions& measureOptions) -> ExceptionOr<Ref<PerformanceMeasure>> {
if (isNonEmptyDictionary(measureOptions)) {
if (!endMark.isNull())
return Exception { TypeError };
if (!measureOptions.start && !measureOptions.end)
return Exception { TypeError };
if (measureOptions.start && measureOptions.duration && measureOptions.end)
return Exception { TypeError };
}
return measure(globalObject, measureName, measureOptions);
},
[&](const String& startMark) {
return measure(measureName, startMark, endMark);
});
return measure(globalObject, measureName, measureOptions);
},
[&](const String& startMark) -> ExceptionOr<Ref<PerformanceMeasure>> {
return measure(measureName, startMark, endMark);
}),
*startOrMeasureOptions);
}
return measure(measureName, {}, endMark);

View File

@@ -6275,9 +6275,11 @@ JSValue SerializedScriptValue::deserialize(JSGlobalObject& lexicalGlobalObject,
for (const auto& property : m_simpleInMemoryPropertyTable) {
// We **must** clone this so that the atomic flag doesn't get set to true.
JSC::Identifier identifier = JSC::Identifier::fromString(vm, property.propertyName.isolatedCopy());
JSValue value = WTF::switchOn(
property.value, [](JSValue value) -> JSValue { return value; },
[&](const String& string) -> JSValue { return jsString(vm, string); });
JSValue value = std::visit(
WTF::makeVisitor(
[](JSValue value) -> JSValue { return value; },
[&](const String& string) -> JSValue { return jsString(vm, string); }),
property.value);
object->putDirect(vm, identifier, value);
}

View File

@@ -512,26 +512,28 @@ static std::optional<KeyData> toKeyData(SubtleCrypto::KeyFormat format, SubtleCr
case SubtleCrypto::KeyFormat::Spki:
case SubtleCrypto::KeyFormat::Pkcs8:
case SubtleCrypto::KeyFormat::Raw:
return WTF::switchOn(
keyDataVariant,
[&promise](JsonWebKey&) -> std::optional<KeyData> {
promise->reject(Exception { TypeError });
return std::nullopt;
},
[](auto& bufferSource) -> std::optional<KeyData> {
return KeyData { Vector(std::span { static_cast<const uint8_t*>(bufferSource->data()), bufferSource->byteLength() }) };
});
return std::visit(
WTF::makeVisitor(
[&promise](JsonWebKey&) -> std::optional<KeyData> {
promise->reject(Exception { TypeError });
return std::nullopt;
},
[](auto& bufferSource) -> std::optional<KeyData> {
return KeyData { Vector(std::span { static_cast<const uint8_t*>(bufferSource->data()), bufferSource->byteLength() }) };
}),
keyDataVariant);
case SubtleCrypto::KeyFormat::Jwk:
return WTF::switchOn(
keyDataVariant,
[](JsonWebKey& webKey) -> std::optional<KeyData> {
normalizeJsonWebKey(webKey);
return KeyData { webKey };
},
[&promise](auto&) -> std::optional<KeyData> {
promise->reject(Exception { TypeError });
return std::nullopt;
});
return std::visit(
WTF::makeVisitor(
[](JsonWebKey& webKey) -> std::optional<KeyData> {
normalizeJsonWebKey(webKey);
return KeyData { webKey };
},
[&promise](auto&) -> std::optional<KeyData> {
promise->reject(Exception { TypeError });
return std::nullopt;
}),
keyDataVariant);
}
RELEASE_ASSERT_NOT_REACHED();
@@ -815,22 +817,23 @@ void SubtleCrypto::generateKey(JSC::JSGlobalObject& state, AlgorithmIdentifier&&
WeakPtr weakThis { *this };
auto callback = [index, weakThis](KeyOrKeyPair&& keyOrKeyPair) mutable {
if (auto promise = getPromise(index, weakThis)) {
WTF::switchOn(
keyOrKeyPair,
[&promise](RefPtr<CryptoKey>& key) {
if ((key->type() == CryptoKeyType::Private || key->type() == CryptoKeyType::Secret) && !key->usagesBitmap()) {
rejectWithException(promise.releaseNonNull(), SyntaxError, ""_s);
return;
}
promise->resolve<IDLInterface<CryptoKey>>(*key);
},
[&promise](CryptoKeyPair& keyPair) {
if (!keyPair.privateKey->usagesBitmap()) {
rejectWithException(promise.releaseNonNull(), SyntaxError, ""_s);
return;
}
promise->resolve<IDLDictionary<CryptoKeyPair>>(keyPair);
});
std::visit(
WTF::makeVisitor(
[&promise](RefPtr<CryptoKey>& key) {
if ((key->type() == CryptoKeyType::Private || key->type() == CryptoKeyType::Secret) && !key->usagesBitmap()) {
rejectWithException(promise.releaseNonNull(), SyntaxError, ""_s);
return;
}
promise->resolve<IDLInterface<CryptoKey>>(*key);
},
[&promise](CryptoKeyPair& keyPair) {
if (!keyPair.privateKey->usagesBitmap()) {
rejectWithException(promise.releaseNonNull(), SyntaxError, ""_s);
return;
}
promise->resolve<IDLDictionary<CryptoKeyPair>>(keyPair);
}),
keyOrKeyPair);
}
};
auto exceptionCallback = [index, weakThis](ExceptionCode ec, const String& msg) mutable {