Title: [290566] trunk/Source
Revision
290566
Author
[email protected]
Date
2022-02-27 11:44:12 -0800 (Sun, 27 Feb 2022)

Log Message

Simplify SerializedScriptValue construction
https://bugs.webkit.org/show_bug.cgi?id=237241

Reviewed by Darin Adler.

Source/WebCore:

The 2 main factory functions for SerializedScriptValue now share the same code.
I also dropped some SerializedScriptValue API that was no longer useful.
Finally, I simplified factory functions for MessageEvent.

* Modules/indexeddb/IDBValue.cpp:
(WebCore::IDBValue::IDBValue):
* Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::create):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::create):
(WebCore::SerializedScriptValue::toString const):
(WebCore::SerializedScriptValue::toString): Deleted.
* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::wireBytes const):
(WebCore::SerializedScriptValue::SerializedScriptValue):
(WebCore::SerializedScriptValue::adopt): Deleted.
(WebCore::SerializedScriptValue::data const): Deleted.
(WebCore::SerializedScriptValue::toWireBytes const): Deleted.
* dom/BroadcastChannel.cpp:
(WebCore::BroadcastChannel::dispatchMessage):
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::MessageEvent):
(WebCore::MessageEvent::create):
* dom/MessageEvent.h:
* dom/MessagePort.cpp:
(WebCore::MessagePort::dispatchMessages):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
* page/EventSource.cpp:
(WebCore::EventSource::dispatchMessageEvent):
* page/History.cpp:
(WebCore::History::stateObjectAdded):
* testing/Internals.cpp:
(WebCore::Internals::serializeObject const):
(WebCore::Internals::deserializeBuffer const):
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
(WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::postMessage):
* workers/shared/SharedWorkerGlobalScope.cpp:
(WebCore::SharedWorkerGlobalScope::postConnectEvent):

Source/WebKit:

Update code base to reflect SerializedScriptValue API changes.

* Shared/API/APISerializedScriptValue.h:
(API::SerializedScriptValue::createFromWireBytes):
(API::SerializedScriptValue::dataReference const):
(API::SerializedScriptValue::adopt): Deleted.
* Shared/SessionState.cpp:
(WebKit::PageState::encode const):
* Shared/UserData.cpp:
(WebKit::UserData::decode):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptForExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptInExtensionTab):
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::didPostMessage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension):
(WebKit::WebInspectorUIExtensionController::evaluateScriptInExtensionTab):
* WebProcess/UserContent/WebUserContentController.cpp:
* WebProcess/WebCoreSupport/SessionStateConversion.cpp:
(WebKit::toFrameState):
(WebKit::applyFrameState):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScript):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290565 => 290566)


--- trunk/Source/WebCore/ChangeLog	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/ChangeLog	2022-02-27 19:44:12 UTC (rev 290566)
@@ -1,3 +1,53 @@
+2022-02-27  Chris Dumez  <[email protected]>
+
+        Simplify SerializedScriptValue construction
+        https://bugs.webkit.org/show_bug.cgi?id=237241
+
+        Reviewed by Darin Adler.
+
+        The 2 main factory functions for SerializedScriptValue now share the same code.
+        I also dropped some SerializedScriptValue API that was no longer useful.
+        Finally, I simplified factory functions for MessageEvent.
+
+        * Modules/indexeddb/IDBValue.cpp:
+        (WebCore::IDBValue::IDBValue):
+        * Modules/webaudio/AudioWorkletNode.cpp:
+        (WebCore::AudioWorkletNode::create):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::SerializedScriptValue::create):
+        (WebCore::SerializedScriptValue::toString const):
+        (WebCore::SerializedScriptValue::toString): Deleted.
+        * bindings/js/SerializedScriptValue.h:
+        (WebCore::SerializedScriptValue::wireBytes const):
+        (WebCore::SerializedScriptValue::SerializedScriptValue):
+        (WebCore::SerializedScriptValue::adopt): Deleted.
+        (WebCore::SerializedScriptValue::data const): Deleted.
+        (WebCore::SerializedScriptValue::toWireBytes const): Deleted.
+        * dom/BroadcastChannel.cpp:
+        (WebCore::BroadcastChannel::dispatchMessage):
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::MessageEvent):
+        (WebCore::MessageEvent::create):
+        * dom/MessageEvent.h:
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::dispatchMessages):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessage):
+        * page/EventSource.cpp:
+        (WebCore::EventSource::dispatchMessageEvent):
+        * page/History.cpp:
+        (WebCore::History::stateObjectAdded):
+        * testing/Internals.cpp:
+        (WebCore::Internals::serializeObject const):
+        (WebCore::Internals::deserializeBuffer const):
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
+        (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::postMessage):
+        * workers/shared/SharedWorkerGlobalScope.cpp:
+        (WebCore::SharedWorkerGlobalScope::postConnectEvent):
+
 2022-02-27  Tim Nguyen  <[email protected]>
 
         Force -webkit-user-modify used style to readonly for inert nodes

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBValue.cpp (290565 => 290566)


--- trunk/Source/WebCore/Modules/indexeddb/IDBValue.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBValue.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -36,7 +36,7 @@
 }
 
 IDBValue::IDBValue(const SerializedScriptValue& scriptValue)
-    : m_data(ThreadSafeDataBuffer::copyVector(scriptValue.data()))
+    : m_data(ThreadSafeDataBuffer::copyVector(scriptValue.wireBytes()))
     , m_blobURLs(scriptValue.blobURLs())
 {
 }
@@ -47,7 +47,7 @@
 }
 
 IDBValue::IDBValue(const SerializedScriptValue& scriptValue, const Vector<String>& blobURLs, const Vector<String>& blobFilePaths)
-    : m_data(ThreadSafeDataBuffer::copyVector(scriptValue.data()))
+    : m_data(ThreadSafeDataBuffer::copyVector(scriptValue.wireBytes()))
     , m_blobURLs(blobURLs)
     , m_blobFilePaths(blobFilePaths)
 {

Modified: trunk/Source/WebCore/Modules/webaudio/AudioWorkletNode.cpp (290565 => 290566)


--- trunk/Source/WebCore/Modules/webaudio/AudioWorkletNode.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/Modules/webaudio/AudioWorkletNode.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -90,12 +90,9 @@
     {
         auto lock = JSC::JSLockHolder { &globalObject };
         auto* jsOptions = convertDictionaryToJS(globalObject, *JSC::jsCast<JSDOMGlobalObject*>(&globalObject), options);
-        Vector<RefPtr<MessagePort>> ports;
-        auto serializedValue = SerializedScriptValue::create(globalObject, jsOptions, { }, ports, SerializationContext::WorkerPostMessage);
-        if (serializedValue.hasException())
+        serializedOptions = SerializedScriptValue::create(globalObject, jsOptions, SerializationErrorMode::NonThrowing, SerializationContext::WorkerPostMessage);
+        if (!serializedOptions)
             serializedOptions = SerializedScriptValue::nullValue();
-        else
-            serializedOptions = serializedValue.releaseReturnValue();
     }
 
     auto parameterData = WTFMove(options.parameterData);

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (290565 => 290566)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -4102,12 +4102,6 @@
 
 SerializedScriptValue::~SerializedScriptValue() = default;
 
-SerializedScriptValue::SerializedScriptValue(Vector<uint8_t>&& buffer)
-    : m_data(WTFMove(buffer))
-{
-    m_memoryCost = computeMemoryCost();
-}
-
 SerializedScriptValue::SerializedScriptValue(Vector<uint8_t>&& buffer, std::unique_ptr<ArrayBufferContentsArray>&& arrayBufferContentsArray
 #if ENABLE(WEB_RTC)
         , Vector<std::unique_ptr<DetachedRTCDataChannel>>&& detachedRTCDataChannels
@@ -4269,51 +4263,6 @@
     return Exception { TypeError };
 }
 
-RefPtr<SerializedScriptValue> SerializedScriptValue::create(JSGlobalObject& lexicalGlobalObject, JSValue value, SerializationErrorMode throwExceptions)
-{
-    Vector<uint8_t> buffer;
-    Vector<BlobURLHandle> blobHandles;
-    Vector<RefPtr<MessagePort>> dummyMessagePorts;
-    Vector<RefPtr<ImageBitmap>> dummyImageBitmaps;
-#if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)
-    Vector<RefPtr<OffscreenCanvas>> dummyOffscreenCanvases;
-#endif
-#if ENABLE(WEB_RTC)
-    Vector<Ref<RTCDataChannel>> dummyRTCDataChannels;
-#endif
-    Vector<RefPtr<JSC::ArrayBuffer>> dummyArrayBuffers;
-#if ENABLE(WEBASSEMBLY)
-    WasmModuleArray dummyModules;
-    WasmMemoryHandleArray dummyMemoryHandles;
-#endif
-    ArrayBufferContentsArray dummySharedBuffers;
-    auto code = CloneSerializer::serialize(&lexicalGlobalObject, value, dummyMessagePorts, dummyArrayBuffers, dummyImageBitmaps,
-#if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)
-        dummyOffscreenCanvases,
-#endif
-#if ENABLE(WEB_RTC)
-        dummyRTCDataChannels,
-#endif
-#if ENABLE(WEBASSEMBLY)
-        dummyModules,
-        dummyMemoryHandles,
-#endif
-        blobHandles, buffer, SerializationContext::Default, dummySharedBuffers);
-
-#if ENABLE(WEBASSEMBLY)
-    ASSERT_WITH_MESSAGE(dummyModules.isEmpty(), "Wasm::Module serialization is only allowed in the postMessage context");
-    ASSERT_WITH_MESSAGE(dummyMemoryHandles.isEmpty(), "Wasm::Memory serialization is only allowed in the postMessage context");
-#endif
-
-    if (throwExceptions == SerializationErrorMode::Throwing)
-        maybeThrowExceptionIfSerializationFailed(lexicalGlobalObject, code);
-
-    if (code != SerializationReturnCode::SuccessfullyCompleted)
-        return nullptr;
-
-    return adoptRef(*new SerializedScriptValue(WTFMove(buffer), blobHandles, nullptr, nullptr, { }));
-}
-
 static bool containsDuplicates(const Vector<RefPtr<ImageBitmap>>& imageBitmaps)
 {
     HashSet<ImageBitmap*> visited;
@@ -4354,8 +4303,22 @@
 }
 #endif
 
-ExceptionOr<Ref<SerializedScriptValue>> SerializedScriptValue::create(JSGlobalObject& lexicalGlobalObject, JSValue value, Vector<JSC::Strong<JSC::JSObject>>&& transferList, Vector<RefPtr<MessagePort>>& messagePorts, SerializationContext context)
+RefPtr<SerializedScriptValue> SerializedScriptValue::create(JSC::JSGlobalObject& globalObject, JSC::JSValue value, SerializationErrorMode throwExceptions, SerializationContext serializationContext)
 {
+    Vector<RefPtr<MessagePort>> dummyPorts;
+    auto result = create(globalObject, value, { }, dummyPorts, throwExceptions, serializationContext);
+    if (result.hasException())
+        return nullptr;
+    return result.releaseReturnValue();
+}
+
+ExceptionOr<Ref<SerializedScriptValue>> SerializedScriptValue::create(JSGlobalObject& globalObject, JSValue value, Vector<JSC::Strong<JSC::JSObject>>&& transferList, Vector<RefPtr<MessagePort>>& messagePorts, SerializationContext serializationContext)
+{
+    return create(globalObject, value, WTFMove(transferList), messagePorts, SerializationErrorMode::NonThrowing, serializationContext);
+}
+
+ExceptionOr<Ref<SerializedScriptValue>> SerializedScriptValue::create(JSGlobalObject& lexicalGlobalObject, JSValue value, Vector<JSC::Strong<JSC::JSObject>>&& transferList, Vector<RefPtr<MessagePort>>& messagePorts, SerializationErrorMode throwExceptions, SerializationContext context)
+{
     VM& vm = lexicalGlobalObject.vm();
     Vector<RefPtr<JSC::ArrayBuffer>> arrayBuffers;
     Vector<RefPtr<ImageBitmap>> imageBitmaps;
@@ -4443,6 +4406,9 @@
 #endif
         blobHandles, buffer, context, *sharedBuffers);
 
+    if (throwExceptions == SerializationErrorMode::Throwing)
+        maybeThrowExceptionIfSerializationFailed(lexicalGlobalObject, code);
+
     if (code != SerializationReturnCode::SuccessfullyCompleted)
         return exceptionForSerializationFailure(code);
 
@@ -4504,7 +4470,7 @@
     return serializedValue;
 }
 
-String SerializedScriptValue::toString()
+String SerializedScriptValue::toString() const
 {
     return CloneDeserializer::deserializeString(m_data);
 }

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (290565 => 290566)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2022-02-27 19:44:12 UTC (rev 290566)
@@ -71,15 +71,10 @@
 class SerializedScriptValue : public ThreadSafeRefCounted<SerializedScriptValue> {
     WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(SerializedScriptValue);
 public:
-    WEBCORE_EXPORT static RefPtr<SerializedScriptValue> create(JSC::JSGlobalObject&, JSC::JSValue, SerializationErrorMode = SerializationErrorMode::Throwing);
-
     WEBCORE_EXPORT static ExceptionOr<Ref<SerializedScriptValue>> create(JSC::JSGlobalObject&, JSC::JSValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer, Vector<RefPtr<MessagePort>>&, SerializationContext = SerializationContext::Default);
+    WEBCORE_EXPORT static RefPtr<SerializedScriptValue> create(JSC::JSGlobalObject&, JSC::JSValue, SerializationErrorMode = SerializationErrorMode::Throwing, SerializationContext = SerializationContext::Default);
 
     WEBCORE_EXPORT static RefPtr<SerializedScriptValue> create(StringView);
-    static Ref<SerializedScriptValue> adopt(Vector<uint8_t>&& buffer)
-    {
-        return adoptRef(*new SerializedScriptValue(WTFMove(buffer)));
-    }
 
     static Ref<SerializedScriptValue> nullValue();
 
@@ -89,13 +84,12 @@
 
     static uint32_t wireFormatVersion();
 
-    String toString();
+    String toString() const;
 
     // API implementation helpers. These don't expose special behavior for ArrayBuffers or MessagePorts.
     WEBCORE_EXPORT static RefPtr<SerializedScriptValue> create(JSContextRef, JSValueRef, JSValueRef* exception);
     WEBCORE_EXPORT JSValueRef deserialize(JSContextRef, JSValueRef* exception);
 
-    const Vector<uint8_t>& data() const { return m_data; }
     bool hasBlobURLs() const { return !m_blobHandles.isEmpty(); }
 
     Vector<String> blobURLs() const;
@@ -106,7 +100,7 @@
     {
         return adoptRef(*new SerializedScriptValue(WTFMove(data)));
     }
-    const Vector<uint8_t>& toWireBytes() const { return m_data; }
+    const Vector<uint8_t>& wireBytes() const { return m_data; }
 
     template<class Encoder> void encode(Encoder&) const;
     template<class Decoder> static RefPtr<SerializedScriptValue> decode(Decoder&);
@@ -116,10 +110,10 @@
     WEBCORE_EXPORT ~SerializedScriptValue();
 
 private:
-    WEBCORE_EXPORT SerializedScriptValue(Vector<unsigned char>&&);
-    WEBCORE_EXPORT SerializedScriptValue(Vector<unsigned char>&&, std::unique_ptr<ArrayBufferContentsArray>&&
+    static ExceptionOr<Ref<SerializedScriptValue>> create(JSC::JSGlobalObject&, JSC::JSValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer, Vector<RefPtr<MessagePort>>&, SerializationErrorMode, SerializationContext);
+    WEBCORE_EXPORT SerializedScriptValue(Vector<unsigned char>&&, std::unique_ptr<ArrayBufferContentsArray>&& = nullptr
 #if ENABLE(WEB_RTC)
-        , Vector<std::unique_ptr<DetachedRTCDataChannel>>&&
+        , Vector<std::unique_ptr<DetachedRTCDataChannel>>&& = { }
 #endif
         );
 

Modified: trunk/Source/WebCore/dom/BroadcastChannel.cpp (290565 => 290566)


--- trunk/Source/WebCore/dom/BroadcastChannel.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/dom/BroadcastChannel.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -239,7 +239,7 @@
 
     queueTaskKeepingObjectAlive(*this, TaskSource::PostedMessageQueue, [this, message = WTFMove(message)]() mutable {
         if (!m_isClosed && scriptExecutionContext())
-            dispatchEvent(MessageEvent::create({ }, WTFMove(message), scriptExecutionContext()->securityOrigin()->toString()));
+            dispatchEvent(MessageEvent::create(WTFMove(message), scriptExecutionContext()->securityOrigin()->toString()));
     });
 }
 

Modified: trunk/Source/WebCore/dom/MessageEvent.cpp (290565 => 290566)


--- trunk/Source/WebCore/dom/MessageEvent.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/dom/MessageEvent.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -52,8 +52,8 @@
 {
 }
 
-inline MessageEvent::MessageEvent(DataType&& data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports)
-    : Event(eventNames().messageEvent, CanBubble::No, IsCancelable::No)
+inline MessageEvent::MessageEvent(const AtomString& type, DataType&& data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports)
+    : Event(type, CanBubble::No, IsCancelable::No)
     , m_data(WTFMove(data))
     , m_origin(origin)
     , m_lastEventId(lastEventId)
@@ -62,39 +62,16 @@
 {
 }
 
-inline MessageEvent::MessageEvent(const AtomString& type, Ref<SerializedScriptValue>&& data, const String& origin, const String& lastEventId)
-    : Event(type, CanBubble::No, IsCancelable::No)
-    , m_data(WTFMove(data))
-    , m_origin(origin)
-    , m_lastEventId(lastEventId)
+Ref<MessageEvent> MessageEvent::create(const AtomString& type, DataType&& data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports)
 {
+    return adoptRef(*new MessageEvent(type, WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports)));
 }
 
-Ref<MessageEvent> MessageEvent::create(Vector<RefPtr<MessagePort>>&& ports, Ref<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source)
+Ref<MessageEvent> MessageEvent::create(DataType&& data, const String& origin, const String& lastEventId, std::optional<MessageEventSource>&& source, Vector<RefPtr<MessagePort>>&& ports)
 {
-    return adoptRef(*new MessageEvent(WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports)));
+    return create(eventNames().messageEvent, WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports));
 }
 
-Ref<MessageEvent> MessageEvent::create(const AtomString& type, Ref<SerializedScriptValue>&& data, const String& origin, const String& lastEventId)
-{
-    return adoptRef(*new MessageEvent(type, WTFMove(data), origin, lastEventId));
-}
-
-Ref<MessageEvent> MessageEvent::create(const String& data, const String& origin)
-{
-    return adoptRef(*new MessageEvent(data, origin));
-}
-
-Ref<MessageEvent> MessageEvent::create(Ref<Blob>&& data, const String& origin)
-{
-    return adoptRef(*new MessageEvent(WTFMove(data), origin));
-}
-
-Ref<MessageEvent> MessageEvent::create(Ref<ArrayBuffer>&& data, const String& origin)
-{
-    return adoptRef(*new MessageEvent(WTFMove(data), origin));
-}
-
 Ref<MessageEvent> MessageEvent::createForBindings()
 {
     return adoptRef(*new MessageEvent);

Modified: trunk/Source/WebCore/dom/MessageEvent.h (290565 => 290566)


--- trunk/Source/WebCore/dom/MessageEvent.h	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/dom/MessageEvent.h	2022-02-27 19:44:12 UTC (rev 290566)
@@ -48,11 +48,10 @@
 class MessageEvent final : public Event {
     WTF_MAKE_ISO_ALLOCATED(MessageEvent);
 public:
-    static Ref<MessageEvent> create(Vector<RefPtr<MessagePort>>&&, Ref<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, std::optional<MessageEventSource>&& source = std::nullopt);
-    static Ref<MessageEvent> create(const AtomString& type, Ref<SerializedScriptValue>&&, const String& origin, const String& lastEventId);
-    static Ref<MessageEvent> create(const String& data, const String& origin = { });
-    static Ref<MessageEvent> create(Ref<Blob>&& data, const String& origin);
-    static Ref<MessageEvent> create(Ref<ArrayBuffer>&& data, const String& origin = { });
+    struct JSValueTag { };
+    using DataType = std::variant<JSValueTag, Ref<SerializedScriptValue>, String, Ref<Blob>, Ref<ArrayBuffer>>;
+    static Ref<MessageEvent> create(const AtomString& type, DataType&&, const String& origin = { }, const String& lastEventId = { }, std::optional<MessageEventSource>&& = std::nullopt, Vector<RefPtr<MessagePort>>&& = { });
+    static Ref<MessageEvent> create(DataType&&, const String& origin = { }, const String& lastEventId = { }, std::optional<MessageEventSource>&& = std::nullopt, Vector<RefPtr<MessagePort>>&& = { });
     static Ref<MessageEvent> createForBindings();
 
     struct Init : EventInit {
@@ -73,8 +72,6 @@
     const std::optional<MessageEventSource>& source() const { return m_source; }
     const Vector<RefPtr<MessagePort>>& ports() const { return m_ports; }
 
-    struct JSValueTag { };
-    using DataType = std::variant<JSValueTag, Ref<SerializedScriptValue>, String, Ref<Blob>, Ref<ArrayBuffer>>;
     const DataType& data() const { return m_data; }
 
     JSValueInWrappedObject& jsData() { return m_jsData; }
@@ -86,8 +83,7 @@
 private:
     MessageEvent();
     MessageEvent(const AtomString& type, Init&&, IsTrusted);
-    MessageEvent(const AtomString& type, Ref<SerializedScriptValue>&& data, const String& origin, const String& lastEventId);
-    MessageEvent(DataType&&, const String& origin, const String& lastEventId = { }, std::optional<MessageEventSource>&& = std::nullopt, Vector<RefPtr<MessagePort>>&& = { });
+    MessageEvent(const AtomString& type, DataType&&, const String& origin, const String& lastEventId = { }, std::optional<MessageEventSource>&& = std::nullopt, Vector<RefPtr<MessagePort>>&& = { });
 
     EventInterface eventInterface() const final;
 

Modified: trunk/Source/WebCore/dom/MessagePort.cpp (290565 => 290566)


--- trunk/Source/WebCore/dom/MessagePort.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/dom/MessagePort.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -284,7 +284,7 @@
                 return;
             auto ports = MessagePort::entanglePorts(*context, WTFMove(message.transferredPorts));
             // Per specification, each MessagePort object has a task source called the port message queue.
-            queueTaskToDispatchEvent(*this, TaskSource::PostedMessageQueue, MessageEvent::create(WTFMove(ports), message.message.releaseNonNull()));
+            queueTaskToDispatchEvent(*this, TaskSource::PostedMessageQueue, MessageEvent::create(message.message.releaseNonNull(), { }, { }, { }, WTFMove(ports)));
         }
     };
 

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (290565 => 290566)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -963,7 +963,7 @@
         UserGestureIndicator userGestureIndicator(userGestureToForward);
         InspectorInstrumentation::willDispatchPostMessage(frame, postMessageIdentifier);
 
-        auto event = MessageEvent::create(MessagePort::entanglePorts(*document(), WTFMove(message.transferredPorts)), message.message.releaseNonNull(), sourceOrigin, { }, incumbentWindowProxy ? std::make_optional(MessageEventSource(WTFMove(incumbentWindowProxy))) : std::nullopt);
+        auto event = MessageEvent::create(message.message.releaseNonNull(), sourceOrigin, { }, incumbentWindowProxy ? std::make_optional(MessageEventSource(WTFMove(incumbentWindowProxy))) : std::nullopt, MessagePort::entanglePorts(*document(), WTFMove(message.transferredPorts)));
         dispatchEvent(event);
 
         InspectorInstrumentation::didDispatchPostMessage(frame, postMessageIdentifier);

Modified: trunk/Source/WebCore/page/EventSource.cpp (290565 => 290566)


--- trunk/Source/WebCore/page/EventSource.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/page/EventSource.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -431,14 +431,13 @@
 
     auto& name = m_eventName.isEmpty() ? eventNames().messageEvent : m_eventName;
 
+    ASSERT(!m_data.isEmpty());
+
     // Omit the trailing "\n" character.
-    ASSERT(!m_data.isEmpty());
-    unsigned size = m_data.size() - 1;
-    auto data = "" m_data.data(), size });
-    RELEASE_ASSERT(data);
+    String data(m_data.data(), m_data.size() - 1);
     m_data = { };
 
-    dispatchEvent(MessageEvent::create(name, data.releaseNonNull(), m_eventStreamOrigin, m_lastEventId));
+    dispatchEvent(MessageEvent::create(name, WTFMove(data), m_eventStreamOrigin, m_lastEventId));
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/History.cpp (290565 => 290566)


--- trunk/Source/WebCore/page/History.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/page/History.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -239,7 +239,7 @@
 
     Checked<uint64_t> payloadSize = titleSize;
     payloadSize += urlSize;
-    payloadSize += data ? data->data().size() : 0;
+    payloadSize += data ? data->wireBytes().size() : 0;
 
     Checked<uint64_t> newTotalUsage = mainHistory.m_totalStateObjectUsage;
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (290565 => 290566)


--- trunk/Source/WebCore/testing/Internals.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/testing/Internals.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -3841,7 +3841,7 @@
 
 Ref<ArrayBuffer> Internals::serializeObject(const RefPtr<SerializedScriptValue>& value) const
 {
-    auto& bytes = value->data();
+    auto& bytes = value->wireBytes();
     return ArrayBuffer::create(bytes.data(), bytes.size());
 }
 
@@ -3848,7 +3848,7 @@
 Ref<SerializedScriptValue> Internals::deserializeBuffer(ArrayBuffer& buffer) const
 {
     Vector<uint8_t> bytes { static_cast<const uint8_t*>(buffer.data()), buffer.byteLength() };
-    return SerializedScriptValue::adopt(WTFMove(bytes));
+    return SerializedScriptValue::createFromWireBytes(WTFMove(bytes));
 }
 
 bool Internals::isFromCurrentWorld(JSC::JSValue value) const

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (290565 => 290566)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -104,7 +104,7 @@
             return;
 
         auto ports = MessagePort::entanglePorts(context, WTFMove(message.transferredPorts));
-        ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::PostedMessageQueue, MessageEvent::create(WTFMove(ports), message.message.releaseNonNull()));
+        ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::PostedMessageQueue, MessageEvent::create(message.message.releaseNonNull(), { }, { }, std::nullopt, WTFMove(ports)));
     });
 }
 
@@ -124,7 +124,7 @@
         ASSERT_WITH_SECURITY_IMPLICATION(scriptContext.isWorkerGlobalScope());
         auto& context = static_cast<DedicatedWorkerGlobalScope&>(scriptContext);
         auto ports = MessagePort::entanglePorts(scriptContext, WTFMove(message.transferredPorts));
-        context.dispatchEvent(MessageEvent::create(WTFMove(ports), message.message.releaseNonNull()));
+        context.dispatchEvent(MessageEvent::create(message.message.releaseNonNull(), { }, { }, std::nullopt, WTFMove(ports)));
         context.thread().workerObjectProxy().confirmMessageFromWorkerObject(context.hasPendingActivity());
     });
 }

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (290565 => 290566)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -438,7 +438,7 @@
     auto& context = *scriptExecutionContext();
     MessageEventSource source = RefPtr<ServiceWorker> { ServiceWorker::getOrCreate(context, WTFMove(sourceData)) };
 
-    auto messageEvent = MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(message.transferredPorts)), message.message.releaseNonNull(), sourceOrigin, { }, WTFMove(source));
+    auto messageEvent = MessageEvent::create(message.message.releaseNonNull(), sourceOrigin, { }, WTFMove(source), MessagePort::entanglePorts(context, WTFMove(message.transferredPorts)));
     if (m_shouldDeferMessageEvents)
         m_deferredMessageEvents.append(WTFMove(messageEvent));
     else {

Modified: trunk/Source/WebCore/workers/shared/SharedWorkerGlobalScope.cpp (290565 => 290566)


--- trunk/Source/WebCore/workers/shared/SharedWorkerGlobalScope.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebCore/workers/shared/SharedWorkerGlobalScope.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -65,13 +65,11 @@
 void SharedWorkerGlobalScope::postConnectEvent(TransferredMessagePort&& transferredPort, const String& sourceOrigin)
 {
     SCOPE_RELEASE_LOG("postConnectEvent:");
-    auto value = SerializedScriptValue::create(emptyString());
-    ASSERT(value);
     auto ports = MessagePort::entanglePorts(*this, { WTFMove(transferredPort) });
     ASSERT(ports.size() == 1);
     auto port = ports[0];
     ASSERT(port);
-    auto event = MessageEvent::create(WTFMove(ports), value.releaseNonNull(), sourceOrigin, { }, port);
+    auto event = MessageEvent::create(emptyString(), sourceOrigin, { }, port, WTFMove(ports));
     event->initEvent(eventNames().connectEvent, false, false);
 
     dispatchEvent(WTFMove(event));

Modified: trunk/Source/WebKit/ChangeLog (290565 => 290566)


--- trunk/Source/WebKit/ChangeLog	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/ChangeLog	2022-02-27 19:44:12 UTC (rev 290566)
@@ -1,5 +1,41 @@
 2022-02-27  Chris Dumez  <[email protected]>
 
+        Simplify SerializedScriptValue construction
+        https://bugs.webkit.org/show_bug.cgi?id=237241
+
+        Reviewed by Darin Adler.
+
+        Update code base to reflect SerializedScriptValue API changes.
+
+        * Shared/API/APISerializedScriptValue.h:
+        (API::SerializedScriptValue::createFromWireBytes):
+        (API::SerializedScriptValue::dataReference const):
+        (API::SerializedScriptValue::adopt): Deleted.
+        * Shared/SessionState.cpp:
+        (WebKit::PageState::encode const):
+        * Shared/UserData.cpp:
+        (WebKit::UserData::decode):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
+        * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
+        (WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptForExtension):
+        (WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptInExtensionTab):
+        * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+        (WebKit::WebUserContentControllerProxy::didPostMessage):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
+        * WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
+        (WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension):
+        (WebKit::WebInspectorUIExtensionController::evaluateScriptInExtensionTab):
+        * WebProcess/UserContent/WebUserContentController.cpp:
+        * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
+        (WebKit::toFrameState):
+        (WebKit::applyFrameState):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::runJavaScript):
+
+2022-02-27  Chris Dumez  <[email protected]>
+
         Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
         https://bugs.webkit.org/show_bug.cgi?id=237071
         <rdar://problem/89354367>

Modified: trunk/Source/WebKit/Shared/API/APISerializedScriptValue.h (290565 => 290566)


--- trunk/Source/WebKit/Shared/API/APISerializedScriptValue.h	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/Shared/API/APISerializedScriptValue.h	2022-02-27 19:44:12 UTC (rev 290566)
@@ -49,9 +49,9 @@
         return adoptRef(*new SerializedScriptValue(serializedValue.releaseNonNull()));
     }
     
-    static Ref<SerializedScriptValue> adopt(Vector<uint8_t>&& buffer)
+    static Ref<SerializedScriptValue> createFromWireBytes(Vector<uint8_t>&& buffer)
     {
-        return adoptRef(*new SerializedScriptValue(WebCore::SerializedScriptValue::adopt(WTFMove(buffer))));
+        return adoptRef(*new SerializedScriptValue(WebCore::SerializedScriptValue::createFromWireBytes(WTFMove(buffer))));
     }
     
     JSValueRef deserialize(JSContextRef context, JSValueRef* exception)
@@ -64,7 +64,7 @@
     static RefPtr<SerializedScriptValue> createFromNSObject(id);
 #endif
 
-    IPC::DataReference dataReference() const { return m_serializedScriptValue->data(); }
+    IPC::DataReference dataReference() const { return m_serializedScriptValue->wireBytes(); }
 
     WebCore::SerializedScriptValue& internalRepresentation() { return m_serializedScriptValue.get(); }
 

Modified: trunk/Source/WebKit/Shared/SessionState.cpp (290565 => 290566)


--- trunk/Source/WebKit/Shared/SessionState.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/Shared/SessionState.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -183,7 +183,7 @@
     encoder << title << mainFrameState << !!sessionStateObject;
 
     if (sessionStateObject)
-        encoder << sessionStateObject->toWireBytes();
+        encoder << sessionStateObject->wireBytes();
 
     encoder << shouldOpenExternalURLsPolicy;
 }

Modified: trunk/Source/WebKit/Shared/UserData.cpp (290565 => 290566)


--- trunk/Source/WebKit/Shared/UserData.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/Shared/UserData.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -426,7 +426,7 @@
         if (!decoder.decode(dataReference))
             return false;
 
-        result = API::SerializedScriptValue::adopt({ dataReference });
+        result = API::SerializedScriptValue::createFromWireBytes({ dataReference });
         break;
     }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (290565 => 290566)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2022-02-27 19:44:12 UTC (rev 290566)
@@ -1128,7 +1128,7 @@
             break;
         }
 
-        argumentsMap->set(key, serializedValue->internalRepresentation().toWireBytes());
+        argumentsMap->set(key, serializedValue->internalRepresentation().wireBytes());
     }
 
     if (errorMessage && handler) {

Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp (290565 => 290566)


--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -176,7 +176,7 @@
                 return completionHandler({ returnedValue });
             }
 
-            completionHandler({ { API::SerializedScriptValue::adopt(Vector { dataReference.data(), dataReference.size() }).ptr() } });
+            completionHandler({ { API::SerializedScriptValue::createFromWireBytes(Vector { dataReference.data(), dataReference.size() }).ptr() } });
         });
     });
 }
@@ -233,7 +233,7 @@
                 return completionHandler({ returnedValue });
             }
 
-            completionHandler({ { API::SerializedScriptValue::adopt({ dataReference.data(), dataReference.size() }).ptr() } });
+            completionHandler({ { API::SerializedScriptValue::createFromWireBytes({ dataReference.data(), dataReference.size() }).ptr() } });
         });
     });
 }

Modified: trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp (290565 => 290566)


--- trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -340,15 +340,15 @@
         return;
 
     if (!handler->client().supportsAsyncReply()) {
-        handler->client().didPostMessage(*page, WTFMove(frameInfoData), handler->world(),  WebCore::SerializedScriptValue::adopt({ dataReference }));
+        handler->client().didPostMessage(*page, WTFMove(frameInfoData), handler->world(),  WebCore::SerializedScriptValue::createFromWireBytes({ dataReference }));
         reply({ }, { });
         return;
     }
 
-    handler->client().didPostMessageWithAsyncReply(*page, WTFMove(frameInfoData), handler->world(),  WebCore::SerializedScriptValue::adopt({ dataReference }), [reply = WTFMove(reply)](API::SerializedScriptValue* value, const String& errorMessage) mutable {
+    handler->client().didPostMessageWithAsyncReply(*page, WTFMove(frameInfoData), handler->world(),  WebCore::SerializedScriptValue::createFromWireBytes({ dataReference }), [reply = WTFMove(reply)](API::SerializedScriptValue* value, const String& errorMessage) mutable {
         if (errorMessage.isNull()) {
             ASSERT(value);
-            reply({ value->internalRepresentation().toWireBytes() }, { });
+            reply({ value->internalRepresentation().wireBytes() }, { });
             return;
         }
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (290565 => 290566)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -4399,7 +4399,7 @@
             return callbackFunction(makeUnexpected(WTFMove(*details)));
         if (dataReference.empty())
             return callbackFunction({ nullptr });
-        callbackFunction({ API::SerializedScriptValue::adopt(Vector(dataReference)).ptr() });
+        callbackFunction({ API::SerializedScriptValue::createFromWireBytes(Vector(dataReference)).ptr() });
     });
 }
 

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp (290565 => 290566)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -287,7 +287,7 @@
             return;
         }
 
-        completionHandler(serializedResultValue->data(), std::nullopt, std::nullopt);
+        completionHandler(serializedResultValue->wireBytes(), std::nullopt, std::nullopt);
     });
 }
 
@@ -438,7 +438,7 @@
             return;
         }
 
-        completionHandler(serializedResultValue->data(), std::nullopt, std::nullopt);
+        completionHandler(serializedResultValue->wireBytes(), std::nullopt, std::nullopt);
     });
 }
 

Modified: trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp (290565 => 290566)


--- trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -278,7 +278,7 @@
             completionHandler(value.ptr(), { });
         };
 
-        WebProcess::singleton().parentProcessConnection()->sendWithAsyncReply(Messages::WebUserContentControllerProxy::DidPostMessage(webPage->webPageProxyIdentifier(), webFrame->info(), m_identifier, IPC::DataReference(value->data())), WTFMove(messageReplyHandler), m_controller->identifier());
+        WebProcess::singleton().parentProcessConnection()->sendWithAsyncReply(Messages::WebUserContentControllerProxy::DidPostMessage(webPage->webPageProxyIdentifier(), webFrame->info(), m_identifier, IPC::DataReference(value->wireBytes())), WTFMove(messageReplyHandler), m_controller->identifier());
     }
 
     RefPtr<WebUserContentController> m_controller;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp (290565 => 290566)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -74,7 +74,7 @@
 
     frameState.setDocumentState(historyItem.documentState());
     if (RefPtr<SerializedScriptValue> stateObject = historyItem.stateObject())
-        frameState.stateObjectData = stateObject->data();
+        frameState.stateObjectData = stateObject->wireBytes();
 
     frameState.documentSequenceNumber = historyItem.documentSequenceNumber();
     frameState.itemSequenceNumber = historyItem.itemSequenceNumber();
@@ -151,7 +151,7 @@
 
     if (frameState.stateObjectData) {
         Vector<uint8_t> stateObjectData = frameState.stateObjectData.value();
-        historyItem.setStateObject(SerializedScriptValue::adopt(WTFMove(stateObjectData)));
+        historyItem.setStateObject(SerializedScriptValue::createFromWireBytes(WTFMove(stateObjectData)));
     }
 
     historyItem.setDocumentSequenceNumber(frameState.documentSequenceNumber);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (290565 => 290566)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2022-02-27 17:54:16 UTC (rev 290565)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2022-02-27 19:44:12 UTC (rev 290566)
@@ -3771,7 +3771,7 @@
 
         IPC::DataReference dataReference;
         if (serializedResultValue)
-            dataReference = serializedResultValue->data();
+            dataReference = serializedResultValue->wireBytes();
 
         std::optional<ExceptionDetails> details;
         if (!result)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to