Changeset 228963 in webkit


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

Apply patch. rdar://problem/37836719

Location:
branches/safari-605-branch/Source
Files:
5 edited

Legend:

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

    r228961 r228963  
     12018-02-23  Jason Marcell  <jmarcell@apple.com>
     2
     3        Apply patch. rdar://problem/37836719
     4
     5    2018-02-23  Chris Dumez  <cdumez@apple.com>
     6
     7            Add release asserts for service worker fetch and postMessage events
     8            https://bugs.webkit.org/show_bug.cgi?id=183025
     9            <rdar://problem/37765052>
     10
     11            Reviewed by Chris Dumez.
     12
     13            Moving from release assert to early exit with release logging.
     14
     15            * workers/service/context/ServiceWorkerThread.cpp:
     16            (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
     17            * workers/service/context/ServiceWorkerThreadProxy.h:
     18
    1192018-02-23  Jason Marcell  <jmarcell@apple.com>
    220
  • branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp

    r228961 r228963  
    3434#include "ExtendableMessageEvent.h"
    3535#include "JSDOMPromise.h"
     36#include "Logging.h"
    3637#include "NetworkStateNotifier.h"
    3738#include "SecurityOrigin.h"
     
    121122            RefPtr<ServiceWorkerClient> sourceClient = ServiceWorkerClient::getOrCreate(serviceWorkerGlobalScope, WTFMove(WTF::get<ServiceWorkerClientData>(sourceData)));
    122123
    123             RELEASE_ASSERT(!sourceClient->url().protocolIsInHTTPFamily() || !serviceWorkerGlobalScope.url().protocolIsInHTTPFamily() || protocolHostAndPortAreEqual(serviceWorkerGlobalScope.url(), sourceClient->url()));
     124            if (sourceClient->url().protocolIsInHTTPFamily() && serviceWorkerGlobalScope.url().protocolIsInHTTPFamily() && !protocolHostAndPortAreEqual(serviceWorkerGlobalScope.url(), sourceClient->url())) {
     125                RELEASE_LOG_ERROR_IF(!context.sessionID().isEphemeral(), ServiceWorker, "ServiceWorkerThread::postMessageToServiceWorker - Received message from invalid service worker client due to origin - context is %p\n", &context);
     126                ASSERT_NOT_REACHED();
     127                return;
     128            }
    124129
    125130            sourceOrigin = SecurityOrigin::create(sourceClient->url());
     
    128133            RefPtr<ServiceWorker> sourceWorker = ServiceWorker::getOrCreate(serviceWorkerGlobalScope, WTFMove(WTF::get<ServiceWorkerData>(sourceData)));
    129134
    130             RELEASE_ASSERT(!sourceWorker->scriptURL().protocolIsInHTTPFamily() || !serviceWorkerGlobalScope.url().protocolIsInHTTPFamily() || protocolHostAndPortAreEqual(serviceWorkerGlobalScope.url(), sourceWorker->scriptURL()));
     135            if (sourceWorker->scriptURL().protocolIsInHTTPFamily() && serviceWorkerGlobalScope.url().protocolIsInHTTPFamily() && !protocolHostAndPortAreEqual(serviceWorkerGlobalScope.url(), sourceWorker->scriptURL())) {
     136                RELEASE_LOG_ERROR_IF(!context.sessionID().isEphemeral(), ServiceWorker, "ServiceWorkerThread::postMessageToServiceWorker - Received message from invalid service worker due to origin - context is %p\n", &context);
     137                ASSERT_NOT_REACHED();
     138                return;
     139            }
    131140
    132141            sourceOrigin = SecurityOrigin::create(sourceWorker->scriptURL());
  • branches/safari-605-branch/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h

    r228961 r228963  
    6767
    6868    const URL& scriptURL() const { return m_document->url(); }
     69    PAL::SessionID sessionID() const { return m_sessionID; }
    6970
    7071    // Public only for testing purposes.
  • branches/safari-605-branch/Source/WebKit/ChangeLog

    r228962 r228963  
     12018-02-23  Jason Marcell  <jmarcell@apple.com>
     2
     3        Apply patch. rdar://problem/37836719
     4
     5    2018-02-23  Chris Dumez  <cdumez@apple.com>
     6
     7            Add release asserts for service worker fetch and postMessage events
     8            https://bugs.webkit.org/show_bug.cgi?id=183025
     9            <rdar://problem/37765052>
     10
     11            Reviewed by Chris Dumez.
     12
     13            Moving from release assert to early exit with release logging.
     14
     15            * WebProcess/Storage/WebSWContextManagerConnection.cpp:
     16            (WebKit::WebSWContextManagerConnection::startFetch):
     17
    1182018-02-23  Jason Marcell  <jmarcell@apple.com>
    219
  • branches/safari-605-branch/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp

    r228962 r228963  
    200200    }
    201201
    202     RELEASE_ASSERT(isValidFetch(request, options, serviceWorkerThreadProxy->scriptURL(), referrer));
     202    if (!isValidFetch(request, options, serviceWorkerThreadProxy->scriptURL(), referrer)) {
     203        RELEASE_LOG_ERROR_IF(!serviceWorkerThreadProxy->sessionID().isEphemeral(), ServiceWorker, "%p - WebSWContextManagerConnection::startFetch - Service Worker received an invalid fetch due to origin", this);
     204        m_connectionToStorageProcess->send(Messages::StorageProcess::DidNotHandleFetch(serverConnectionIdentifier, fetchIdentifier), 0);
     205        ASSERT_NOT_REACHED();
     206        return;
     207    }
    203208
    204209    auto client = WebServiceWorkerFetchTaskClient::create(m_connectionToStorageProcess.copyRef(), serviceWorkerIdentifier, serverConnectionIdentifier, fetchIdentifier);
Note: See TracChangeset for help on using the changeset viewer.