[Webkit-unassigned] [Bug 198564] New: [WPE][GTK] Clean up use of initiatingPageID in implementation of webkit_uri_scheme_request_get_web_view()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 5 07:21:57 PDT 2019


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

            Bug ID: 198564
           Summary: [WPE][GTK] Clean up use of initiatingPageID in
                    implementation of
                    webkit_uri_scheme_request_get_web_view()
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at igalia.com
                CC: bugs-noreply at webkitgtk.org

webkit_uri_scheme_request_get_web_view() currently has illegal code to return NULL:

WebKitWebView* webkit_uri_scheme_request_get_web_view(WebKitURISchemeRequest* request)
{
    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), 0);

    // FIXME: initiatingPage is now always null, we need to re-implement this somehow.
    return request->priv->initiatingPage ? webkitWebContextGetWebViewForPage(request->priv->webContext, request->priv->initiatingPage.get()) : nullptr;
}

This is illegal because the return value is not nullable.

Since bug #198485, this code can no longer be reached, because for initiatingPage to be unset, we would have to dereference a disengaged Optional resourceRequest.initiatingPageID() in webkitURISchemeRequestCreate.

But Chris points out that it was probably already unreachable because, prior to bug #198485, the code would have called webPage() with 0, which "would have crashed since it would try and look up 0 in a HashMap whose key type is uint64_t."

So it seems the page ID is guaranteed to be valid at this point, even though the FIXME comment indicates it is never valid. Probably makes sense to replace all this with an ASSERT. I don't plan to investigate this further.

-- 
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/20190605/b5e07b03/attachment.html>


More information about the webkit-unassigned mailing list