[webkit-changes] [WebKit/WebKit] 878b8e: fetch should compute its origin from its context

youennf noreply at github.com
Fri Mar 31 08:11:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 878b8e74ec2f636044a79b02027c044ca08c1462
      https://github.com/WebKit/WebKit/commit/878b8e74ec2f636044a79b02027c044ca08c1462
  Author: Youenn Fablet <youennf at gmail.com>
  Date:   2023-03-31 (Fri, 31 Mar 2023)

  Changed paths:
    A LayoutTests/http/wpt/fetch/origin-no-cors-disabled-expected.txt
    A LayoutTests/http/wpt/fetch/origin-no-cors-disabled.html
    A LayoutTests/http/wpt/fetch/resources/echo-origin-cors-disabled.py
    M Source/WebCore/loader/cache/CachedResourceRequest.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/page/SecurityOrigin.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl

  Log Message:
  -----------
  fetch should compute its origin from its context
https://bugs.webkit.org/show_bug.cgi?id=254734
rdar://problem/107414766

Reviewed by Chris Dumez.

In case some security features are disabled, the referrer might not be same origin as the context origin for a fetch request.
In that case, we should still stick to the context origin and not rely on referrer to compute the origin.
We update CachedResourceRequest::updateReferrerAndOriginHeaders accordingly for fetch loads.

* LayoutTests/http/wpt/fetch/origin-no-cors-disabled-expected.txt: Added.
* LayoutTests/http/wpt/fetch/origin-no-cors-disabled.html: Added.
* LayoutTests/http/wpt/fetch/resources/echo-origin-cors-disabled.py: Added.
(main):
* Source/WebCore/loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::updateReferrerAndOriginHeaders):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::addCORSDisablingPatternForTesting):
* Source/WebCore/page/Page.h:
* Source/WebCore/page/SecurityOrigin.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::grantUniversalAccess):
(WebCore::Internals::disableCORSForURL):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:

Canonical link: https://commits.webkit.org/262403@main




More information about the webkit-changes mailing list