Diff
Modified: trunk/Source/WebCore/ChangeLog (221645 => 221646)
--- trunk/Source/WebCore/ChangeLog 2017-09-05 23:28:54 UTC (rev 221645)
+++ trunk/Source/WebCore/ChangeLog 2017-09-05 23:33:49 UTC (rev 221646)
@@ -1,3 +1,16 @@
+2017-09-05 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r221495.
+
+ This change introduced assertion failures on El Capitan Debug
+ WK2.
+
+ Reverted changeset:
+
+ "Move ServiceWorkerJob from FetchLoader to ThreadableLoader."
+ https://bugs.webkit.org/show_bug.cgi?id=176231
+ http://trac.webkit.org/changeset/221495
+
2017-09-05 Chris Dumez <cdu...@apple.com>
Add support for input.webkitEntries
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (221645 => 221646)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-09-05 23:28:54 UTC (rev 221645)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-09-05 23:33:49 UTC (rev 221646)
@@ -2306,8 +2306,8 @@
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 */; };
- 517A535A1F5889EF00DCDC0A /* FetchLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B51C89912600A7E715 /* FetchLoader.h */; };
+ 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 */; };
@@ -11518,8 +11518,8 @@
7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMConvertWebGL.cpp; sourceTree = "<group>"; };
7CBBBCC41F560567005EFAAC /* DOMMatrix2DInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMMatrix2DInit.idl; sourceTree = "<group>"; };
7CBBBCC61F560568005EFAAC /* DOMMatrix2DInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMatrix2DInit.h; sourceTree = "<group>"; };
- 7CBBBCC81F5617C0005EFAAC /* JSDOMMatrix2DInit.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMMatrix2DInit.cpp; sourceTree = "<group>"; };
- 7CBBBCC91F5617C0005EFAAC /* JSDOMMatrix2DInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSDOMMatrix2DInit.h; sourceTree = "<group>"; };
+ 7CBBBCC81F5617C0005EFAAC /* JSDOMMatrix2DInit.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMMatrix2DInit.cpp; path = JSDOMMatrix2DInit.cpp; sourceTree = "<group>"; };
+ 7CBBBCC91F5617C0005EFAAC /* JSDOMMatrix2DInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JSDOMMatrix2DInit.h; path = JSDOMMatrix2DInit.h; sourceTree = "<group>"; };
7CC2DDF81EC9415A0027B774 /* NotificationPermission.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationPermission.h; sourceTree = "<group>"; };
7CC2DDFA1EC9415A0027B774 /* NotificationPermission.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NotificationPermission.idl; sourceTree = "<group>"; };
7CC2DDFE1EC95A440027B774 /* JSNotificationPermission.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotificationPermission.cpp; sourceTree = "<group>"; };
Modified: trunk/Source/WebCore/loader/ThreadableLoader.h (221645 => 221646)
--- trunk/Source/WebCore/loader/ThreadableLoader.h 2017-09-05 23:28:54 UTC (rev 221645)
+++ trunk/Source/WebCore/loader/ThreadableLoader.h 2017-09-05 23:33:49 UTC (rev 221646)
@@ -37,62 +37,62 @@
namespace WebCore {
-class ResourceError;
-class ResourceRequest;
-class ResourceResponse;
-class ScriptExecutionContext;
-class ThreadableLoaderClient;
+ class ResourceError;
+ class ResourceRequest;
+ class ResourceResponse;
+ class ScriptExecutionContext;
+ class ThreadableLoaderClient;
-enum PreflightPolicy {
- ConsiderPreflight,
- ForcePreflight,
- PreventPreflight
-};
+ enum PreflightPolicy {
+ ConsiderPreflight,
+ ForcePreflight,
+ PreventPreflight
+ };
-enum class ContentSecurityPolicyEnforcement {
- DoNotEnforce,
- EnforceChildSrcDirective,
- EnforceConnectSrcDirective,
- EnforceScriptSrcDirective,
-};
+ enum class ContentSecurityPolicyEnforcement {
+ DoNotEnforce,
+ EnforceChildSrcDirective,
+ EnforceConnectSrcDirective,
+ EnforceScriptSrcDirective,
+ };
-enum class ResponseFilteringPolicy {
- Enable,
- Disable,
-};
+ enum class ResponseFilteringPolicy {
+ Enable,
+ Disable,
+ };
-struct ThreadableLoaderOptions : ResourceLoaderOptions {
- ThreadableLoaderOptions();
- ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, ContentSecurityPolicyEnforcement, String&& initiator, ResponseFilteringPolicy);
- ~ThreadableLoaderOptions();
+ struct ThreadableLoaderOptions : ResourceLoaderOptions {
+ ThreadableLoaderOptions();
+ ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, ContentSecurityPolicyEnforcement, String&& initiator, ResponseFilteringPolicy);
+ ~ThreadableLoaderOptions();
- ThreadableLoaderOptions isolatedCopy() const;
+ ThreadableLoaderOptions isolatedCopy() const;
- PreflightPolicy preflightPolicy { ConsiderPreflight };
- ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
- String initiator; // This cannot be an AtomicString, as isolatedCopy() wouldn't create an object that's safe for passing to another thread.
- ResponseFilteringPolicy filteringPolicy { ResponseFilteringPolicy::Disable };
-};
+ PreflightPolicy preflightPolicy { ConsiderPreflight };
+ ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
+ String initiator; // This cannot be an AtomicString, as isolatedCopy() wouldn't create an object that's safe for passing to another thread.
+ ResponseFilteringPolicy filteringPolicy { ResponseFilteringPolicy::Disable };
+ };
-// Useful for doing loader operations from any thread (not threadsafe,
-// just able to run on threads other than the main thread).
-class ThreadableLoader {
- WTF_MAKE_NONCOPYABLE(ThreadableLoader);
-public:
- static void loadResourceSynchronously(ScriptExecutionContext&, ResourceRequest&&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
- static RefPtr<ThreadableLoader> create(ScriptExecutionContext&, ThreadableLoaderClient&, ResourceRequest&&, const ThreadableLoaderOptions&, String&& referrer = String());
+ // Useful for doing loader operations from any thread (not threadsafe,
+ // just able to run on threads other than the main thread).
+ class ThreadableLoader {
+ WTF_MAKE_NONCOPYABLE(ThreadableLoader);
+ public:
+ static void loadResourceSynchronously(ScriptExecutionContext&, ResourceRequest&&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
+ static RefPtr<ThreadableLoader> create(ScriptExecutionContext&, ThreadableLoaderClient&, ResourceRequest&&, const ThreadableLoaderOptions&, String&& referrer = String());
- virtual void cancel() = 0;
- void ref() { refThreadableLoader(); }
- void deref() { derefThreadableLoader(); }
+ virtual void cancel() = 0;
+ void ref() { refThreadableLoader(); }
+ void deref() { derefThreadableLoader(); }
- static void logError(ScriptExecutionContext&, const ResourceError&, const String&);
+ static void logError(ScriptExecutionContext&, const ResourceError&, const String&);
-protected:
- ThreadableLoader() { }
- virtual ~ThreadableLoader() { }
- virtual void refThreadableLoader() = 0;
- virtual void derefThreadableLoader() = 0;
-};
+ protected:
+ ThreadableLoader() { }
+ virtual ~ThreadableLoader() { }
+ virtual void refThreadableLoader() = 0;
+ virtual void derefThreadableLoader() = 0;
+ };
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/ThreadableLoaderClient.h (221645 => 221646)
--- trunk/Source/WebCore/loader/ThreadableLoaderClient.h 2017-09-05 23:28:54 UTC (rev 221645)
+++ trunk/Source/WebCore/loader/ThreadableLoaderClient.h 2017-09-05 23:33:49 UTC (rev 221646)
@@ -32,24 +32,24 @@
namespace WebCore {
-class ResourceError;
-class ResourceResponse;
-class ResourceTiming;
+ class ResourceError;
+ class ResourceResponse;
+ class ResourceTiming;
-class ThreadableLoaderClient {
- WTF_MAKE_NONCOPYABLE(ThreadableLoaderClient);
-public:
- virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
+ class ThreadableLoaderClient {
+ WTF_MAKE_NONCOPYABLE(ThreadableLoaderClient); WTF_MAKE_FAST_ALLOCATED;
+ public:
+ virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
- virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&) { }
- virtual void didReceiveData(const char*, int /*dataLength*/) { }
- virtual void didFinishLoading(unsigned long /*identifier*/) { }
- virtual void didFail(const ResourceError&) { }
- virtual void didFinishTiming(const ResourceTiming&) { }
+ virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&) { }
+ virtual void didReceiveData(const char*, int /*dataLength*/) { }
+ virtual void didFinishLoading(unsigned long /*identifier*/) { }
+ virtual void didFail(const ResourceError&) { }
+ virtual void didFinishTiming(const ResourceTiming&) { }
-protected:
- ThreadableLoaderClient() { }
- virtual ~ThreadableLoaderClient() { }
-};
+ protected:
+ ThreadableLoaderClient() { }
+ virtual ~ThreadableLoaderClient() { }
+ };
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp (221645 => 221646)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp 2017-09-05 23:28:54 UTC (rev 221645)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp 2017-09-05 23:33:49 UTC (rev 221646)
@@ -82,19 +82,23 @@
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 request = ResourceRequest { m_jobData.scriptURL };
+ auto fetchHeaders = FetchHeaders::create();
auto referrer = m_jobData.clientCreationURL.string();
- m_loader = ThreadableLoader::create(context, *this, WTFMove(request), { }, WTFMove(referrer));
+ auto fetchRequest = FetchRequest::create(context, std::nullopt, WTFMove(fetchHeaders), { m_jobData.scriptURL }, { }, WTFMove(referrer));
+
+ m_fetchLoader->start(context, fetchRequest);
}
-void ServiceWorkerJob::didReceiveResponse(unsigned long, const ResourceResponse& response)
+void ServiceWorkerJob::didReceiveResponse(const ResourceResponse& response)
{
ASSERT(currentThread() == m_creationThread);
ASSERT(!m_completed);
- ASSERT(m_loader);
+ ASSERT(m_fetchLoader);
ASSERT(!m_scriptData);
m_lastResponse = response;
@@ -105,11 +109,11 @@
}
}
-void ServiceWorkerJob::didReceiveData(const char* data, int size)
+void ServiceWorkerJob::didReceiveData(const char* data, size_t size)
{
ASSERT(currentThread() == m_creationThread);
ASSERT(!m_completed);
- ASSERT(m_loader);
+ ASSERT(m_fetchLoader);
if (!m_scriptData)
m_scriptData = SharedBuffer::create();
@@ -117,16 +121,16 @@
m_scriptData->get().append(data, size);
}
-void ServiceWorkerJob::didFinishLoading(unsigned long)
+void ServiceWorkerJob::didSucceed()
{
ASSERT(currentThread() == m_creationThread);
ASSERT(!m_completed);
- ASSERT(m_loader);
+ ASSERT(m_fetchLoader);
if (!m_scriptData)
m_scriptData = SharedBuffer::create();
m_client->jobFinishedLoadingScript(*this, WTFMove(*m_scriptData));
- m_loader = nullptr;
+ m_fetchLoader = nullptr;
}
void ServiceWorkerJob::didFail(const ResourceError& error)
@@ -133,10 +137,10 @@
{
ASSERT(currentThread() == m_creationThread);
ASSERT(!m_completed);
- ASSERT(m_loader);
+ ASSERT(m_fetchLoader);
m_client->jobFailedLoadingScript(*this, error);
- m_loader = nullptr;
+ m_fetchLoader = nullptr;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJob.h (221645 => 221646)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJob.h 2017-09-05 23:28:54 UTC (rev 221645)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJob.h 2017-09-05 23:33:49 UTC (rev 221646)
@@ -27,11 +27,11 @@
#if ENABLE(SERVICE_WORKER)
+#include "FetchLoader.h"
+#include "FetchLoaderClient.h"
#include "ResourceResponse.h"
#include "ServiceWorkerJobClient.h"
#include "ServiceWorkerJobData.h"
-#include "ThreadableLoader.h"
-#include "ThreadableLoaderClient.h"
#include <wtf/RefPtr.h>
#include <wtf/RunLoop.h>
#include <wtf/ThreadSafeRefCounted.h>
@@ -45,7 +45,7 @@
enum class ServiceWorkerJobType;
struct ServiceWorkerRegistrationData;
-class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public ThreadableLoaderClient {
+class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public FetchLoaderClient {
public:
static Ref<ServiceWorkerJob> create(ServiceWorkerJobClient& client, Ref<DeferredPromise>&& promise, ServiceWorkerJobData&& jobData)
{
@@ -66,10 +66,10 @@
private:
ServiceWorkerJob(ServiceWorkerJobClient&, Ref<DeferredPromise>&&, ServiceWorkerJobData&&);
- // ThreadableLoaderClient
- void didReceiveResponse(unsigned long identifier, const ResourceResponse&) final;
- void didReceiveData(const char* data, int length) final;
- void didFinishLoading(unsigned long identifier) final;
+ // 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;
@@ -79,7 +79,7 @@
bool m_completed { false };
Ref<RunLoop> m_runLoop { RunLoop::current() };
- RefPtr<ThreadableLoader> m_loader;
+ std::unique_ptr<FetchLoader> m_fetchLoader;
ResourceResponse m_lastResponse;
std::optional<Ref<SharedBuffer>> m_scriptData;
Modified: trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp (221645 => 221646)
--- trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp 2017-09-05 23:28:54 UTC (rev 221645)
+++ trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp 2017-09-05 23:33:49 UTC (rev 221646)
@@ -31,7 +31,6 @@
#include "ExceptionData.h"
#include "ServiceWorkerFetchResult.h"
#include "ServiceWorkerJobData.h"
-#include "SharedBuffer.h"
namespace WebCore {