Changeset 228962 in webkit


Ignore:
Timestamp:
Feb 23, 2018 1:39:04 PM (6 years ago)
Author:
jmarcell@apple.com
Message:

Cherry-pick r228930. rdar://problem/37836719

Location:
branches/safari-605-branch/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-605-branch/Source/WebKit/ChangeLog

    r228961 r228962  
     12018-02-23  Jason Marcell  <jmarcell@apple.com>
     2
     3        Cherry-pick r228930. rdar://problem/37836719
     4
     5    2018-02-22  Youenn Fablet  <youenn@apple.com>
     6
     7            Fetch event release assert should take into account the fetch mode
     8            https://bugs.webkit.org/show_bug.cgi?id=183047
     9
     10            Reviewed by Chris Dumez.
     11
     12            In case of navigation tasks, we should use the request URL and not the origin of the loading client.
     13
     14            * WebProcess/Storage/WebSWContextManagerConnection.cpp:
     15            (WebKit::isValidFetch):
     16            (WebKit::WebSWContextManagerConnection::startFetch):
     17
    1182018-02-23  Jason Marcell  <jmarcell@apple.com>
    219
  • branches/safari-605-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp

    r228961 r228962  
    175175}
    176176
     177static inline bool isValidFetch(const ResourceRequest& request, const FetchOptions& options, const URL& serviceWorkerURL, const String& referrer)
     178{
     179    // For exotic service workers, do not enforce checks.
     180    if (!serviceWorkerURL.protocolIsInHTTPFamily())
     181        return true;
     182
     183    if (options.mode == FetchOptions::Mode::Navigate)
     184        return protocolHostAndPortAreEqual(request.url(), serviceWorkerURL);
     185
     186    String origin = request.httpOrigin();
     187    URL url { URL(), origin.isEmpty() ? referrer : origin };
     188    if (!url.protocolIsInHTTPFamily())
     189        return true;
     190
     191    return protocolHostAndPortAreEqual(url, serviceWorkerURL);
     192}
     193
    177194void WebSWContextManagerConnection::startFetch(SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options, IPC::FormDataReference&& formData, String&& referrer)
    178195{
     
    183200    }
    184201
    185     String origin = request.httpOrigin();
    186     URL url { URL(), origin.isEmpty() ? referrer : origin };
    187     URL serviceWorkerURL = serviceWorkerThreadProxy->scriptURL();
    188     RELEASE_ASSERT(!url.protocolIsInHTTPFamily() || !serviceWorkerURL.protocolIsInHTTPFamily() || protocolHostAndPortAreEqual(url, serviceWorkerURL));
     202    RELEASE_ASSERT(isValidFetch(request, options, serviceWorkerThreadProxy->scriptURL(), referrer));
    189203
    190204    auto client = WebServiceWorkerFetchTaskClient::create(m_connectionToStorageProcess.copyRef(), serviceWorkerIdentifier, serverConnectionIdentifier, fetchIdentifier);
Note: See TracChangeset for help on using the changeset viewer.