Changeset 235631 in webkit


Ignore:
Timestamp:
Sep 4, 2018, 1:37:29 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Adjust XMLHttpRequest username/password precedence rules
https://bugs.webkit.org/show_bug.cgi?id=184910

Patch by Rob Buis <rbuis@igalia.com> on 2018-09-04
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Update test result.

  • web-platform-tests/xhr/send-authentication-competing-names-passwords-expected.txt:

Source/WebCore:

Steps 9.1 and 9.2 in the XMLHTTPRequest::open [1] algorithm
specify that non null user or non null password ought
to be set on the URL, so implement this.

Behavior matches Firefox and Chrome.

[1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-open

Test: xhr/send-authentication-competing-names-passwords.htm

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::open):

LayoutTests:

Adjust test because now we do set password on the url in
open(), even if the username is null.

  • http/tests/xmlhttprequest/basic-auth.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r235626 r235631  
     12018-09-04  Rob Buis  <rbuis@igalia.com>
     2
     3        Adjust XMLHttpRequest username/password precedence rules
     4        https://bugs.webkit.org/show_bug.cgi?id=184910
     5
     6        Reviewed by Chris Dumez.
     7
     8        Adjust test because now we do set password on the url in
     9        open(), even if the username is null.
     10
     11        * http/tests/xmlhttprequest/basic-auth.html:
     12
    1132018-09-03  Dean Jackson  <dino@apple.com>
    214
  • trunk/LayoutTests/http/tests/xmlhttprequest/basic-auth.html

    r120167 r235631  
    5050    sendAndLogResponse("sync6", req);
    5151
    52     req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync7").replace("http://", "http://sync7:123@"), false, undefined, "incorrect");
     52    req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=sync7").replace("http://", "http://sync7:incorrect@"), false, undefined, "123");
    5353    sendAndLogResponse("sync7", req);
    5454
     
    9898            log('async6: ' + req.responseText);
    9999            req.onreadystatechange = processStateChange;
    100             req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=async7").replace("http://", "http://async7:123@"), true, undefined, "incorrect");
     100            req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth/basic-auth.php?uid=async7").replace("http://", "http://async7:incorrect@"), true, undefined, "123");
    101101            req.send("");
    102102          } else if (asyncStep == 7) {
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r235625 r235631  
     12018-09-04  Rob Buis  <rbuis@igalia.com>
     2
     3        Adjust XMLHttpRequest username/password precedence rules
     4        https://bugs.webkit.org/show_bug.cgi?id=184910
     5
     6        Reviewed by Chris Dumez.
     7
     8        Update test result.
     9
     10        * web-platform-tests/xhr/send-authentication-competing-names-passwords-expected.txt:
     11
    1122018-09-04  Andy Estes  <aestes@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/send-authentication-competing-names-passwords-expected.txt

    r235354 r235631  
    66PASS XMLHttpRequest user/pass options: pass in URL, user/pass in open()
    77PASS XMLHttpRequest user/pass options: user in URL
    8 FAIL XMLHttpRequest user/pass options: user in URL, pass in open() assert_equals: responseText should contain the right user and password expected "a89b5bdc-8844-4e0c-8b67-bccb90cc5006\n8ae16e77-30e0-4758-8c85-ddbac8ff9923" but got "a89b5bdc-8844-4e0c-8b67-bccb90cc5006\n"
     8PASS XMLHttpRequest user/pass options: user in URL, pass in open()
    99PASS XMLHttpRequest user/pass options: user/pass in URL
    1010PASS XMLHttpRequest user/pass options: user in URL and open()
    1111PASS XMLHttpRequest user/pass options: user in URL; user/pass in open()
    1212PASS XMLHttpRequest user/pass options: user/pass in URL; user in open()
    13 FAIL XMLHttpRequest user/pass options: user/pass in URL; pass in open() assert_equals: responseText should contain the right user and password expected "7add18d7-4945-4a7c-b1d3-e50eff2f65c8\nbce2a8d7-ce76-48be-8c8f-ff29647b78ff" but got "7add18d7-4945-4a7c-b1d3-e50eff2f65c8\nbcf673a4-b893-48cd-95ec-3bd4c0d72a84"
     13PASS XMLHttpRequest user/pass options: user/pass in URL; pass in open()
    1414PASS XMLHttpRequest user/pass options: user/pass in URL and open()
    1515
  • trunk/Source/WebCore/ChangeLog

    r235630 r235631  
     12018-09-04  Rob Buis  <rbuis@igalia.com>
     2
     3        Adjust XMLHttpRequest username/password precedence rules
     4        https://bugs.webkit.org/show_bug.cgi?id=184910
     5
     6        Reviewed by Chris Dumez.
     7
     8        Steps 9.1 and 9.2 in the XMLHTTPRequest::open [1] algorithm
     9        specify that non null user or non null password ought
     10        to be set on the URL, so implement this.
     11
     12        Behavior matches Firefox and Chrome.
     13
     14        [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-open
     15
     16        Test: xhr/send-authentication-competing-names-passwords.htm
     17
     18        * xml/XMLHttpRequest.cpp:
     19        (WebCore::XMLHttpRequest::open):
     20
    1212018-09-04  Simon Fraser  <simon.fraser@apple.com>
    222
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r235360 r235631  
    390390{
    391391    URL urlWithCredentials = scriptExecutionContext()->completeURL(url);
    392     if (!user.isNull()) {
     392    if (!user.isNull())
    393393        urlWithCredentials.setUser(user);
    394         if (!password.isNull())
    395             urlWithCredentials.setPass(password);
    396     }
     394    if (!password.isNull())
     395        urlWithCredentials.setPass(password);
    397396
    398397    return open(method, urlWithCredentials, async);
Note: See TracChangeset for help on using the changeset viewer.