Bug 23761 - Use two-arg KURL constructor
Summary: Use two-arg KURL constructor
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-05 08:50 PST by Xan Lopez
Modified: 2009-02-06 01:22 PST (History)
0 users

See Also:


Attachments
Uso two-arg KURL ctor (5.06 KB, patch)
2009-02-05 08:54 PST, Xan Lopez
ap: review+
Details | Formatted Diff | Diff
kurl.patch (5.05 KB, patch)
2009-02-05 14:30 PST, Xan Lopez
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.