Bug 162836 - URLParser should ignore tabs at all locations
Summary: URLParser should ignore tabs at all locations
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-30 20:23 PDT by Alex Christensen
Modified: 2016-10-03 15:59 PDT (History)
1 user (show)

See Also:


Attachments
Patch (15.89 KB, patch)
2016-09-30 20:25 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2016-09-30 20:23:31 PDT
URLParser should ignore tabs at all locations
Comment 1 Alex Christensen 2016-09-30 20:25:42 PDT
Created attachment 290421 [details]
Patch
Comment 2 Alex Christensen 2016-10-03 14:31:07 PDT
Comment on attachment 290421 [details]
Patch

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

Geoff said "r=me"

> Source/WebCore/ChangeLog:3
> +        URLParser should ignore tabs at all locations

s/ignore/strip/

> Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp:72
> +enum class CheckTabs { No, Yes };

enum class TestTabs?

> Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp:73
> +const CheckTabs containsEncodedSurrogatePairs = CheckTabs::No;

Maybe "checkTabsValueForSurrogatePairs"? And then a comment here that says we can't auto-insert tabs because they would ruin the encoding.

> Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp:455
> +    if (checkTabs == CheckTabs::Yes) {
> +        for (size_t i = 0; i < urlString.length(); ++i) {
> +            String urlStringWithTab = makeString(urlString.substring(0, i), "\t", urlString.substring(i));
> +            ExpectedParts invalidPartsWithTab = {"", "", "", "", 0, "" , "", "", urlStringWithTab};
> +            checkURLDifferences(urlStringWithTab, partsNew.isInvalid() ? invalidPartsWithTab : partsNew, partsOld.isInvalid() ? invalidPartsWithTab : partsOld, CheckTabs::No);
> +        }
> +    }

Maybe some helper function action for tab checking?
Comment 3 Alex Christensen 2016-10-03 15:41:42 PDT
I'm also going to remove the incorrect tests for "http://123\t.256/" and "http://123.\t256/" canonicalizing to "http://123.256/".  Those tests were verifying incorrect behavior that this patch fixed.  There is already a test that canonicalizes it correctly to "http://123.0.1.0/" in the new URLParser.
Comment 4 Alex Christensen 2016-10-03 15:58:27 PDT
http://trac.webkit.org/changeset/206758