Bug 129606 - [GTK][WK2] ASSERTION FAILED: url == m_string using MiniBrowser (from webkit_web_view_load_uri)
Summary: [GTK][WK2] ASSERTION FAILED: url == m_string using MiniBrowser (from webkit_w...
Status: CLOSED DUPLICATE of bug 130492
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Minor
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-03 06:07 PST by Fabien Vallée
Modified: 2014-04-01 08:23 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabien Vallée 2014-03-03 06:07:02 PST
Using webkit gtk (changeset 164977), built with cmake (default options, i.e. cmake ../.. && make MiniBrowser), Linux x86_64 platform 

Minibrowser crashes due to assert ( ASSERTION FAILED: url == m_string ) in Source/WebCore/platform/URL.cpp WebCore::URL::URL(WebCore::ParsedURLStringTag, const WTF::String&) if the command line url doesnt finish with a slash (/)

e.g.:

./bin/MiniBrowser http://www.google.com   -> ASSERTION FAILED: url == m_string
./bin/MiniBrowser http://www.webkit.org   -> ASSERTION FAILED: url == m_string

./bin/MiniBrowser http://www.google.com/   --> OK
./bin/MiniBrowser http://www.webkit.org/   --> OK


The assert fails because url and m_string are indeed different (url = http:://xxxx and m_string = http://xxx/ ).
The extra / in m_string comes from :

void URL::parse(const char* url, const String* originalString)

    // For canonicalization, ensure we have a '/' for no path.
    // Do this only for URL with protocol file, http or https.
    if ((m_protocolIsInHTTPFamily || isFile) && pathEnd == pathStart) {


GtkLauncher (WK1) create the URL with :
Source/WebKit/gtk/webkit/webkitwebframe.cpp:677
URL(URL(), String::fromUTF8(uri)))
and doesn't ASSERT.

MiniBrowser is using WK2, URL is created in webkit_web_view_load_uri ( WebKit2/UIProcess/API/gtk/WebKitWebView.cpp  )
getPage(webView)->loadRequest(String::fromUTF8(uri));
is creating a ResourceRequest

        ResourceRequest(const String& url)
            : ResourceRequestBase(URL(ParsedURLString, url), UseProtocolCachePolicy)
(from WebCore/platform/network/soup/ResourceRequest.h)

I guess URL(ParsedURLString, url) constructor should not be used here as the url string has not been parsed.
The following patch fixes the issue:

--- /tmp/ZygO6I_WebKitWebView.cpp
+++ /Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
@@ -1996,13 +1996,13 @@
  */
 void webkit_web_view_load_uri(WebKitWebView* webView, const gchar* uri)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     g_return_if_fail(uri);
 
-    getPage(webView)->loadRequest(String::fromUTF8(uri));
+    getPage(webView)->loadRequest(URL(URL(), String::fromUTF8(uri)));
 }
 

Please let me know if the change make sense or if any extra information is needed. thanks
Comment 1 Mario Sanchez Prada 2014-03-28 08:13:49 PDT
I believe this is the same issue than bug 130492

*** This bug has been marked as a duplicate of bug 130492 ***
Comment 2 Fabien Vallée 2014-04-01 08:23:04 PDT
yes, it's a duplicate and the issue is fixed. thanks a lot!