<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>129606</bug_id>
          
          <creation_ts>2014-03-03 06:07:02 -0800</creation_ts>
          <short_desc>[GTK][WK2] ASSERTION FAILED: url == m_string using MiniBrowser (from webkit_web_view_load_uri)</short_desc>
          <delta_ts>2014-04-01 08:23:04 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>130492</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Fabien Vallée">fvallee</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cgarcia</cc>
    
    <cc>gustavo</cc>
    
    <cc>mario</cc>
    
    <cc>mrobinson</cc>
    
    <cc>zan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>986328</commentid>
    <comment_count>0</comment_count>
    <who name="Fabien Vallée">fvallee</who>
    <bug_when>2014-03-03 06:07:02 -0800</bug_when>
    <thetext>Using webkit gtk (changeset 164977), built with cmake (default options, i.e. cmake ../.. &amp;&amp; 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&amp;) if the command line url doesnt finish with a slash (/)

e.g.:

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

./bin/MiniBrowser http://www.google.com/   --&gt; OK
./bin/MiniBrowser http://www.webkit.org/   --&gt; 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 &apos;/&apos; for no path.
    // Do this only for URL with protocol file, http or https.
    if ((m_protocolIsInHTTPFamily || isFile) &amp;&amp; pathEnd == pathStart) {


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

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

        ResourceRequest(const String&amp; 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)-&gt;loadRequest(String::fromUTF8(uri));
+    getPage(webView)-&gt;loadRequest(URL(URL(), String::fromUTF8(uri)));
 }
 

Please let me know if the change make sense or if any extra information is needed. thanks</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>995326</commentid>
    <comment_count>1</comment_count>
    <who name="Mario Sanchez Prada">mario</who>
    <bug_when>2014-03-28 08:13:49 -0700</bug_when>
    <thetext>I believe this is the same issue than bug 130492

*** This bug has been marked as a duplicate of bug 130492 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>996278</commentid>
    <comment_count>2</comment_count>
    <who name="Fabien Vallée">fvallee</who>
    <bug_when>2014-04-01 08:23:04 -0700</bug_when>
    <thetext>yes, it&apos;s a duplicate and the issue is fixed. thanks a lot!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>