[Webkit-unassigned] [Bug 275087] New: REGRESSION(274563 at main): [GTK] Broke webkit_web_resource_get_data() on https://register.gitlab.gnome.org/

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 3 17:54:45 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=275087

            Bug ID: 275087
           Summary: REGRESSION(274563 at main): [GTK] Broke
                    webkit_web_resource_get_data() on
                    https://register.gitlab.gnome.org/
           Product: WebKit
           Version: Other
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at redhat.com
                CC: bugs-noreply at webkitgtk.org, Nicole_rosario at apple.com

Moving this from https://gitlab.gnome.org/GNOME/epiphany/-/issues/2366

274563 at main "Generate Serialization for FragmentedSharedBuffer" broke the View Source function in Epiphany when used on https://register.gitlab.gnome.org/. The problem is webkit_web_resource_get_data_finish() returns only a NULL byte.

I found 275540 at main "[GTK] Crash in WebPageProxy::getLoadDecisionForIcon" which was another regression also introduced by 274563 at main. The problem there was fixed by accessing the unsafeBuffer of the IPC::SharedBufferReference rather than accessing its data. The problem with webkit_web_resource_get_data_finish() is the same and can be fixed in the same way (patch below).

I also found 221541 at main "REGRESSION(r257667): [UNIX] Tests http/tests/incremental/split-hex-entities.pl and http/tests/misc/large-js-program.php are crashing" which looks relevant.

The following test patch fixes the regression with webkit_web_resource_get_data(), but I bet there are more similar problems elsewhere. Would be nice to find a way to fix this comprehensively instead of papering over it everywhere SharedBufferReferences are used. The difference is SharedBufferReference::span just fails if the data is non-contiguous whereas SharedBufferReference::unsafeBuffer makes it contiguous.

```
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
index 5b84ec110b8b..5799daff1f14 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
@@ -5728,9 +5728,19 @@ static CompletionHandler<void(T data)> toAPIDataCallbackT(CompletionHandler<void
     };
 }

-auto* toAPIDataCallback = toAPIDataCallbackT<const std::optional<IPC::SharedBufferReference>&>;
+//auto* toAPIDataCallback = toAPIDataCallbackT<const std::optional<IPC::SharedBufferReference>&>;
 auto* toAPIDataSharedBufferCallback = toAPIDataCallbackT<RefPtr<WebCore::SharedBuffer>&&>;

+static CompletionHandler<void(const std::optional<IPC::SharedBufferReference>&)> toAPIDataCallback(CompletionHandler<void(API::Data*)>&& callback)
+{
+    return [callback = WTFMove(callback)] (const std::optional<IPC::SharedBufferReference>& data) mutable {
+        if (auto buffer = data->unsafeBuffer())
+            callback(API::Data::create(buffer->span()).ptr());
+        else
+            callback(nullptr);
+    };
+}
+
 #if ENABLE(MHTML)
 void WebPageProxy::getContentsAsMHTMLData(CompletionHandler<void(API::Data*)>&& callback)
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240604/9b3f08ab/attachment.htm>


More information about the webkit-unassigned mailing list