Changeset 223944 in webkit


Ignore:
Timestamp:
Oct 24, 2017 5:47:27 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

ServiceWorkerClientFetch should return an error that is not null in case of failure
https://bugs.webkit.org/show_bug.cgi?id=178761

Patch by Youenn Fablet <youenn@apple.com> on 2017-10-24
Reviewed by Geoffrey Garen.

Source/WebCore:

Covered by existing tests.

As per spec, ServiceWorkerJob should not go through Service Worker Handle Fetch
for fetching scripts.

  • workers/WorkerScriptLoader.cpp:

(WebCore::WorkerScriptLoader::loadAsynchronously):

  • workers/WorkerScriptLoaderClient.h:

(WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const):

  • workers/service/ServiceWorkerJob.h:

Source/WebKit:

  • WebProcess/Storage/ServiceWorkerClientFetch.cpp:

(WebKit::ServiceWorkerClientFetch::didFail): Generating a General error.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223942 r223944  
     12017-10-24  Youenn Fablet  <youenn@apple.com>
     2
     3        ServiceWorkerClientFetch should return an error that is not null in case of failure
     4        https://bugs.webkit.org/show_bug.cgi?id=178761
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Covered by existing tests.
     9
     10        As per spec, ServiceWorkerJob should not go through Service Worker Handle Fetch
     11        for fetching scripts.
     12
     13        * workers/WorkerScriptLoader.cpp:
     14        (WebCore::WorkerScriptLoader::loadAsynchronously):
     15        * workers/WorkerScriptLoaderClient.h:
     16        (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const):
     17        * workers/service/ServiceWorkerJob.h:
     18
    1192017-10-24  Keith Miller  <keith_miller@apple.com>
    220
  • trunk/Source/WebCore/workers/WorkerScriptLoader.cpp

    r223728 r223944  
    8888    options.sendLoadCallbacks = SendCallbacks;
    8989    options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement;
    90 
     90#if ENABLE(SERVICE_WORKER)
     91    options.serviceWorkersMode = m_client->isServiceWorkerClient() ? ServiceWorkersMode::None : ServiceWorkersMode::All;
     92    options.serviceWorkerIdentifier = scriptExecutionContext->selectedServiceWorkerIdentifier();
     93#endif
    9194    // During create, callbacks may happen which remove the last reference to this object.
    9295    Ref<WorkerScriptLoader> protectedThis(*this);
  • trunk/Source/WebCore/workers/WorkerScriptLoaderClient.h

    r223728 r223944  
    3535    virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) = 0;
    3636    virtual void notifyFinished() = 0;
     37    virtual bool isServiceWorkerClient() const { return false; }
    3738
    3839protected:
  • trunk/Source/WebCore/workers/service/ServiceWorkerJob.h

    r223652 r223944  
    7070    void didReceiveResponse(unsigned long identifier, const ResourceResponse&) final;
    7171    void notifyFinished() final;
     72    bool isServiceWorkerClient() const final { return true; }
     73
    7274
    7375    Ref<ServiceWorkerJobClient> m_client;
  • trunk/Source/WebKit/ChangeLog

    r223935 r223944  
     12017-10-24  Youenn Fablet  <youenn@apple.com>
     2
     3        ServiceWorkerClientFetch should return an error that is not null in case of failure
     4        https://bugs.webkit.org/show_bug.cgi?id=178761
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
     9        (WebKit::ServiceWorkerClientFetch::didFail): Generating a General error.
     10
    1112017-10-24  Youenn Fablet  <youenn@apple.com>
    212
  • trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp

    r223839 r223944  
    9090{
    9191    auto protectedThis = makeRef(*this);
    92     m_loader->didFail({ });
     92    m_loader->didFail({ ResourceError::Type::General });
    9393
    9494    if (auto callback = WTFMove(m_callback))
Note: See TracChangeset for help on using the changeset viewer.