Bug 127336

Summary: Add protocolIsInHTTPFamily for strings and use it where appropriate
Product: WebKit Reporter: jochen
Component: New BugsAssignee: jochen
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue, darin, esprehn+autocc, gyuyoung.kim, mkwst
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description jochen 2014-01-21 00:19:39 PST
Add protocolIsInHTTPFamily for strings and use it where appropriate
Comment 1 jochen 2014-01-21 00:20:16 PST
Created attachment 221726 [details]
Patch
Comment 2 Alexey Proskuryakov 2014-01-21 09:54:38 PST
Comment on attachment 221726 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=221726&action=review

> Source/WebCore/platform/URL.cpp:1780
> +    return protocolIs(url, "http") || protocolIs(url, "https");

This function seems like it could be made faster - we check for "http" prefix twice here.
Comment 3 Darin Adler 2014-01-21 18:30:12 PST
Comment on attachment 221726 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=221726&action=review

>> Source/WebCore/platform/URL.cpp:1780
>> +    return protocolIs(url, "http") || protocolIs(url, "https");
> 
> This function seems like it could be made faster - we check for "http" prefix twice here.

I agree that we could make a tighter version.
Comment 4 jochen 2014-01-22 11:14:40 PST
Created attachment 221879 [details]
Patch
Comment 5 jochen 2014-01-22 12:26:54 PST
ptal

I considered changing URL::parse to use this method but it would require constructing a String from the const char* url. Not sure whether that's worth it
Comment 6 WebKit Commit Bot 2014-01-22 14:13:08 PST
Comment on attachment 221879 [details]
Patch

Clearing flags on attachment: 221879

Committed r162555: <http://trac.webkit.org/changeset/162555>
Comment 7 WebKit Commit Bot 2014-01-22 14:13:10 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Darin Adler 2014-01-23 07:45:27 PST
(In reply to comment #5)
> I considered changing URL::parse to use this method but it would require constructing a String from the const char* url. Not sure whether that's worth it

It’s not.