Changeset 212470 in webkit


Ignore:
Timestamp:
Feb 16, 2017 3:13:45 PM (7 years ago)
Author:
achristensen@apple.com
Message:

Special URLs without a host are invalid
https://bugs.webkit.org/show_bug.cgi?id=168461

Reviewed by Tim Horton.

LayoutTests/imported/w3c:

  • web-platform-tests/url/a-element-expected.txt:
  • web-platform-tests/url/a-element-xhtml-expected.txt:
  • web-platform-tests/url/url-constructor-expected.txt:

Source/WebCore:

http://? should be invalid. This matches Chrome and the spec and the intent of my implementation
of URLParser which already fails with urls like http:// and this was just an oversight.
Covered by newly passing web platform tests. Updated API tests.

  • platform/URLParser.cpp:

(WebCore::URLParser::parse):

Tools:

  • TestWebKitAPI/Tests/WebCore/URLParser.cpp:

(TestWebKitAPI::TEST_F):

LayoutTests:

  • fast/dom/DOMURL/set-href-attribute-protocol.html:
  • fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js:

Rebase tests. The HTMLAnchorElement test is a little strange, but it'll be cleaned up once
url-setters.html in the web platform tests is cleaned up.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r212467 r212470  
     12017-02-16  Alex Christensen  <achristensen@webkit.org>
     2
     3        Special URLs without a host are invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=168461
     5
     6        Reviewed by Tim Horton.
     7
     8        * fast/dom/DOMURL/set-href-attribute-protocol.html:
     9        * fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js:
     10        Rebase tests.  The HTMLAnchorElement test is a little strange, but it'll be cleaned up once
     11        url-setters.html in the web platform tests is cleaned up.
     12
    1132017-02-16  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html

    r207162 r212470  
    7373a.href = "foo:??bar";
    7474a.protocol = "http";
    75 shouldBe("a.href", "'http://??bar'");
     75shouldBe("a.href", "'foo:??bar'");
    7676
    7777// IE8 keeps the protocol if it is 'c:'.
  • trunk/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.js

    r207162 r212470  
    6464a.href = "foo:??bar";
    6565a.protocol = "http";
    66 shouldBe("a.href", "'http://??bar'");
     66shouldBe("a.href", "'http:??bar'");
    6767
    6868// IE8 keeps the protocol if it is 'c:'.
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r212449 r212470  
     12017-02-16  Alex Christensen  <achristensen@webkit.org>
     2
     3        Special URLs without a host are invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=168461
     5
     6        Reviewed by Tim Horton.
     7
     8        * web-platform-tests/url/a-element-expected.txt:
     9        * web-platform-tests/url/a-element-xhtml-expected.txt:
     10        * web-platform-tests/url/url-constructor-expected.txt:
     11
    1122017-02-16  Joseph Pecoraro  <pecoraro@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt

    r212279 r212470  
    395395PASS Parsing: <file:#frag> against <about:blank>
    396396PASS Parsing: <http://[1:0::]> against <http://example.net/>
    397 FAIL Parsing: <http://?> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
    398 FAIL Parsing: <http://#> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
     397PASS Parsing: <http://?> against <about:blank>
     398PASS Parsing: <http://#> against <about:blank>
    399399PASS Parsing: <sc://ñ> against <about:blank>
    400400PASS Parsing: <sc://ñ?x> against <about:blank>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt

    r212279 r212470  
    395395PASS Parsing: <file:#frag> against <about:blank>
    396396PASS Parsing: <http://[1:0::]> against <http://example.net/>
    397 FAIL Parsing: <http://?> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
    398 FAIL Parsing: <http://#> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
     397PASS Parsing: <http://?> against <about:blank>
     398PASS Parsing: <http://#> against <about:blank>
    399399PASS Parsing: <sc://ñ> against <about:blank>
    400400PASS Parsing: <sc://ñ?x> against <about:blank>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt

    r212279 r212470  
    403403PASS Parsing: <file:#frag> against <about:blank>
    404404PASS Parsing: <http://[1:0::]> against <http://example.net/>
    405 FAIL Parsing: <http://?> against <about:blank> assert_throws: function "function () {
    406           bURL(expected.input, expected.base)
    407         }" did not throw
    408 FAIL Parsing: <http://#> against <about:blank> assert_throws: function "function () {
    409           bURL(expected.input, expected.base)
    410         }" did not throw
     405PASS Parsing: <http://?> against <about:blank>
     406PASS Parsing: <http://#> against <about:blank>
    411407PASS Parsing: <sc://ñ> against <about:blank>
    412408PASS Parsing: <sc://ñ?x> against <about:blank>
  • trunk/Source/WebCore/ChangeLog

    r212468 r212470  
     12017-02-16  Alex Christensen  <achristensen@webkit.org>
     2
     3        Special URLs without a host are invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=168461
     5
     6        Reviewed by Tim Horton.
     7
     8        http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
     9        of URLParser which already fails with urls like http:// and this was just an oversight.
     10        Covered by newly passing web platform tests.  Updated API tests.
     11
     12        * platform/URLParser.cpp:
     13        (WebCore::URLParser::parse):
     14
    1152017-02-16  Zalan Bujtas  <zalan@apple.com>
    216
  • trunk/Source/WebCore/platform/URLParser.cpp

    r212279 r212470  
    14501450                    auto iterator = CodePointIterator<CharacterType>(authorityOrHostBegin, c);
    14511451                    if (iterator.atEnd()) {
     1452                        if (m_urlIsSpecial)
     1453                            return failure();
    14521454                        m_url.m_userEnd = currentPosition(c);
    14531455                        m_url.m_passwordEnd = m_url.m_userEnd;
  • trunk/Tools/ChangeLog

    r212466 r212470  
     12017-02-16  Alex Christensen  <achristensen@webkit.org>
     2
     3        Special URLs without a host are invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=168461
     5
     6        Reviewed by Tim Horton.
     7
     8        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
     9        (TestWebKitAPI::TEST_F):
     10
    1112017-02-10  Filip Pizlo  <fpizlo@apple.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp

    r212279 r212470  
    920920        {"http", "", "", "", 0, "/", "", "", "http://:/"});
    921921    checkURLDifferences("http:##foo",
    922         {"http", "", "", "", 0, "", "", "#foo", "http://##foo"},
     922        {"", "", "", "", 0, "", "", "", "http:##foo"},
    923923        {"http", "", "", "", 0, "/", "", "#foo", "http:/##foo"});
    924924    checkURLDifferences("http:??bar",
    925         {"http", "", "", "", 0, "", "?bar", "", "http://??bar"},
     925        {"", "", "", "", 0, "", "", "", "http:??bar"},
    926926        {"http", "", "", "", 0, "/", "?bar", "", "http:/??bar"});
     927    checkURL("asdf:##foo", {"asdf", "", "", "", 0, "", "", "#foo", "asdf:##foo"});
     928    checkURL("asdf:??bar", {"asdf", "", "", "", 0, "", "?bar", "", "asdf:??bar"});
    927929    checkRelativeURLDifferences("//C|/foo/bar", "file:///tmp/mock/path",
    928930        {"file", "", "", "", 0, "/C:/foo/bar", "", "", "file:///C:/foo/bar"},
Note: See TracChangeset for help on using the changeset viewer.