Bug 23761

Summary: Use two-arg KURL constructor
Product: WebKit Reporter: Xan Lopez <xan.lopez>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Uso two-arg KURL ctor
ap: review+
kurl.patch ap: review+

Description Xan Lopez 2009-02-05 08:50:44 PST
We use the one arg KURL constructor all over WebKit/GTK, but:

- It does not pretend to deal with encodings, so it would fail if we pass anything different than ASCII I think (oops?)
- The single-argument KURL ctors expect their input to already be the output of a previous KURL::parse call, so for the general case (ie, random user input) we need to use the two-arg ctor anyway.
Comment 1 Xan Lopez 2009-02-05 08:54:30 PST
Created attachment 27351 [details]
Uso two-arg KURL ctor
Comment 2 Alexey Proskuryakov 2009-02-05 13:52:59 PST
Comment on attachment 27351 [details]
Uso two-arg KURL ctor

r=me

> -    SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", KURL("about:blank"), url);
> +    SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", KURL(KURL(), "about:blank"), url);

I think that about:blank can be left as is - KURL parsing clearly won't affect it. Not that it matters much.
Comment 3 Darin Adler 2009-02-05 13:59:42 PST
(In reply to comment #2)
> > -    SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", KURL("about:blank"), url);
> > +    SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", KURL(KURL(), "about:blank"), url);
> 
> I think that about:blank can be left as is - KURL parsing clearly won't affect
> it. Not that it matters much.

Or this could use the blankURL() function from KURL.h.
Comment 4 Xan Lopez 2009-02-05 14:30:35 PST
Created attachment 27364 [details]
kurl.patch

Use blankURL() for 'about:blank'. Great suggestion, thanks!
Comment 5 Alexey Proskuryakov 2009-02-06 01:22:19 PST
Committed revision 40715.