Changeset 204172 in webkit


Ignore:
Timestamp:
Aug 5, 2016 9:26:04 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

[Fetch API] SubresourceLoader::checkRedirectionCrossOriginAccessControl should not always assert in SameOrigin mode
https://bugs.webkit.org/show_bug.cgi?id=160594

Patch by Youenn Fablet <youenn@apple.com> on 2016-08-05
Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

  • web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt:
  • web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt:
  • web-platform-tests/fetch/api/basic/mode-same-origin.js: Adding redirection tests for same origin mode.

Source/WebCore:

Covered by rebased tests.

  • loader/SubresourceLoader.cpp:

(WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
It should not throw is mode is SameOrigin and resource is same origin.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r204171 r204172  
     12016-08-05  Youenn Fablet  <youenn@apple.com>
     2
     3        [Fetch API] SubresourceLoader::checkRedirectionCrossOriginAccessControl should not always assert in SameOrigin mode
     4        https://bugs.webkit.org/show_bug.cgi?id=160594
     5
     6        Reviewed by Alex Christensen.
     7
     8        * web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt:
     9        * web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt:
     10        * web-platform-tests/fetch/api/basic/mode-same-origin.js: Adding redirection tests for same origin mode.
     11
    1122016-08-05  Youenn Fablet  <youenn@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt

    r203408 r204172  
     1CONSOLE MESSAGE: Unsafe attempt to load URL https://localhost:9443/fetch/api/resources/top.txt?location=%5B%27https%3A%2F%2Flocalhost%3A9443%2Ffetch%2Fapi%2Fresources%2Ftop.txt%27%5D&count=1 from frame with URL http://localhost:8800/fetch/api/basic/mode-same-origin.html. Domains, protocols and ports must match.
     2
     3CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/resources/top.txt?location=%5B%27http%3A%2F%2F127.0.0.1%3A8800%2Ffetch%2Fapi%2Fresources%2Ftop.txt%27%5D&count=1 from frame with URL http://localhost:8800/fetch/api/basic/mode-same-origin.html. Domains, protocols and ports must match.
     4
    15
    26PASS Fetch ../resources/top.txt with same-origin mode
     
    48PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with same-origin mode
    59PASS Fetch http://127.0.0.1:8800/fetch/api/resources/top.txt with same-origin mode
     10PASS Fetch /fetch/api/basic/../resources/redirect.py?location=../resources/top.txt with same-origin mode
     11PASS Fetch /fetch/api/basic/../resources/redirect.py?location=http://localhost:8800/fetch/api/resources/top.txt with same-origin mode
     12PASS Fetch /fetch/api/basic/../resources/redirect.py?location=https://localhost:9443/fetch/api/resources/top.txt with same-origin mode
     13PASS Fetch /fetch/api/basic/../resources/redirect.py?location=http://127.0.0.1:8800/fetch/api/resources/top.txt with same-origin mode
    614
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin-worker-expected.txt

    r203408 r204172  
     1CONSOLE MESSAGE: Unsafe attempt to load URL https://localhost:9443/fetch/api/resources/top.txt?location=%5B%27https%3A%2F%2Flocalhost%3A9443%2Ffetch%2Fapi%2Fresources%2Ftop.txt%27%5D&count=1 from frame with URL http://localhost:8800/fetch/api/basic/mode-same-origin-worker.html. Domains, protocols and ports must match.
     2
     3CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/resources/top.txt?location=%5B%27http%3A%2F%2F127.0.0.1%3A8800%2Ffetch%2Fapi%2Fresources%2Ftop.txt%27%5D&count=1 from frame with URL http://localhost:8800/fetch/api/basic/mode-same-origin-worker.html. Domains, protocols and ports must match.
     4
    15
    26PASS Fetch ../resources/top.txt with same-origin mode
     
    48PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with same-origin mode
    59PASS Fetch http://127.0.0.1:8800/fetch/api/resources/top.txt with same-origin mode
     10PASS Fetch /fetch/api/basic/../resources/redirect.py?location=../resources/top.txt with same-origin mode
     11PASS Fetch /fetch/api/basic/../resources/redirect.py?location=http://localhost:8800/fetch/api/resources/top.txt with same-origin mode
     12PASS Fetch /fetch/api/basic/../resources/redirect.py?location=https://localhost:9443/fetch/api/resources/top.txt with same-origin mode
     13PASS Fetch /fetch/api/basic/../resources/redirect.py?location=http://127.0.0.1:8800/fetch/api/resources/top.txt with same-origin mode
    614
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.js

    r203408 r204172  
    2424fetchSameOrigin(host_info.HTTP_REMOTE_ORIGIN + "/fetch/api/resources/top.txt", false);
    2525
     26var redirPath = dirname(location.pathname) + RESOURCES_DIR + "redirect.py?location=";
     27
     28fetchSameOrigin(redirPath + RESOURCES_DIR + "top.txt", true);
     29fetchSameOrigin(redirPath + host_info.HTTP_ORIGIN + "/fetch/api/resources/top.txt", true);
     30fetchSameOrigin(redirPath + host_info.HTTPS_ORIGIN + "/fetch/api/resources/top.txt", false);
     31fetchSameOrigin(redirPath + host_info.HTTP_REMOTE_ORIGIN + "/fetch/api/resources/top.txt", false);
     32
    2633done();
    2734
  • trunk/Source/WebCore/ChangeLog

    r204171 r204172  
     12016-08-05  Youenn Fablet  <youenn@apple.com>
     2
     3        [Fetch API] SubresourceLoader::checkRedirectionCrossOriginAccessControl should not always assert in SameOrigin mode
     4        https://bugs.webkit.org/show_bug.cgi?id=160594
     5
     6        Reviewed by Alex Christensen.
     7
     8        Covered by rebased tests.
     9
     10        * loader/SubresourceLoader.cpp:
     11        (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
     12        It should not throw is mode is SameOrigin and resource is same origin.
     13
    1142016-08-05  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/Source/WebCore/loader/SubresourceLoader.cpp

    r204117 r204172  
    404404bool SubresourceLoader::checkRedirectionCrossOriginAccessControl(const ResourceRequest& previousRequest, const ResourceResponse& redirectResponse, ResourceRequest& newRequest, String& errorMessage)
    405405{
    406     ASSERT(options().mode != FetchOptions::Mode::SameOrigin);
    407 
    408406    bool crossOriginFlag = m_resource->isCrossOrigin();
    409407    bool isNextRequestCrossOrigin = m_origin && !m_origin->canRequest(newRequest.url());
     
    411409    if (isNextRequestCrossOrigin)
    412410        m_resource->setCrossOrigin();
     411
     412    ASSERT(options().mode != FetchOptions::Mode::SameOrigin || !m_resource->isCrossOrigin());
    413413
    414414    if (options().mode != FetchOptions::Mode::Cors)
Note: See TracChangeset for help on using the changeset viewer.