Diff
Modified: trunk/LayoutTests/ChangeLog (221698 => 221699)
--- trunk/LayoutTests/ChangeLog 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/LayoutTests/ChangeLog 2017-09-06 20:40:01 UTC (rev 221699)
@@ -1,3 +1,16 @@
+2017-09-06 Ryan Haddad <[email protected]>
+
+ 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
+
2017-09-06 Devin Rousso <[email protected]>
Web Inspector: Support overloaded CanvasRenderingContext2D actions with identical parameter counts
Modified: trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt (221698 => 221699)
--- trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt 2017-09-06 20:40:01 UTC (rev 221699)
@@ -1,3 +1,2 @@
-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
-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
+CONSOLE MESSAGE: line 11: Registration failed with error: UnknownError: serviceWorker job scheduling is not yet implemented
Modified: trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js (221698 => 221699)
--- trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js 2017-09-06 20:40:01 UTC (rev 221699)
@@ -6,16 +6,6 @@
navigator.serviceWorker.register("resources/empty-worker.js", { })
.then(function(r) {
console.log("Registered!");
-}, function(e) {
- console.log("Registration failed with error: " + e);
-})
-.catch(function(e) {
- console.log("Exception registering: " + e);
-});
-
-navigator.serviceWorker.register("resources/empty-worker-doesnt-exist.js", { })
-.then(function(r) {
- console.log("Registered!");
done();
}, function(e) {
console.log("Registration failed with error: " + e);
Modified: trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js (221698 => 221699)
--- trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/LayoutTests/http/tests/workers/service/resources/registration-task-queue-scheduling-1.js 2017-09-06 20:40:01 UTC (rev 221699)
@@ -48,8 +48,8 @@
console.log("Original window resolved successfully (unexpected)")
done();
}, function(e) {
- 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") {
- alert("Unexpected error received from server: " + e);
+ if (e+"" != "UnknownError: serviceWorker job scheduling is not yet implemented") {
+ alert("Unexpected error received from server");
finishSWTest();
}
Modified: trunk/Source/WebCore/ChangeLog (221698 => 221699)
--- trunk/Source/WebCore/ChangeLog 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/ChangeLog 2017-09-06 20:40:01 UTC (rev 221699)
@@ -1,3 +1,16 @@
+2017-09-06 Ryan Haddad <[email protected]>
+
+ 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
+
2017-09-06 Devin Rousso <[email protected]>
Web Inspector: Support overloaded CanvasRenderingContext2D actions with identical parameter counts
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (221698 => 221699)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-09-06 20:40:01 UTC (rev 221699)
@@ -2306,10 +2306,6 @@
517A53461F50C17F00DCDC0A /* SWServerWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A53421F50C16100DCDC0A /* SWServerWorker.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A534E1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A534B1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.cpp */; };
517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 517A535A1F5889EF00DCDC0A /* FetchLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B51C89912600A7E715 /* FetchLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
517A63C31B74318700E7DCDC /* KeyedDecoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */; };
517A63C41B74318B00E7DCDC /* KeyedEncoderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */; };
517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10166,7 +10162,6 @@
517A53431F50C16100DCDC0A /* SWServerWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWServerWorker.cpp; sourceTree = "<group>"; };
517A534B1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerRegistrationData.cpp; sourceTree = "<group>"; };
517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerRegistrationData.h; sourceTree = "<group>"; };
- 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerFetchResult.h; sourceTree = "<group>"; };
517A63BF1B74317E00E7DCDC /* KeyedDecoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedDecoderCF.cpp; sourceTree = "<group>"; };
517A63C01B74317E00E7DCDC /* KeyedDecoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedDecoderCF.h; sourceTree = "<group>"; };
517A63C11B74317E00E7DCDC /* KeyedEncoderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedEncoderCF.cpp; sourceTree = "<group>"; };
@@ -18992,7 +18987,6 @@
51F175581F3EBC0C00C74950 /* ServiceWorkerContainer.cpp */,
51F175571F3EBC0C00C74950 /* ServiceWorkerContainer.h */,
51F175561F3EBC0C00C74950 /* ServiceWorkerContainer.idl */,
- 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */,
51F175551F3EBC0C00C74950 /* ServiceWorkerGlobalScope.cpp */,
51F175541F3EBC0C00C74950 /* ServiceWorkerGlobalScope.h */,
51F175531F3EBC0C00C74950 /* ServiceWorkerGlobalScope.idl */,
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (221698 => 221699)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-09-06 20:40:01 UTC (rev 221699)
@@ -32,9 +32,7 @@
#include "IDLTypes.h"
#include "JSDOMPromiseDeferred.h"
#include "JSServiceWorkerRegistration.h"
-#include "Logging.h"
#include "NavigatorBase.h"
-#include "ResourceError.h"
#include "ScopeGuard.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
@@ -183,35 +181,6 @@
job.promise().resolve<IDLInterface<ServiceWorkerRegistration>>(registration.get());
}
-void ServiceWorkerContainer::startScriptFetchForJob(ServiceWorkerJob& job)
-{
- LOG(ServiceWorker, "SeviceWorkerContainer %p starting script fetch for job %" PRIu64, this, job.data().identifier());
-
- auto* context = scriptExecutionContext();
- if (!context) {
- LOG_ERROR("ServiceWorkerContainer::jobResolvedWithRegistration called but the container's ScriptExecutionContext is gone");
- m_swConnection->failedFetchingScript(job, { errorDomainWebKitInternal, 0, job.data().scriptURL, ASCIILiteral("Attempt to fetch service worker script with no ScriptExecutionContext") });
- jobDidFinish(job);
- return;
- }
-
- job.fetchScriptWithContext(*context);
-}
-
-void ServiceWorkerContainer::jobFinishedLoadingScript(ServiceWorkerJob& job, Ref<SharedBuffer>&& data)
-{
- LOG(ServiceWorker, "SeviceWorkerContainer %p finished fetching script for job %" PRIu64, this, job.data().identifier());
-
- m_swConnection->finishedFetchingScript(job, data.get());
-}
-
-void ServiceWorkerContainer::jobFailedLoadingScript(ServiceWorkerJob& job, const ResourceError& error)
-{
- LOG(ServiceWorker, "SeviceWorkerContainer %p failed fetching script for job %" PRIu64, this, job.data().identifier());
-
- m_swConnection->failedFetchingScript(job, error);
-}
-
void ServiceWorkerContainer::jobDidFinish(ServiceWorkerJob& job)
{
auto taken = m_jobMap.take(job.data().identifier());
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h (221698 => 221699)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -73,10 +73,6 @@
void jobFailedWithException(ServiceWorkerJob&, const Exception&) final;
void jobResolvedWithRegistration(ServiceWorkerJob&, const ServiceWorkerRegistrationData&) final;
- void startScriptFetchForJob(ServiceWorkerJob&) final;
- void jobFinishedLoadingScript(ServiceWorkerJob&, Ref<SharedBuffer>&&) final;
- void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&) final;
-
void jobDidFinish(ServiceWorkerJob&);
uint64_t connectionIdentifier() final;
Deleted: trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h (221698 => 221699)
--- trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(SERVICE_WORKER)
-
-#include "ResourceError.h"
-#include "ServiceWorkerRegistrationKey.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-struct ServiceWorkerFetchResult {
- uint64_t jobIdentifier;
- uint64_t connectionIdentifier;
- ServiceWorkerRegistrationKey registrationKey;
- Vector<uint8_t> scriptData;
- ResourceError scriptError;
-
- template<class Encoder> void encode(Encoder&) const;
- template<class Decoder> static bool decode(Decoder&, ServiceWorkerFetchResult&);
-};
-
-template<class Encoder>
-void ServiceWorkerFetchResult::encode(Encoder& encoder) const
-{
- encoder << jobIdentifier << connectionIdentifier << registrationKey << scriptData << scriptError;
-}
-
-template<class Decoder>
-bool ServiceWorkerFetchResult::decode(Decoder& decoder, ServiceWorkerFetchResult& result)
-{
- if (!decoder.decode(result.jobIdentifier))
- return false;
- if (!decoder.decode(result.connectionIdentifier))
- return false;
- if (!decoder.decode(result.registrationKey))
- return false;
- if (!decoder.decode(result.scriptData))
- return false;
- if (!decoder.decode(result.scriptError))
- return false;
-
- return true;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp (221698 => 221699)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp 2017-09-06 20:40:01 UTC (rev 221699)
@@ -28,12 +28,7 @@
#if ENABLE(SERVICE_WORKER)
-#include "FetchHeaders.h"
-#include "FetchLoader.h"
-#include "FetchRequest.h"
#include "JSDOMPromiseDeferred.h"
-#include "ResourceError.h"
-#include "ResourceResponse.h"
#include "ServiceWorkerJobData.h"
#include "ServiceWorkerRegistration.h"
@@ -69,80 +64,6 @@
m_client->jobResolvedWithRegistration(*this, data);
}
-void ServiceWorkerJob::startScriptFetch()
-{
- ASSERT(currentThread() == m_creationThread);
- ASSERT(!m_completed);
-
- m_client->startScriptFetchForJob(*this);
-}
-
-void ServiceWorkerJob::fetchScriptWithContext(ScriptExecutionContext& context)
-{
- ASSERT(currentThread() == m_creationThread);
- ASSERT(!m_completed);
-
- m_fetchLoader = std::make_unique<FetchLoader>(*this, nullptr);
-
- // FIXME: This Fetch request is set up incorrectly and without proper care.
- // The ServiceWorkers spec specifics many details to apply here.
-
- auto fetchHeaders = FetchHeaders::create();
- auto referrer = m_jobData.clientCreationURL.string();
- auto fetchRequest = FetchRequest::create(context, std::nullopt, WTFMove(fetchHeaders), { m_jobData.scriptURL }, { }, WTFMove(referrer));
-
- m_fetchLoader->start(context, fetchRequest);
-}
-
-void ServiceWorkerJob::didReceiveResponse(const ResourceResponse& response)
-{
- ASSERT(currentThread() == m_creationThread);
- ASSERT(!m_completed);
- ASSERT(m_fetchLoader);
- ASSERT(!m_scriptData);
-
- m_lastResponse = response;
-
- if (response.httpStatusCode() < 200 || response.httpStatusCode() > 399) {
- auto message = makeString(ASCIILiteral("ServiceWorker script network fetch failed with HTTP status code "), String::number(response.httpStatusCode()));
- didFail({ errorDomainWebKitInternal, 0, m_lastResponse.url(), message });
- }
-}
-
-void ServiceWorkerJob::didReceiveData(const char* data, size_t size)
-{
- ASSERT(currentThread() == m_creationThread);
- ASSERT(!m_completed);
- ASSERT(m_fetchLoader);
-
- if (!m_scriptData)
- m_scriptData = SharedBuffer::create();
-
- m_scriptData->get().append(data, size);
-}
-
-void ServiceWorkerJob::didSucceed()
-{
- ASSERT(currentThread() == m_creationThread);
- ASSERT(!m_completed);
- ASSERT(m_fetchLoader);
-
- if (!m_scriptData)
- m_scriptData = SharedBuffer::create();
- m_client->jobFinishedLoadingScript(*this, WTFMove(*m_scriptData));
- m_fetchLoader = nullptr;
-}
-
-void ServiceWorkerJob::didFail(const ResourceError& error)
-{
- ASSERT(currentThread() == m_creationThread);
- ASSERT(!m_completed);
- ASSERT(m_fetchLoader);
-
- m_client->jobFailedLoadingScript(*this, error);
- m_fetchLoader = nullptr;
-}
-
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJob.h (221698 => 221699)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJob.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJob.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -27,9 +27,6 @@
#if ENABLE(SERVICE_WORKER)
-#include "FetchLoader.h"
-#include "FetchLoaderClient.h"
-#include "ResourceResponse.h"
#include "ServiceWorkerJobClient.h"
#include "ServiceWorkerJobData.h"
#include <wtf/RefPtr.h>
@@ -41,11 +38,10 @@
class DeferredPromise;
class Exception;
-class ScriptExecutionContext;
enum class ServiceWorkerJobType;
struct ServiceWorkerRegistrationData;
-class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public FetchLoaderClient {
+class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob> {
public:
static Ref<ServiceWorkerJob> create(ServiceWorkerJobClient& client, Ref<DeferredPromise>&& promise, ServiceWorkerJobData&& jobData)
{
@@ -56,22 +52,13 @@
void failedWithException(const Exception&);
void resolvedWithRegistration(const ServiceWorkerRegistrationData&);
- void startScriptFetch();
ServiceWorkerJobData data() const { return m_jobData; }
DeferredPromise& promise() { return m_promise.get(); }
- void fetchScriptWithContext(ScriptExecutionContext&);
-
private:
ServiceWorkerJob(ServiceWorkerJobClient&, Ref<DeferredPromise>&&, ServiceWorkerJobData&&);
- // FetchLoaderClient
- void didReceiveResponse(const ResourceResponse&) final;
- void didReceiveData(const char*, size_t) final;
- void didSucceed() final;
- void didFail(const ResourceError&) final;
-
Ref<ServiceWorkerJobClient> m_client;
ServiceWorkerJobData m_jobData;
Ref<DeferredPromise> m_promise;
@@ -79,9 +66,6 @@
bool m_completed { false };
Ref<RunLoop> m_runLoop { RunLoop::current() };
- std::unique_ptr<FetchLoader> m_fetchLoader;
- ResourceResponse m_lastResponse;
- std::optional<Ref<SharedBuffer>> m_scriptData;
#if !ASSERT_DISABLED
ThreadIdentifier m_creationThread { currentThread() };
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJobClient.h (221698 => 221699)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJobClient.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJobClient.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -30,9 +30,7 @@
namespace WebCore {
class Exception;
-class ResourceError;
class ServiceWorkerJob;
-class SharedBuffer;
struct ServiceWorkerRegistrationData;
class ServiceWorkerJobClient {
@@ -41,9 +39,6 @@
virtual void jobFailedWithException(ServiceWorkerJob&, const Exception&) = 0;
virtual void jobResolvedWithRegistration(ServiceWorkerJob&, const ServiceWorkerRegistrationData&) = 0;
- virtual void startScriptFetchForJob(ServiceWorkerJob&) = 0;
- virtual void jobFinishedLoadingScript(ServiceWorkerJob&, Ref<SharedBuffer>&&) = 0;
- virtual void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&) = 0;
virtual uint64_t connectionIdentifier() = 0;
Modified: trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp (221698 => 221699)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp 2017-09-06 20:40:01 UTC (rev 221699)
@@ -29,7 +29,6 @@
#if ENABLE(SERVICE_WORKER)
#include "ExceptionData.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerJobData.h"
namespace WebCore {
@@ -50,22 +49,6 @@
scheduleJobInServer(job.data());
}
-void SWClientConnection::finishedFetchingScript(ServiceWorkerJob& job, SharedBuffer& data)
-{
- ASSERT(m_scheduledJobs.get(job.data().identifier()) == &job);
-
- Vector<uint8_t> vector;
- vector.append(reinterpret_cast<const uint8_t *>(data.data()), data.size());
- finishFetchingScriptInServer({ job.data().identifier(), job.data().connectionIdentifier(), job.data().registrationKey(), vector, { } });
-}
-
-void SWClientConnection::failedFetchingScript(ServiceWorkerJob& job, const ResourceError& error)
-{
- ASSERT(m_scheduledJobs.get(job.data().identifier()) == &job);
-
- finishFetchingScriptInServer({ job.data().identifier(), job.data().connectionIdentifier(), job.data().registrationKey(), { }, error });
-}
-
void SWClientConnection::jobRejectedInServer(uint64_t jobIdentifier, const ExceptionData& exceptionData)
{
auto job = m_scheduledJobs.take(jobIdentifier);
@@ -88,22 +71,6 @@
job->resolvedWithRegistration(registrationData);
}
-void SWClientConnection::startScriptFetchForServer(uint64_t jobIdentifier)
-{
- auto job = m_scheduledJobs.get(jobIdentifier);
- if (!job) {
- LOG_ERROR("Job %" PRIu64 " instructed to start fetch from server, but job was not found", jobIdentifier);
-
- // FIXME: Should message back to the server here to signal failure to fetch,
- // but we currently need the registration key to do so, and don't have it here.
- // In the future we'll refactor to have a global, cross-process job identifier that can be used to overcome this.
-
- return;
- }
-
- job->startScriptFetch();
-}
-
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/server/SWClientConnection.h (221698 => 221699)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -33,10 +33,7 @@
namespace WebCore {
-class ResourceError;
-class SharedBuffer;
struct ExceptionData;
-struct ServiceWorkerFetchResult;
struct ServiceWorkerRegistrationData;
class SWClientConnection : public ThreadSafeRefCounted<SWClientConnection> {
@@ -45,8 +42,6 @@
WEBCORE_EXPORT virtual ~SWClientConnection();
void scheduleJob(ServiceWorkerJob&);
- void finishedFetchingScript(ServiceWorkerJob&, SharedBuffer&);
- void failedFetchingScript(ServiceWorkerJob&, const ResourceError&);
virtual uint64_t identifier() const = 0;
@@ -53,11 +48,9 @@
protected:
WEBCORE_EXPORT void jobRejectedInServer(uint64_t jobIdentifier, const ExceptionData&);
WEBCORE_EXPORT void jobResolvedInServer(uint64_t jobIdentifier, const ServiceWorkerRegistrationData&);
- WEBCORE_EXPORT void startScriptFetchForServer(uint64_t jobIdentifier);
private:
virtual void scheduleJobInServer(const ServiceWorkerJobData&) = 0;
- virtual void finishFetchingScriptInServer(const ServiceWorkerFetchResult&) = 0;
HashMap<uint64_t, RefPtr<ServiceWorkerJob>> m_scheduledJobs;
};
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (221698 => 221699)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-09-06 20:40:01 UTC (rev 221699)
@@ -32,7 +32,6 @@
#include "ExceptionData.h"
#include "Logging.h"
#include "SWServerRegistration.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerJobData.h"
#include <wtf/text/WTFString.h>
@@ -73,11 +72,6 @@
m_server.scheduleJob(jobData);
}
-void SWServer::Connection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
-{
- m_server.scriptFetchFinished(result);
-}
-
SWServer::SWServer()
{
m_taskThread = Thread::create(ASCIILiteral("ServiceWorker Task Thread"), [this] {
@@ -118,29 +112,6 @@
connection->resolveJobInClient(jobData.identifier(), registrationData);
}
-void SWServer::startScriptFetch(const ServiceWorkerJobData& jobData)
-{
- LOG(ServiceWorker, "Server issuing startScriptFetch for current job %" PRIu64 "-%" PRIu64 " in client", jobData.connectionIdentifier(), jobData.identifier());
- auto* connection = m_connections.get(jobData.connectionIdentifier());
- if (!connection)
- return;
-
- connection->startScriptFetchInClient(jobData.identifier());
-}
-
-void SWServer::scriptFetchFinished(const ServiceWorkerFetchResult& result)
-{
- LOG(ServiceWorker, "Server handling scriptFetchFinished for current job %" PRIu64 "-%" PRIu64 " in client", result.connectionIdentifier, result.jobIdentifier);
-
- ASSERT(m_connections.contains(result.connectionIdentifier));
-
- auto registration = m_registrations.get(result.registrationKey);
- if (!registration)
- return;
-
- registration->scriptFetchFinished(result);
-}
-
void SWServer::taskThreadEntryPoint()
{
ASSERT(!isMainThread());
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (221698 => 221699)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -43,7 +43,6 @@
class SWServerRegistration;
struct ExceptionData;
-struct ServiceWorkerFetchResult;
struct ServiceWorkerRegistrationData;
class SWServer {
@@ -58,12 +57,10 @@
SWServer& server() { return m_server; }
WEBCORE_EXPORT void scheduleJobInServer(const ServiceWorkerJobData&);
- WEBCORE_EXPORT void finishFetchingScriptInServer(const ServiceWorkerFetchResult&);
private:
virtual void rejectJobInClient(uint64_t jobIdentifier, const ExceptionData&) = 0;
virtual void resolveJobInClient(uint64_t jobIdentifier, const ServiceWorkerRegistrationData&) = 0;
- virtual void startScriptFetchInClient(uint64_t jobIdentifier) = 0;
SWServer& m_server;
};
@@ -74,8 +71,6 @@
void scheduleJob(const ServiceWorkerJobData&);
void rejectJob(const ServiceWorkerJobData&, const ExceptionData&);
void resolveJob(const ServiceWorkerJobData&, const ServiceWorkerRegistrationData&);
- void startScriptFetch(const ServiceWorkerJobData&);
-
void postTask(CrossThreadTask&&);
void postTaskReply(CrossThreadTask&&);
@@ -86,8 +81,6 @@
void taskThreadEntryPoint();
void handleTaskRepliesOnMainThread();
- void scriptFetchFinished(const ServiceWorkerFetchResult&);
-
HashMap<uint64_t, Connection*> m_connections;
HashMap<ServiceWorkerRegistrationKey, std::unique_ptr<SWServerRegistration>> m_registrations;
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp (221698 => 221699)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp 2017-09-06 20:40:01 UTC (rev 221699)
@@ -32,7 +32,6 @@
#include "SWServer.h"
#include "SWServerWorker.h"
#include "SecurityOrigin.h"
-#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerRegistrationData.h"
#include "WorkerType.h"
@@ -64,22 +63,6 @@
m_jobTimer.startOneShot(0_s);
}
-void SWServerRegistration::scriptFetchFinished(const ServiceWorkerFetchResult& result)
-{
- ASSERT(m_currentJob && m_currentJob->identifier() == result.jobIdentifier);
-
- // FIXME: We fetched the script contents but don't do anything with them yet.
- // These errors are for testing the current state of the feature.
-
- String message;
- if (result.scriptError.isNull())
- message = makeString("Script URL ", m_currentJob->scriptURL.string(), " fetched with ", String::number(result.scriptData.size()), " bytes, but we're not using the result yet");
- else
- message = makeString("Script URL ", m_currentJob->scriptURL.string(), " fetch resulted in error: ", result.scriptError.localizedDescription());
-
- rejectCurrentJob(ExceptionData { UnknownError, message });
-}
-
void SWServerRegistration::startNextJob()
{
ASSERT(isMainThread());
@@ -166,7 +149,9 @@
if (newestWorker && !equalIgnoringFragmentIdentifier(job.scriptURL, newestWorker->scriptURL()))
return rejectWithExceptionOnMainThread(ExceptionData { TypeError, ASCIILiteral("Cannot update a service worker with a requested script URL whose newest worker has a different script URL") });
- startScriptFetchFromMainThread();
+ // FIXME: At this point we are ready to actually fetch the script for the worker in the registering context.
+ // For now we're still hard coding the same rejection we have so far.
+ rejectWithExceptionOnMainThread(ExceptionData { UnknownError, ASCIILiteral("serviceWorker job scheduling is not yet implemented") });
}
void SWServerRegistration::rejectWithExceptionOnMainThread(const ExceptionData& exception)
@@ -181,12 +166,6 @@
m_server.postTaskReply(createCrossThreadTask(*this, &SWServerRegistration::resolveCurrentJob, data()));
}
-void SWServerRegistration::startScriptFetchFromMainThread()
-{
- ASSERT(!isMainThread());
- m_server.postTaskReply(createCrossThreadTask(*this, &SWServerRegistration::startScriptFetchForCurrentJob));
-}
-
void SWServerRegistration::rejectCurrentJob(const ExceptionData& exceptionData)
{
ASSERT(isMainThread());
@@ -207,14 +186,6 @@
finishCurrentJob();
}
-void SWServerRegistration::startScriptFetchForCurrentJob()
-{
- ASSERT(isMainThread());
- ASSERT(m_currentJob);
-
- m_server.startScriptFetch(*m_currentJob);
-}
-
void SWServerRegistration::finishCurrentJob()
{
ASSERT(m_currentJob);
Modified: trunk/Source/WebCore/workers/service/server/SWServerRegistration.h (221698 => 221699)
--- trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebCore/workers/service/server/SWServerRegistration.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -38,7 +38,6 @@
class SWServer;
class SWServerWorker;
struct ExceptionData;
-struct ServiceWorkerFetchResult;
class SWServerRegistration : public ThreadSafeIdentified<SWServerRegistration> {
public:
@@ -47,7 +46,6 @@
~SWServerRegistration();
void enqueueJob(const ServiceWorkerJobData&);
- void scriptFetchFinished(const ServiceWorkerFetchResult&);
ServiceWorkerRegistrationData data() const;
@@ -56,7 +54,6 @@
void startNextJob();
void rejectCurrentJob(const ExceptionData&);
void resolveCurrentJob(const ServiceWorkerRegistrationData&);
- void startScriptFetchForCurrentJob();
void finishCurrentJob();
void runRegisterJob(const ServiceWorkerJobData&);
@@ -64,7 +61,6 @@
void rejectWithExceptionOnMainThread(const ExceptionData&);
void resolveWithRegistrationOnMainThread();
- void startScriptFetchFromMainThread();
bool isEmpty();
SWServerWorker* getNewestWorker();
Modified: trunk/Source/WebKit/ChangeLog (221698 => 221699)
--- trunk/Source/WebKit/ChangeLog 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebKit/ChangeLog 2017-09-06 20:40:01 UTC (rev 221699)
@@ -1,3 +1,16 @@
+2017-09-06 Ryan Haddad <[email protected]>
+
+ 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
+
2017-09-06 Alex Christensen <[email protected]>
Add modern decoders for POD types
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (221698 => 221699)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp 2017-09-06 20:40:01 UTC (rev 221699)
@@ -28,7 +28,6 @@
#if ENABLE(SERVICE_WORKER)
-#include "DataReference.h"
#include "Logging.h"
#include "StorageToWebProcessConnectionMessages.h"
#include "WebProcess.h"
@@ -71,11 +70,6 @@
send(Messages::WebSWClientConnection::JobResolvedInServer(jobIdentifier, registrationData));
}
-void WebSWServerConnection::startScriptFetchInClient(uint64_t jobIdentifier)
-{
- send(Messages::WebSWClientConnection::StartScriptFetchForServer(jobIdentifier));
-}
-
} // namespace WebKit
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (221698 => 221699)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -51,7 +51,6 @@
// Implement SWServer::Connection
void rejectJobInClient(uint64_t jobIdentifier, const WebCore::ExceptionData&) final;
void resolveJobInClient(uint64_t jobIdentifier, const WebCore::ServiceWorkerRegistrationData&) final;
- void startScriptFetchInClient(uint64_t jobIdentifier) final;
IPC::Connection* messageSenderConnection() final { return m_connection.ptr(); }
uint64_t messageSenderDestinationID() final { return identifier(); }
Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in (221698 => 221699)
--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in 2017-09-06 20:40:01 UTC (rev 221699)
@@ -25,7 +25,6 @@
messages -> WebSWServerConnection {
# When possible, these messages can be implemented directly by WebCore::SWClientConnection
ScheduleJobInServer(struct WebCore::ServiceWorkerJobData jobData)
- FinishFetchingScriptInServer(struct WebCore::ServiceWorkerFetchResult result)
}
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (221698 => 221699)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp 2017-09-06 20:40:01 UTC (rev 221699)
@@ -30,9 +30,7 @@
#include "Logging.h"
#include "StorageToWebProcessConnectionMessages.h"
-#include "WebCoreArgumentCoders.h"
#include "WebSWServerConnectionMessages.h"
-#include <WebCore/ServiceWorkerFetchResult.h>
#include <WebCore/ServiceWorkerJobData.h>
using namespace PAL;
@@ -58,11 +56,6 @@
send(Messages::WebSWServerConnection::ScheduleJobInServer(jobData));
}
-void WebSWClientConnection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
-{
- send(Messages::WebSWServerConnection::FinishFetchingScriptInServer(result));
-}
-
} // namespace WebKit
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (221698 => 221699)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h 2017-09-06 20:40:01 UTC (rev 221699)
@@ -48,7 +48,6 @@
uint64_t identifier() const final { return m_identifier; }
void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final;
- void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final;
void disconnectedFromWebProcess();
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in (221698 => 221699)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2017-09-06 20:26:43 UTC (rev 221698)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in 2017-09-06 20:40:01 UTC (rev 221699)
@@ -26,7 +26,6 @@
# When possible, these messages can be implemented directly by WebCore::SWServer::Connection
JobRejectedInServer(uint64_t identifier, struct WebCore::ExceptionData exception)
JobResolvedInServer(uint64_t identifier, struct WebCore::ServiceWorkerRegistrationData registration)
- StartScriptFetchForServer(uint64_t jobIdentifier)
}
#endif // ENABLE(SERVICE_WORKER)