Changeset 221699 in webkit


Ignore:
Timestamp:
Sep 6, 2017 1:40:01 PM (7 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, rolling out r221461.

The LayoutTest added with this change crashes under
GuardMalloc.

Reverted changeset:

"Add (entirely incorrect) fetching of ServiceWorker scripts."
https://bugs.webkit.org/show_bug.cgi?id=176179
http://trac.webkit.org/changeset/221461

Location:
trunk
Files:
1 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r221695 r221699  
     12017-09-06  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r221461.
     4
     5        The LayoutTest added with this change crashes under
     6        GuardMalloc.
     7
     8        Reverted changeset:
     9
     10        "Add (entirely incorrect) fetching of ServiceWorker scripts."
     11        https://bugs.webkit.org/show_bug.cgi?id=176179
     12        http://trac.webkit.org/changeset/221461
     13
    1142017-09-06  Devin Rousso  <webkit@devinrousso.com>
    215
  • trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt

    r221461 r221699  
    1 CONSOLE MESSAGE: line 10: Registration failed with error: UnknownError: Script URL http://127.0.0.1:8000/workers/service/resources/empty-worker.js fetched with 41 bytes, but we're not using the result yet
    2 CONSOLE MESSAGE: line 21: Registration failed with error: UnknownError: Script URL http://127.0.0.1:8000/workers/service/resources/empty-worker-doesnt-exist.js fetch resulted in error: ServiceWorker script network fetch failed with HTTP status code 404
     1CONSOLE MESSAGE: line 11: Registration failed with error: UnknownError: serviceWorker job scheduling is not yet implemented
    32
  • trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js

    r221461 r221699  
    55
    66navigator.serviceWorker.register("resources/empty-worker.js", { })
    7 .then(function(r) {
    8         console.log("Registered!");
    9 }, function(e) {
    10         console.log("Registration failed with error: " + e);
    11 })
    12 .catch(function(e) {
    13         console.log("Exception registering: " + e);
    14 });
    15 
    16 navigator.serviceWorker.register("resources/empty-worker-doesnt-exist.js", { })
    177.then(function(r) {
    188        console.log("Registered!");
  • trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js

    r221461 r221699  
    4949                done();
    5050        }, function(e) {
    51                 if (e+"" != "UnknownError: Script URL http://127.0.0.1:8000/workers/service/resources/empty-worker.js fetched with 41 bytes, but we're not using the result yet") {
    52                         alert("Unexpected error received from server: " + e);
     51                if (e+"" != "UnknownError: serviceWorker job scheduling is not yet implemented") {
     52                        alert("Unexpected error received from server");
    5353                        finishSWTest();
    5454                }
  • trunk/Source/WebCore/ChangeLog

    r221695 r221699  
     12017-09-06  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r221461.
     4
     5        The LayoutTest added with this change crashes under
     6        GuardMalloc.
     7
     8        Reverted changeset:
     9
     10        "Add (entirely incorrect) fetching of ServiceWorker scripts."
     11        https://bugs.webkit.org/show_bug.cgi?id=176179
     12        http://trac.webkit.org/changeset/221461
     13
    1142017-09-06  Devin Rousso  <webkit@devinrousso.com>
    215
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r221695 r221699  
    23072307                517A534E1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A534B1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.cpp */; };
    23082308                517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2309                 517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2310                 517A535A1F5889EF00DCDC0A /* FetchLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B51C89912600A7E715 /* FetchLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2311                 517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2312                 517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
    23132309                517A63C31B74318700E7DCDC /* KeyedDecoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */; };
    23142310                517A63C41B74318B00E7DCDC /* KeyedEncoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */; };
     
    1016710163                517A534B1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerRegistrationData.cpp; sourceTree = "<group>"; };
    1016810164                517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerRegistrationData.h; sourceTree = "<group>"; };
    10169                 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerFetchResult.h; sourceTree = "<group>"; };
    1017010165                517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedDecoderCF.cpp; sourceTree = "<group>"; };
    1017110166                517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedDecoderCF.h; sourceTree = "<group>"; };
     
    1899318988                                51F175571F3EBC0C00C74950 /* ServiceWorkerContainer.h */,
    1899418989                                51F175561F3EBC0C00C74950 /* ServiceWorkerContainer.idl */,
    18995                                 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */,
    1899618990                                51F175551F3EBC0C00C74950 /* ServiceWorkerGlobalScope.cpp */,
    1899718991                                51F175541F3EBC0C00C74950 /* ServiceWorkerGlobalScope.h */,
  • trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp

    r221509 r221699  
    3333#include "JSDOMPromiseDeferred.h"
    3434#include "JSServiceWorkerRegistration.h"
    35 #include "Logging.h"
    3635#include "NavigatorBase.h"
    37 #include "ResourceError.h"
    3836#include "ScopeGuard.h"
    3937#include "ScriptExecutionContext.h"
     
    184182}
    185183
    186 void ServiceWorkerContainer::startScriptFetchForJob(ServiceWorkerJob& job)
    187 {
    188     LOG(ServiceWorker, "SeviceWorkerContainer %p starting script fetch for job %" PRIu64, this, job.data().identifier());
    189 
    190     auto* context = scriptExecutionContext();
    191     if (!context) {
    192         LOG_ERROR("ServiceWorkerContainer::jobResolvedWithRegistration called but the container's ScriptExecutionContext is gone");
    193         m_swConnection->failedFetchingScript(job, { errorDomainWebKitInternal, 0, job.data().scriptURL, ASCIILiteral("Attempt to fetch service worker script with no ScriptExecutionContext") });
    194         jobDidFinish(job);
    195         return;
    196     }
    197 
    198     job.fetchScriptWithContext(*context);
    199 }
    200 
    201 void ServiceWorkerContainer::jobFinishedLoadingScript(ServiceWorkerJob& job, Ref<SharedBuffer>&& data)
    202 {
    203     LOG(ServiceWorker, "SeviceWorkerContainer %p finished fetching script for job %" PRIu64, this, job.data().identifier());
    204 
    205     m_swConnection->finishedFetchingScript(job, data.get());
    206 }
    207 
    208 void ServiceWorkerContainer::jobFailedLoadingScript(ServiceWorkerJob& job, const ResourceError& error)
    209 {
    210     LOG(ServiceWorker, "SeviceWorkerContainer %p failed fetching script for job %" PRIu64, this, job.data().identifier());
    211 
    212     m_swConnection->failedFetchingScript(job, error);
    213 }
    214 
    215184void ServiceWorkerContainer::jobDidFinish(ServiceWorkerJob& job)
    216185{
  • trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h

    r221461 r221699  
    7474    void jobFailedWithException(ServiceWorkerJob&, const Exception&) final;
    7575    void jobResolvedWithRegistration(ServiceWorkerJob&, const ServiceWorkerRegistrationData&) final;
    76     void startScriptFetchForJob(ServiceWorkerJob&) final;
    77     void jobFinishedLoadingScript(ServiceWorkerJob&, Ref<SharedBuffer>&&) final;
    78     void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&) final;
    79 
    8076    void jobDidFinish(ServiceWorkerJob&);
    8177
  • trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp

    r221646 r221699  
    2929#if ENABLE(SERVICE_WORKER)
    3030
    31 #include "FetchHeaders.h"
    32 #include "FetchLoader.h"
    33 #include "FetchRequest.h"
    3431#include "JSDOMPromiseDeferred.h"
    35 #include "ResourceError.h"
    36 #include "ResourceResponse.h"
    3732#include "ServiceWorkerJobData.h"
    3833#include "ServiceWorkerRegistration.h"
     
    7065}
    7166
    72 void ServiceWorkerJob::startScriptFetch()
    73 {
    74     ASSERT(currentThread() == m_creationThread);
    75     ASSERT(!m_completed);
    76 
    77     m_client->startScriptFetchForJob(*this);
    78 }
    79 
    80 void ServiceWorkerJob::fetchScriptWithContext(ScriptExecutionContext& context)
    81 {
    82     ASSERT(currentThread() == m_creationThread);
    83     ASSERT(!m_completed);
    84 
    85     m_fetchLoader = std::make_unique<FetchLoader>(*this, nullptr);
    86 
    87     // FIXME: This Fetch request is set up incorrectly and without proper care.
    88     // The ServiceWorkers spec specifics many details to apply here.
    89 
    90     auto fetchHeaders = FetchHeaders::create();
    91     auto referrer = m_jobData.clientCreationURL.string();
    92     auto fetchRequest = FetchRequest::create(context, std::nullopt, WTFMove(fetchHeaders), { m_jobData.scriptURL }, { }, WTFMove(referrer));
    93 
    94     m_fetchLoader->start(context, fetchRequest);
    95 }
    96 
    97 void ServiceWorkerJob::didReceiveResponse(const ResourceResponse& response)
    98 {
    99     ASSERT(currentThread() == m_creationThread);
    100     ASSERT(!m_completed);
    101     ASSERT(m_fetchLoader);
    102     ASSERT(!m_scriptData);
    103 
    104     m_lastResponse = response;
    105 
    106     if (response.httpStatusCode() < 200 || response.httpStatusCode() > 399) {
    107         auto message = makeString(ASCIILiteral("ServiceWorker script network fetch failed with HTTP status code "), String::number(response.httpStatusCode()));
    108         didFail({ errorDomainWebKitInternal, 0, m_lastResponse.url(), message });
    109     }
    110 }
    111 
    112 void ServiceWorkerJob::didReceiveData(const char* data, size_t size)
    113 {
    114     ASSERT(currentThread() == m_creationThread);
    115     ASSERT(!m_completed);
    116     ASSERT(m_fetchLoader);
    117 
    118     if (!m_scriptData)
    119         m_scriptData = SharedBuffer::create();
    120 
    121     m_scriptData->get().append(data, size);
    122 }
    123 
    124 void ServiceWorkerJob::didSucceed()
    125 {
    126     ASSERT(currentThread() == m_creationThread);
    127     ASSERT(!m_completed);
    128     ASSERT(m_fetchLoader);
    129 
    130     if (!m_scriptData)
    131         m_scriptData = SharedBuffer::create();
    132     m_client->jobFinishedLoadingScript(*this, WTFMove(*m_scriptData));
    133     m_fetchLoader = nullptr;
    134 }
    135 
    136 void ServiceWorkerJob::didFail(const ResourceError& error)
    137 {
    138     ASSERT(currentThread() == m_creationThread);
    139     ASSERT(!m_completed);
    140     ASSERT(m_fetchLoader);
    141 
    142     m_client->jobFailedLoadingScript(*this, error);
    143     m_fetchLoader = nullptr;
    144 }
    145 
    14667} // namespace WebCore
    14768
  • trunk/Source/WebCore/workers/service/ServiceWorkerJob.h

    r221646 r221699  
    2828#if ENABLE(SERVICE_WORKER)
    2929
    30 #include "FetchLoader.h"
    31 #include "FetchLoaderClient.h"
    32 #include "ResourceResponse.h"
    3330#include "ServiceWorkerJobClient.h"
    3431#include "ServiceWorkerJobData.h"
     
    4239class DeferredPromise;
    4340class Exception;
    44 class ScriptExecutionContext;
    4541enum class ServiceWorkerJobType;
    4642struct ServiceWorkerRegistrationData;
    4743
    48 class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public FetchLoaderClient {
     44class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob> {
    4945public:
    5046    static Ref<ServiceWorkerJob> create(ServiceWorkerJobClient& client, Ref<DeferredPromise>&& promise, ServiceWorkerJobData&& jobData)
     
    5753    void failedWithException(const Exception&);
    5854    void resolvedWithRegistration(const ServiceWorkerRegistrationData&);
    59     void startScriptFetch();
    6055
    6156    ServiceWorkerJobData data() const { return m_jobData; }
    6257    DeferredPromise& promise() { return m_promise.get(); }
    6358
    64     void fetchScriptWithContext(ScriptExecutionContext&);
    65 
    6659private:
    6760    ServiceWorkerJob(ServiceWorkerJobClient&, Ref<DeferredPromise>&&, ServiceWorkerJobData&&);
    68 
    69     // FetchLoaderClient
    70     void didReceiveResponse(const ResourceResponse&) final;
    71     void didReceiveData(const char*, size_t) final;
    72     void didSucceed() final;
    73     void didFail(const ResourceError&) final;
    7461
    7562    Ref<ServiceWorkerJobClient> m_client;
     
    8067
    8168    Ref<RunLoop> m_runLoop { RunLoop::current() };
    82     std::unique_ptr<FetchLoader> m_fetchLoader;
    83     ResourceResponse m_lastResponse;
    84     std::optional<Ref<SharedBuffer>> m_scriptData;
    8569
    8670#if !ASSERT_DISABLED
  • trunk/Source/WebCore/workers/service/ServiceWorkerJobClient.h

    r221461 r221699  
    3131
    3232class Exception;
    33 class ResourceError;
    3433class ServiceWorkerJob;
    35 class SharedBuffer;
    3634struct ServiceWorkerRegistrationData;
    3735
     
    4240    virtual void jobFailedWithException(ServiceWorkerJob&, const Exception&) = 0;
    4341    virtual void jobResolvedWithRegistration(ServiceWorkerJob&, const ServiceWorkerRegistrationData&) = 0;
    44     virtual void startScriptFetchForJob(ServiceWorkerJob&) = 0;
    45     virtual void jobFinishedLoadingScript(ServiceWorkerJob&, Ref<SharedBuffer>&&) = 0;
    46     virtual void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&) = 0;
    4742
    4843    virtual uint64_t connectionIdentifier() = 0;
  • trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp

    r221646 r221699  
    3030
    3131#include "ExceptionData.h"
    32 #include "ServiceWorkerFetchResult.h"
    3332#include "ServiceWorkerJobData.h"
    3433
     
    4948
    5049    scheduleJobInServer(job.data());
    51 }
    52 
    53 void SWClientConnection::finishedFetchingScript(ServiceWorkerJob& job, SharedBuffer& data)
    54 {
    55     ASSERT(m_scheduledJobs.get(job.data().identifier()) == &job);
    56 
    57     Vector<uint8_t> vector;
    58     vector.append(reinterpret_cast<const uint8_t *>(data.data()), data.size());
    59     finishFetchingScriptInServer({ job.data().identifier(), job.data().connectionIdentifier(), job.data().registrationKey(), vector, { } });
    60 }
    61 
    62 void SWClientConnection::failedFetchingScript(ServiceWorkerJob& job, const ResourceError& error)
    63 {
    64     ASSERT(m_scheduledJobs.get(job.data().identifier()) == &job);
    65 
    66     finishFetchingScriptInServer({ job.data().identifier(), job.data().connectionIdentifier(), job.data().registrationKey(), { }, error });
    6750}
    6851
     
    8972}
    9073
    91 void SWClientConnection::startScriptFetchForServer(uint64_t jobIdentifier)
    92 {
    93     auto job = m_scheduledJobs.get(jobIdentifier);
    94     if (!job) {
    95         LOG_ERROR("Job %" PRIu64 " instructed to start fetch from server, but job was not found", jobIdentifier);
    96 
    97         // FIXME: Should message back to the server here to signal failure to fetch,
    98         // but we currently need the registration key to do so, and don't have it here.
    99         // In the future we'll refactor to have a global, cross-process job identifier that can be used to overcome this.
    100 
    101         return;
    102     }
    103 
    104     job->startScriptFetch();
    105 }
    106 
    10774} // namespace WebCore
    10875
  • trunk/Source/WebCore/workers/service/server/SWClientConnection.h

    r221461 r221699  
    3434namespace WebCore {
    3535
    36 class ResourceError;
    37 class SharedBuffer;
    3836struct ExceptionData;
    39 struct ServiceWorkerFetchResult;
    4037struct ServiceWorkerRegistrationData;
    4138
     
    4643
    4744    void scheduleJob(ServiceWorkerJob&);
    48     void finishedFetchingScript(ServiceWorkerJob&, SharedBuffer&);
    49     void failedFetchingScript(ServiceWorkerJob&, const ResourceError&);
    5045
    5146    virtual uint64_t identifier() const = 0;
     
    5449    WEBCORE_EXPORT void jobRejectedInServer(uint64_t jobIdentifier, const ExceptionData&);
    5550    WEBCORE_EXPORT void jobResolvedInServer(uint64_t jobIdentifier, const ServiceWorkerRegistrationData&);
    56     WEBCORE_EXPORT void startScriptFetchForServer(uint64_t jobIdentifier);
    5751
    5852private:
    5953    virtual void scheduleJobInServer(const ServiceWorkerJobData&) = 0;
    60     virtual void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) = 0;
    6154
    6255    HashMap<uint64_t, RefPtr<ServiceWorkerJob>> m_scheduledJobs;
  • trunk/Source/WebCore/workers/service/server/SWServer.cpp

    r221461 r221699  
    3333#include "Logging.h"
    3434#include "SWServerRegistration.h"
    35 #include "ServiceWorkerFetchResult.h"
    3635#include "ServiceWorkerJobData.h"
    3736#include <wtf/text/WTFString.h>
     
    7473}
    7574
    76 void SWServer::Connection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
    77 {
    78     m_server.scriptFetchFinished(result);
    79 }
    80 
    8175SWServer::SWServer()
    8276{
     
    117111
    118112    connection->resolveJobInClient(jobData.identifier(), registrationData);
    119 }
    120 
    121 void SWServer::startScriptFetch(const ServiceWorkerJobData& jobData)
    122 {
    123     LOG(ServiceWorker, "Server issuing startScriptFetch for current job %" PRIu64 "-%" PRIu64 " in client", jobData.connectionIdentifier(), jobData.identifier());
    124     auto* connection = m_connections.get(jobData.connectionIdentifier());
    125     if (!connection)
    126         return;
    127 
    128     connection->startScriptFetchInClient(jobData.identifier());
    129 }
    130 
    131 void SWServer::scriptFetchFinished(const ServiceWorkerFetchResult& result)
    132 {
    133     LOG(ServiceWorker, "Server handling scriptFetchFinished for current job %" PRIu64 "-%" PRIu64 " in client", result.connectionIdentifier, result.jobIdentifier);
    134 
    135     ASSERT(m_connections.contains(result.connectionIdentifier));
    136 
    137     auto registration = m_registrations.get(result.registrationKey);
    138     if (!registration)
    139         return;
    140 
    141     registration->scriptFetchFinished(result);
    142113}
    143114
  • trunk/Source/WebCore/workers/service/server/SWServer.h

    r221461 r221699  
    4444class SWServerRegistration;
    4545struct ExceptionData;
    46 struct ServiceWorkerFetchResult;
    4746struct ServiceWorkerRegistrationData;
    4847
     
    5958
    6059        WEBCORE_EXPORT void scheduleJobInServer(const ServiceWorkerJobData&);
    61         WEBCORE_EXPORT void finishFetchingScriptInServer(const ServiceWorkerFetchResult&);
    6260
    6361    private:
    6462        virtual void rejectJobInClient(uint64_t jobIdentifier, const ExceptionData&) = 0;
    6563        virtual void resolveJobInClient(uint64_t jobIdentifier, const ServiceWorkerRegistrationData&) = 0;
    66         virtual void startScriptFetchInClient(uint64_t jobIdentifier) = 0;
    6764
    6865        SWServer& m_server;
     
    7572    void rejectJob(const ServiceWorkerJobData&, const ExceptionData&);
    7673    void resolveJob(const ServiceWorkerJobData&, const ServiceWorkerRegistrationData&);
    77     void startScriptFetch(const ServiceWorkerJobData&);
    78 
    7974    void postTask(CrossThreadTask&&);
    8075    void postTaskReply(CrossThreadTask&&);
     
    8681    void taskThreadEntryPoint();
    8782    void handleTaskRepliesOnMainThread();
    88 
    89     void scriptFetchFinished(const ServiceWorkerFetchResult&);
    9083
    9184    HashMap<uint64_t, Connection*> m_connections;
  • trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp

    r221461 r221699  
    3333#include "SWServerWorker.h"
    3434#include "SecurityOrigin.h"
    35 #include "ServiceWorkerFetchResult.h"
    3635#include "ServiceWorkerRegistrationData.h"
    3736#include "WorkerType.h"
     
    6362    if (!m_jobTimer.isActive())
    6463        m_jobTimer.startOneShot(0_s);
    65 }
    66 
    67 void SWServerRegistration::scriptFetchFinished(const ServiceWorkerFetchResult& result)
    68 {
    69     ASSERT(m_currentJob && m_currentJob->identifier() == result.jobIdentifier);
    70 
    71     // FIXME: We fetched the script contents but don't do anything with them yet.
    72     // These errors are for testing the current state of the feature.
    73 
    74     String message;
    75     if (result.scriptError.isNull())
    76         message = makeString("Script URL ", m_currentJob->scriptURL.string(), " fetched with ", String::number(result.scriptData.size()), " bytes, but we're not using the result yet");
    77     else
    78         message = makeString("Script URL ", m_currentJob->scriptURL.string(), " fetch resulted in error: ", result.scriptError.localizedDescription());
    79 
    80     rejectCurrentJob(ExceptionData { UnknownError, message });
    8164}
    8265
     
    167150        return rejectWithExceptionOnMainThread(ExceptionData { TypeError, ASCIILiteral("Cannot update a service worker with a requested script URL whose newest worker has a different script URL") });
    168151
    169     startScriptFetchFromMainThread();
     152    // FIXME: At this point we are ready to actually fetch the script for the worker in the registering context.
     153    // For now we're still hard coding the same rejection we have so far.
     154    rejectWithExceptionOnMainThread(ExceptionData { UnknownError, ASCIILiteral("serviceWorker job scheduling is not yet implemented") });
    170155}
    171156
     
    180165    ASSERT(!isMainThread());
    181166    m_server.postTaskReply(createCrossThreadTask(*this, &SWServerRegistration::resolveCurrentJob, data()));
    182 }
    183 
    184 void SWServerRegistration::startScriptFetchFromMainThread()
    185 {
    186     ASSERT(!isMainThread());
    187     m_server.postTaskReply(createCrossThreadTask(*this, &SWServerRegistration::startScriptFetchForCurrentJob));
    188167}
    189168
     
    206185
    207186    finishCurrentJob();
    208 }
    209 
    210 void SWServerRegistration::startScriptFetchForCurrentJob()
    211 {
    212     ASSERT(isMainThread());
    213     ASSERT(m_currentJob);
    214 
    215     m_server.startScriptFetch(*m_currentJob);
    216187}
    217188
  • trunk/Source/WebCore/workers/service/server/SWServerRegistration.h

    r221461 r221699  
    3939class SWServerWorker;
    4040struct ExceptionData;
    41 struct ServiceWorkerFetchResult;
    4241
    4342class SWServerRegistration : public ThreadSafeIdentified<SWServerRegistration> {
     
    4847
    4948    void enqueueJob(const ServiceWorkerJobData&);
    50     void scriptFetchFinished(const ServiceWorkerFetchResult&);
    5149
    5250    ServiceWorkerRegistrationData data() const;
     
    5755    void rejectCurrentJob(const ExceptionData&);
    5856    void resolveCurrentJob(const ServiceWorkerRegistrationData&);
    59     void startScriptFetchForCurrentJob();
    6057    void finishCurrentJob();
    6158
     
    6562    void rejectWithExceptionOnMainThread(const ExceptionData&);
    6663    void resolveWithRegistrationOnMainThread();
    67     void startScriptFetchFromMainThread();
    6864    bool isEmpty();
    6965    SWServerWorker* getNewestWorker();
  • trunk/Source/WebKit/ChangeLog

    r221698 r221699  
     12017-09-06  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r221461.
     4
     5        The LayoutTest added with this change crashes under
     6        GuardMalloc.
     7
     8        Reverted changeset:
     9
     10        "Add (entirely incorrect) fetching of ServiceWorker scripts."
     11        https://bugs.webkit.org/show_bug.cgi?id=176179
     12        http://trac.webkit.org/changeset/221461
     13
    1142017-09-06  Alex Christensen  <achristensen@webkit.org>
    215
  • trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp

    r221461 r221699  
    2929#if ENABLE(SERVICE_WORKER)
    3030
    31 #include "DataReference.h"
    3231#include "Logging.h"
    3332#include "StorageToWebProcessConnectionMessages.h"
     
    7271}
    7372
    74 void WebSWServerConnection::startScriptFetchInClient(uint64_t jobIdentifier)
    75 {
    76     send(Messages::WebSWClientConnection::StartScriptFetchForServer(jobIdentifier));
    77 }
    78 
    7973} // namespace WebKit
    8074
  • trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h

    r221461 r221699  
    5252    void rejectJobInClient(uint64_t jobIdentifier, const WebCore::ExceptionData&) final;
    5353    void resolveJobInClient(uint64_t jobIdentifier, const WebCore::ServiceWorkerRegistrationData&) final;
    54     void startScriptFetchInClient(uint64_t jobIdentifier) final;
    5554
    5655    IPC::Connection* messageSenderConnection() final { return m_connection.ptr(); }
  • trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in

    r221461 r221699  
    2626    # When possible, these messages can be implemented directly by WebCore::SWClientConnection
    2727    ScheduleJobInServer(struct WebCore::ServiceWorkerJobData jobData)
    28     FinishFetchingScriptInServer(struct WebCore::ServiceWorkerFetchResult result)
    2928}
    3029
  • trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp

    r221461 r221699  
    3131#include "Logging.h"
    3232#include "StorageToWebProcessConnectionMessages.h"
    33 #include "WebCoreArgumentCoders.h"
    3433#include "WebSWServerConnectionMessages.h"
    35 #include <WebCore/ServiceWorkerFetchResult.h>
    3634#include <WebCore/ServiceWorkerJobData.h>
    3735
     
    5957}
    6058
    61 void WebSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
    62 {
    63     send(Messages::WebSWServerConnection::FinishFetchingScriptInServer(result));
    64 }
    65 
    6659} // namespace WebKit
    6760
  • trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h

    r221461 r221699  
    4949
    5050    void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final;
    51     void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final;
    5251
    5352    void disconnectedFromWebProcess();
  • trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in

    r221461 r221699  
    2727    JobRejectedInServer(uint64_t identifier, struct WebCore::ExceptionData exception)
    2828    JobResolvedInServer(uint64_t identifier, struct WebCore::ServiceWorkerRegistrationData registration)
    29     StartScriptFetchForServer(uint64_t jobIdentifier)
    3029}
    3130
Note: See TracChangeset for help on using the changeset viewer.