Changeset 268479 in webkit


Ignore:
Timestamp:
Oct 14, 2020 1:00:44 PM (4 years ago)
Author:
achristensen@apple.com
Message:

Disallow ports in file URLs
https://bugs.webkit.org/show_bug.cgi?id=217252

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

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

Source/WTF:

This matches Chrome and the URL specification.
Covered by newly passing web platform tests.

  • wtf/URLParser.cpp:

(WTF::URLParser::parsePort):

Tools:

  • TestWebKitAPI/Tests/WTF/URLParser.cpp:

(TestWebKitAPI::TEST_F):

LayoutTests:

  • fast/loader/file-URL-with-port-number-expected.txt:
  • fast/loader/file-URL-with-port-number.html:

Update test to reflect this new behavior. The test was added in r24484 and
based on discussion in https://github.com/whatwg/url/issues/548 I've decided to try it and see if we can make this change.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r268476 r268479  
     12020-10-14  Alex Christensen  <achristensen@webkit.org>
     2
     3        Disallow ports in file URLs
     4        https://bugs.webkit.org/show_bug.cgi?id=217252
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/loader/file-URL-with-port-number-expected.txt:
     9        * fast/loader/file-URL-with-port-number.html:
     10        Update test to reflect this new behavior.  The test was added in r24484 and
     11        based on discussion in https://github.com/whatwg/url/issues/548 I've decided to try it and see if we can make this change.
     12
    1132020-10-13  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/LayoutTests/fast/loader/file-URL-with-port-number-expected.txt

    r24484 r268479  
    11This tests whether we can load a file URL with a port number in the URL. It should be ignored, and so the load should succeed.
    22
    3 SUCCESS: The subframe loaded.
     3PASS: The subframe did not load.
    44
    55
  • trunk/LayoutTests/fast/loader/file-URL-with-port-number.html

    r207162 r268479  
    11<head>
    22<script>
     3
     4function finishTest()
     5{
     6    if (window.testRunner)
     7        testRunner.notifyDone();
     8}
     9
    310function subframeLoaded()
    411{
    5     document.getElementById("result").appendChild(document.createTextNode("SUCCESS: The subframe loaded."));
    6     if (window.testRunner)
    7         testRunner.notifyDone();
     12    document.getElementById("result").appendChild(document.createTextNode("FAIL: The subframe loaded."));
     13    finishTest();
     14}
     15
     16function subframeError()
     17{
     18    document.getElementById("result").appendChild(document.createTextNode("FAIL: The subframe onerror was called."));
     19    finishTest();
     20}
     21
     22function subframeDidNotLoad()
     23{
     24    document.getElementById("result").appendChild(document.createTextNode("PASS: The subframe did not load."));
     25    finishTest();
    826}
    927
     
    2038    var subframe = document.getElementById("subframe");
    2139    subframe.onload = subframeLoaded;
     40    subframe.onerror = subframeError;
    2241    subframe.contentWindow.location = subframeLocation;
     42    setTimeout(subframeDidNotLoad, 100);
    2343}
    2444
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r268477 r268479  
     12020-10-14  Alex Christensen  <achristensen@webkit.org>
     2
     3        Disallow ports in file URLs
     4        https://bugs.webkit.org/show_bug.cgi?id=217252
     5
     6        Reviewed by Darin Adler.
     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/failure-expected.txt:
     11        * web-platform-tests/url/url-constructor-expected.txt:
     12        * web-platform-tests/url/url-setters-expected.txt:
     13
    1142020-10-14  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt

    r267965 r268479  
    8181PASS Parsing: <madeupscheme:/example.com/> against <http://example.org/foo/bar>
    8282PASS Parsing: <file:/example.com/> against <http://example.org/foo/bar>
    83 FAIL Parsing: <file://example:1/> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
     83PASS Parsing: <file://example:1/> against <about:blank>
    8484PASS Parsing: <file://example:test/> against <about:blank>
    8585PASS Parsing: <file://example%/> against <about:blank>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt

    r267965 r268479  
    8181PASS Parsing: <madeupscheme:/example.com/> against <http://example.org/foo/bar>
    8282PASS Parsing: <file:/example.com/> against <http://example.org/foo/bar>
    83 FAIL Parsing: <file://example:1/> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code
     83PASS Parsing: <file://example:1/> against <about:blank>
    8484PASS Parsing: <file://example:test/> against <about:blank>
    8585PASS Parsing: <file://example%/> against <about:blank>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/failure-expected.txt

    r267965 r268479  
    1 CONSOLE MESSAGE: Not allowed to load local resource: example:1
    21Blocked access to external URL http://./Y:
    32CONSOLE MESSAGE: Beacon API cannot load http://./Y: due to access control checks.
     
    65
    76PASS Loading data…
    8 FAIL URL's constructor's base argument: file://example:1/ should throw assert_throws_js: function "() => new URL("about:blank", test.input)" did not throw
    9 FAIL URL's href: file://example:1/ should throw assert_throws_js: function "() => url.href = test.input" did not throw
    10 FAIL XHR: file://example:1/ should throw assert_throws_dom: function "() => client.open("GET", test.input)" did not throw
     7PASS URL's constructor's base argument: file://example:1/ should throw
     8PASS URL's href: file://example:1/ should throw
     9PASS XHR: file://example:1/ should throw
    1110PASS sendBeacon(): file://example:1/ should throw
    1211FAIL Location's href: file://example:1/ should throw assert_throws_js: function "() => self[0].location = test.input" did not throw
    13 FAIL window.open(): file://example:1/ should throw assert_throws_dom: function "() => self.open(test.input).close()" did not throw
     12PASS window.open(): file://example:1/ should throw
    1413PASS URL's constructor's base argument: file://example:test/ should throw
    1514PASS URL's href: file://example:test/ should throw
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt

    r267965 r268479  
    8080PASS Parsing: <madeupscheme:/example.com/> against <http://example.org/foo/bar>
    8181PASS Parsing: <file:/example.com/> against <http://example.org/foo/bar>
    82 FAIL Parsing: <file://example:1/> against <about:blank> assert_throws_js: function "function () {
    83           bURL(expected.input, expected.base)
    84         }" did not throw
     82PASS Parsing: <file://example:1/> against <about:blank>
    8583PASS Parsing: <file://example:test/> against <about:blank>
    8684PASS Parsing: <file://example%/> against <about:blank>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt

    r268050 r268479  
    307307PASS <a>: Setting <http://example.net/>.host = '[::1.]'
    308308PASS <area>: Setting <http://example.net/>.host = '[::1.]'
    309 FAIL URL: Setting <file://y/>.host = 'x:123' assert_equals: expected "file://y/" but got "file://x:123/"
    310 FAIL <a>: Setting <file://y/>.host = 'x:123' assert_equals: expected "file://y/" but got "file://x:123/"
    311 FAIL <area>: Setting <file://y/>.host = 'x:123' assert_equals: expected "file://y/" but got "file://x:123/"
     309PASS URL: Setting <file://y/>.host = 'x:123'
     310PASS <a>: Setting <file://y/>.host = 'x:123'
     311PASS <area>: Setting <file://y/>.host = 'x:123'
    312312PASS URL: Setting <file://y/>.host = 'loc%41lhost'
    313313PASS <a>: Setting <file://y/>.host = 'loc%41lhost'
  • trunk/Source/WTF/ChangeLog

    r268476 r268479  
     12020-10-14  Alex Christensen  <achristensen@webkit.org>
     2
     3        Disallow ports in file URLs
     4        https://bugs.webkit.org/show_bug.cgi?id=217252
     5
     6        Reviewed by Darin Adler.
     7
     8        This matches Chrome and the URL specification.
     9        Covered by newly passing web platform tests.
     10
     11        * wtf/URLParser.cpp:
     12        (WTF::URLParser::parsePort):
     13
    1142020-10-13  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/Source/WTF/wtf/URLParser.cpp

    r268362 r268479  
    25752575bool URLParser::parsePort(CodePointIterator<CharacterType>& iterator)
    25762576{
     2577    if (UNLIKELY(m_urlIsFile))
     2578        return false;
     2579
    25772580    ASSERT(*iterator == ':');
    25782581    auto colonIterator = iterator;
  • trunk/Tools/ChangeLog

    r268478 r268479  
     12020-10-14  Alex Christensen  <achristensen@webkit.org>
     2
     3        Disallow ports in file URLs
     4        https://bugs.webkit.org/show_bug.cgi?id=217252
     5
     6        Reviewed by Darin Adler.
     7
     8        * TestWebKitAPI/Tests/WTF/URLParser.cpp:
     9        (TestWebKitAPI::TEST_F):
     10
    1112020-10-14  Alexey Shvayka  <shvaikalesh@gmail.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp

    r267963 r268479  
    11931193    checkURL("unknown://host:81", {"unknown", "", "", "host", 81, "", "", "", "unknown://host:81"});
    11941194
    1195     checkURL("file://host:0", {"file", "", "", "host", 0, "/", "", "", "file://host:0/"});
    1196     checkURL("file://host:80", {"file", "", "", "host", 80, "/", "", "", "file://host:80/"});
    1197     checkURL("file://host:80/path", {"file", "", "", "host", 80, "/path", "", "", "file://host:80/path"});
    1198     checkURLDifferences("file://:80/path",
    1199         {"", "", "", "", 0, "", "", "", "file://:80/path"},
    1200         {"file", "", "", "", 80, "/path", "", "", "file://:80/path"});
    1201     checkURLDifferences("file://:0/path",
    1202         {"", "", "", "", 0, "", "", "", "file://:0/path"},
    1203         {"file", "", "", "", 0, "/path", "", "", "file://:0/path"});
     1195    checkURL("file://host/", {"file", "", "", "host", 0, "/", "", "", "file://host/"});
     1196    checkURL("file://host:", {"", "", "", "", 0, "", "", "", "file://host:"});
     1197    checkURL("file://host:0", {"", "", "", "", 0, "", "", "", "file://host:0"});
     1198    checkURL("file://host:80", {"", "", "", "", 0, "", "", "", "file://host:80"});
     1199    checkURL("file://host:80/path", {"", "", "", "", 0, "", "", "", "file://host:80/path"});
     1200    checkURL("file://:80/path", {"", "", "", "", 0, "", "", "", "file://:80/path"});
     1201    checkURL("file://:0/path", {"", "", "", "", 0, "", "", "", "file://:0/path"});
    12041202   
    12051203    checkURL("http://example.com:0000000000000077", {"http", "", "", "example.com", 77, "/", "", "", "http://example.com:77/"});
Note: See TracChangeset for help on using the changeset viewer.