Diff
Modified: trunk/LayoutTests/ChangeLog (223980 => 223981)
--- trunk/LayoutTests/ChangeLog 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/LayoutTests/ChangeLog 2017-10-25 21:17:46 UTC (rev 223981)
@@ -1,3 +1,15 @@
+2017-10-25 Youenn Fablet <[email protected]>
+
+ Enable ServiceWorker to fetch resources
+ https://bugs.webkit.org/show_bug.cgi?id=178673
+
+ Reviewed by Brady Eidson.
+
+ * http/tests/workers/service/resources/service-worker-fetch-worker.js: Added.
+ * http/tests/workers/service/resources/service-worker-fetch.js: Added.
+ * http/tests/workers/service/service-worker-fetch-expected.txt: Added.
+ * http/tests/workers/service/service-worker-fetch.html: Added.
+
2017-10-25 Jer Noble <[email protected]>
UNPACK_FLIP_Y is broken for MSE-backed videos
Added: trunk/LayoutTests/http/tests/workers/service/resources/service-worker-fetch-worker.js (0 => 223981)
--- trunk/LayoutTests/http/tests/workers/service/resources/service-worker-fetch-worker.js (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/service-worker-fetch-worker.js 2017-10-25 21:17:46 UTC (rev 223981)
@@ -0,0 +1,14 @@
+var status = "no status";
+self.addEventListener("fetch", (event) => {
+ if (event.request.url.indexOf("status") !== -1) {
+ event.respondWith(new Response(null, {status: 200, statusText: status}));
+ return;
+ }
+ if (!event.request.url.endsWith(".fromserviceworker")) {
+ state = "unknown url";
+ event.respondWith(new Response(null, {status: 404, statusText: "Not Found"}));
+ return;
+ }
+ status = event.request.url.substring(0, event.request.url.length - 18) + " through " + "fetch";
+ event.respondWith(fetch(event.request.url.substring(0, event.request.url.length - 18)));
+});
Added: trunk/LayoutTests/http/tests/workers/service/resources/service-worker-fetch.js (0 => 223981)
--- trunk/LayoutTests/http/tests/workers/service/resources/service-worker-fetch.js (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/service-worker-fetch.js 2017-10-25 21:17:46 UTC (rev 223981)
@@ -0,0 +1,30 @@
+function done()
+{
+ finishSWTest();
+}
+
+async function logStatus()
+{
+ var response = await fetch("status");
+ log("Status is " + response.statusText);
+}
+
+async function test()
+{
+ try {
+ await navigator.serviceWorker.register("resources/service-worker-fetch-worker.js", { });
+
+ await logStatus();
+
+ var response = await fetch("/resources/square100.png.fromserviceworker");
+ var buffer = await response.arrayBuffer();
+ log("Got response with buffer byte length being " + buffer.byteLength);
+
+ await logStatus();
+ } catch(e) {
+ log("Got exception: " + e);
+ }
+ finishSWTest();
+}
+
+test();
Added: trunk/LayoutTests/http/tests/workers/service/service-worker-fetch-expected.txt (0 => 223981)
--- trunk/LayoutTests/http/tests/workers/service/service-worker-fetch-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-fetch-expected.txt 2017-10-25 21:17:46 UTC (rev 223981)
@@ -0,0 +1,4 @@
+Status is no status
+Got response with buffer byte length being 12940
+Status is http://127.0.0.1:8000/resources/square100.png through fetch
+
Added: trunk/LayoutTests/http/tests/workers/service/service-worker-fetch.html (0 => 223981)
--- trunk/LayoutTests/http/tests/workers/service/service-worker-fetch.html (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-fetch.html 2017-10-25 21:17:46 UTC (rev 223981)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (223980 => 223981)
--- trunk/Source/WebCore/ChangeLog 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/ChangeLog 2017-10-25 21:17:46 UTC (rev 223981)
@@ -1,3 +1,45 @@
+2017-10-25 Youenn Fablet <[email protected]>
+
+ Enable ServiceWorker to fetch resources
+ https://bugs.webkit.org/show_bug.cgi?id=178673
+
+ Reviewed by Brady Eidson.
+
+ Test: http/tests/workers/service/service-worker-fetch.html
+
+ Allow reusing of EmptyFrameLoaderClient for network loading in WebKit Service Worker environment.
+ Allow overriding the creation of a document loader, pageID, frameID and sessionID getters.
+
+ Allow the possibility to create synthetic documents for all ports.
+
+ Beefing up ServiceWorkerThreadProxy as it owns a Document and a Page that do nothing but server
+ the purpose of loading resources for a service worker thread.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/DocumentLoader.h:
+ (WebCore::DocumentLoader::setResponse):
+ * loader/EmptyClients.cpp:
+ (WebCore::EmptyFrameLoaderClient::sessionID const):
+ (WebCore::EmptyFrameLoaderClient::createNetworkingContext):
+ (WebCore::createEmptyFrameNetworkingContext):
+ * loader/EmptyClients.h:
+ * loader/EmptyFrameLoaderClient.h: Added.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::initForSynthesizedDocument):
+ * loader/FrameLoader.h:
+ * loader/FrameLoaderClient.h:
+ * workers/service/context/ServiceWorkerThread.cpp:
+ (WebCore::ServiceWorkerThread::ServiceWorkerThread):
+ (WebCore::m_workerObjectProxy):
+ * workers/service/context/ServiceWorkerThread.h:
+ * workers/service/context/ServiceWorkerThreadProxy.cpp:
+ (WebCore::ServiceWorkerThreadProxy::create):
+ (WebCore::createPageForServiceWorker):
+ (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
+ (WebCore::ServiceWorkerThreadProxy::postTaskToLoader):
+ * workers/service/context/ServiceWorkerThreadProxy.h:
+ Test: http/tests/workers/service/service-worker-fetch.html
+
2017-10-25 Jer Noble <[email protected]>
UNPACK_FLIP_Y is broken for MSE-backed videos
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (223980 => 223981)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-25 21:17:46 UTC (rev 223981)
@@ -1347,6 +1347,7 @@
413E007C1DB0E70A002341D2 /* MemoryReleaseCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 413E007B1DB0E707002341D2 /* MemoryReleaseCocoa.mm */; };
414B82051D6DF0E50077EBE3 /* StructuredClone.h in Headers */ = {isa = PBXBuildFile; fileRef = 414B82031D6DF0D90077EBE3 /* StructuredClone.h */; };
414C25D71E9EFEDE00BEE141 /* H264VideoToolBoxEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 414C25D61E9EF7C000BEE141 /* H264VideoToolBoxEncoder.mm */; };
+ 414DEDE71F9FE91E0047C40D /* EmptyFrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 414DEDE51F9FE9150047C40D /* EmptyFrameLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
415071581685067300C3C7B3 /* SelectorFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 415071561685067300C3C7B3 /* SelectorFilter.h */; };
415080361E3F00AD0051D75D /* LibWebRTCAudioModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415080341E3F00AA0051D75D /* LibWebRTCAudioModule.cpp */; };
415080371E3F00B00051D75D /* LibWebRTCAudioModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 415080351E3F00AA0051D75D /* LibWebRTCAudioModule.h */; };
@@ -4291,7 +4292,7 @@
B25599850D00D8BA00BB825C /* SVGFEImage.h in Headers */ = {isa = PBXBuildFile; fileRef = B25598EB0D00D8B900BB825C /* SVGFEImage.h */; };
B25599A30D00D8BA00BB825C /* SVGImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B255990B0D00D8B900BB825C /* SVGImage.cpp */; };
B25599A40D00D8BA00BB825C /* SVGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990C0D00D8B900BB825C /* SVGImage.h */; };
- B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990D0D00D8B900BB825C /* EmptyClients.h */; };
+ B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */ = {isa = PBXBuildFile; fileRef = B255990D0D00D8B900BB825C /* EmptyClients.h */; settings = {ATTRIBUTES = (Private, ); }; };
B27535580B053814002CE64F /* TransformationMatrixCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B275352A0B053814002CE64F /* TransformationMatrixCG.cpp */; };
B27535590B053814002CE64F /* FloatPointCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B275352B0B053814002CE64F /* FloatPointCG.cpp */; };
B275355A0B053814002CE64F /* FloatRectCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B275352C0B053814002CE64F /* FloatRectCG.cpp */; };
@@ -8091,6 +8092,7 @@
414B82031D6DF0D90077EBE3 /* StructuredClone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructuredClone.h; sourceTree = "<group>"; };
414C25D51E9EF7C000BEE141 /* H264VideoToolBoxEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = H264VideoToolBoxEncoder.h; path = libwebrtc/H264VideoToolBoxEncoder.h; sourceTree = "<group>"; };
414C25D61E9EF7C000BEE141 /* H264VideoToolBoxEncoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = H264VideoToolBoxEncoder.mm; path = libwebrtc/H264VideoToolBoxEncoder.mm; sourceTree = "<group>"; };
+ 414DEDE51F9FE9150047C40D /* EmptyFrameLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyFrameLoaderClient.h; sourceTree = "<group>"; };
415071551685067300C3C7B3 /* SelectorFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectorFilter.cpp; sourceTree = "<group>"; };
415071561685067300C3C7B3 /* SelectorFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorFilter.h; sourceTree = "<group>"; };
415080341E3F00AA0051D75D /* LibWebRTCAudioModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCAudioModule.cpp; path = libwebrtc/LibWebRTCAudioModule.cpp; sourceTree = "<group>"; };
@@ -23882,6 +23884,7 @@
9738899F116EA9DC00ADF313 /* DocumentWriter.h */,
F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */,
B255990D0D00D8B900BB825C /* EmptyClients.h */,
+ 414DEDE51F9FE9150047C40D /* EmptyFrameLoaderClient.h */,
41AD75391CEF6BCE00A31486 /* FetchOptions.h */,
656D37230ADBA5DE00A4554D /* FormState.cpp */,
656D37220ADBA5DE00A4554D /* FormState.h */,
@@ -27292,6 +27295,7 @@
A8CFF6BE0A156118000A4234 /* EllipsisBox.h in Headers */,
F55B3DBC1251F12D003EF269 /* EmailInputType.h in Headers */,
B25599A50D00D8BA00BB825C /* EmptyClients.h in Headers */,
+ 414DEDE71F9FE91E0047C40D /* EmptyFrameLoaderClient.h in Headers */,
515BE1901D54F5FB00DD7C68 /* EmptyGamepadProvider.h in Headers */,
FD31609312B026F700C1A359 /* EqualPowerPanner.h in Headers */,
8371AC3B1F509BE400FBF284 /* ErrorCallback.h in Headers */,
Modified: trunk/Source/WebCore/loader/DocumentLoader.h (223980 => 223981)
--- trunk/Source/WebCore/loader/DocumentLoader.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/loader/DocumentLoader.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -144,10 +144,9 @@
const ResourceError& mainDocumentError() const { return m_mainDocumentError; }
const ResourceResponse& response() const { return m_response; }
-#if PLATFORM(IOS)
+
// FIXME: This method seems to violate the encapsulation of this class.
void setResponse(const ResourceResponse& response) { m_response = response; }
-#endif
bool isClientRedirect() const { return m_isClientRedirect; }
void setIsClientRedirect(bool isClientRedirect) { m_isClientRedirect = isClientRedirect; }
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (223980 => 223981)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -38,6 +38,7 @@
#include "DocumentLoader.h"
#include "DragClient.h"
#include "EditorClient.h"
+#include "EmptyFrameLoaderClient.h"
#include "FileChooser.h"
#include "FormState.h"
#include "Frame.h"
@@ -271,176 +272,6 @@
EmptyTextCheckerClient m_textCheckerClient;
};
-class EmptyFrameLoaderClient final : public FrameLoaderClient {
- void frameLoaderDestroyed() final { }
-
- bool hasWebView() const final { return true; } // mainly for assertions
-
- void makeRepresentation(DocumentLoader*) final { }
-#if PLATFORM(IOS)
- bool forceLayoutOnRestoreFromPageCache() final { return false; }
-#endif
- void forceLayoutForNonHTML() final { }
-
- void setCopiesOnScroll() final { }
-
- void detachedFromParent2() final { }
- void detachedFromParent3() final { }
-
- void convertMainResourceLoadToDownload(DocumentLoader*, PAL::SessionID, const ResourceRequest&, const ResourceResponse&) final { }
-
- void assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const ResourceRequest&) final { }
- bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) final { return false; }
- void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) final { }
- void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) final { }
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
- bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) final { return false; }
-#endif
-
-#if PLATFORM(IOS)
- RetainPtr<CFDictionaryRef> connectionProperties(DocumentLoader*, unsigned long) final { return nullptr; }
-#endif
-
- void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) final { }
- void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) final { }
- void dispatchDidFinishLoading(DocumentLoader*, unsigned long) final { }
-#if ENABLE(DATA_DETECTION)
- void dispatchDidFinishDataDetection(NSArray *) final { }
-#endif
- void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) final { }
- bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) final { return false; }
-
- void dispatchDidDispatchOnloadEvents() final { }
- void dispatchDidReceiveServerRedirectForProvisionalLoad() final { }
- void dispatchDidCancelClientRedirect() final { }
- void dispatchWillPerformClientRedirect(const URL&, double, double) final { }
- void dispatchDidChangeLocationWithinPage() final { }
- void dispatchDidPushStateWithinPage() final { }
- void dispatchDidReplaceStateWithinPage() final { }
- void dispatchDidPopStateWithinPage() final { }
- void dispatchWillClose() final { }
- void dispatchDidStartProvisionalLoad() final { }
- void dispatchDidReceiveTitle(const StringWithDirection&) final { }
- void dispatchDidCommitLoad(std::optional<HasInsecureContent>) final { }
- void dispatchDidFailProvisionalLoad(const ResourceError&) final { }
- void dispatchDidFailLoad(const ResourceError&) final { }
- void dispatchDidFinishDocumentLoad() final { }
- void dispatchDidFinishLoad() final { }
- void dispatchDidReachLayoutMilestone(LayoutMilestones) final { }
-
- Frame* dispatchCreatePage(const NavigationAction&) final { return nullptr; }
- void dispatchShow() final { }
-
- void dispatchDecidePolicyForResponse(const ResourceResponse&, const ResourceRequest&, FramePolicyFunction&&) final { }
- void dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, FramePolicyFunction&&) final;
- void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, bool didReceiveRedirectResponse, FormState*, FramePolicyFunction&&) final;
- void cancelPolicyCheck() final { }
-
- void dispatchUnableToImplementPolicy(const ResourceError&) final { }
-
- void dispatchWillSendSubmitEvent(Ref<FormState>&&) final;
- void dispatchWillSubmitForm(FormState&, WTF::Function<void(void)>&&) final;
-
- void revertToProvisionalState(DocumentLoader*) final { }
- void setMainDocumentError(DocumentLoader*, const ResourceError&) final { }
-
- void setMainFrameDocumentReady(bool) final { }
-
- void startDownload(const ResourceRequest&, const String&) final { }
-
- void willChangeTitle(DocumentLoader*) final { }
- void didChangeTitle(DocumentLoader*) final { }
-
- void willReplaceMultipartContent() final { }
- void didReplaceMultipartContent() final { }
-
- void committedLoad(DocumentLoader*, const char*, int) final { }
- void finishedLoading(DocumentLoader*) final { }
-
- ResourceError cancelledError(const ResourceRequest&) final { return { ResourceError::Type::Cancellation }; }
- ResourceError blockedError(const ResourceRequest&) final { return { }; }
- ResourceError blockedByContentBlockerError(const ResourceRequest&) final { return { }; }
- ResourceError cannotShowURLError(const ResourceRequest&) final { return { }; }
- ResourceError interruptedForPolicyChangeError(const ResourceRequest&) final { return { }; }
-#if ENABLE(CONTENT_FILTERING)
- ResourceError blockedByContentFilterError(const ResourceRequest&) final { return { }; }
-#endif
-
- ResourceError cannotShowMIMETypeError(const ResourceResponse&) final { return { }; }
- ResourceError fileDoesNotExistError(const ResourceResponse&) final { return { }; }
- ResourceError pluginWillHandleLoadError(const ResourceResponse&) final { return { }; }
-
- bool shouldFallBack(const ResourceError&) final { return false; }
-
- bool canHandleRequest(const ResourceRequest&) const final { return false; }
- bool canShowMIMEType(const String&) const final { return false; }
- bool canShowMIMETypeAsHTML(const String&) const final { return false; }
- bool representationExistsForURLScheme(const String&) const final { return false; }
- String generatedMIMETypeForURLScheme(const String&) const final { return emptyString(); }
-
- void frameLoadCompleted() final { }
- void restoreViewState() final { }
- void provisionalLoadStarted() final { }
- void didFinishLoad() final { }
- void prepareForDataSourceReplacement() final { }
-
- Ref<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) final;
- void updateCachedDocumentLoader(DocumentLoader&) final { }
- void setTitle(const StringWithDirection&, const URL&) final { }
-
- String userAgent(const URL&) final { return emptyString(); }
-
- void savePlatformDataToCachedFrame(CachedFrame*) final { }
- void transitionToCommittedFromCachedFrame(CachedFrame*) final { }
-#if PLATFORM(IOS)
- void didRestoreFrameHierarchyForCachedFrame() final { }
-#endif
- void transitionToCommittedForNewPage() final { }
-
- void didSaveToPageCache() final { }
- void didRestoreFromPageCache() final { }
-
- void dispatchDidBecomeFrameset(bool) final { }
-
- void updateGlobalHistory() final { }
- void updateGlobalHistoryRedirectLinks() final { }
- bool shouldGoToHistoryItem(HistoryItem*) const final { return false; }
- void updateGlobalHistoryItemForPage() final { }
- void saveViewStateToItem(HistoryItem&) final { }
- bool canCachePage() const final { return false; }
- void didDisplayInsecureContent() final { }
- void didRunInsecureContent(SecurityOrigin&, const URL&) final { }
- void didDetectXSS(const URL&, bool) final { }
- RefPtr<Frame> createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&, bool, int, int) final;
- RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool) final;
- void recreatePlugin(Widget*) final;
- RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&) final;
-
- ObjectContentType objectContentType(const URL&, const String&) final { return ObjectContentType::None; }
- String overrideMediaType() const final { return { }; }
-
- void redirectDataToPlugin(Widget&) final { }
- void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld&) final { }
-
-#if PLATFORM(COCOA)
- RemoteAXObjectRef accessibilityRemoteObject() final { return nullptr; }
- NSCachedURLResponse *willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse *response) const final { return response; }
-#endif
-
-#if PLATFORM(WIN) && USE(CFURLCONNECTION)
- bool shouldCacheResponse(DocumentLoader*, unsigned long, const ResourceResponse&, const unsigned char*, unsigned long long) final { return true; }
-#endif
-
- Ref<FrameNetworkingContext> createNetworkingContext() final;
-
- bool isEmptyFrameLoaderClient() final { return true; }
- void prefetchDNS(const String&) final { }
-
-#if USE(QUICK_LOOK)
- RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) final { return nullptr; }
-#endif
-};
-
class EmptyFrameNetworkingContext final : public FrameNetworkingContext {
public:
static Ref<EmptyFrameNetworkingContext> create() { return adoptRef(*new EmptyFrameNetworkingContext); }
@@ -594,6 +425,11 @@
{
}
+PAL::SessionID EmptyFrameLoaderClient::sessionID() const
+{
+ return PAL::SessionID::defaultSessionID();
+}
+
void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, FramePolicyFunction&&)
{
}
@@ -644,6 +480,11 @@
return EmptyFrameNetworkingContext::create();
}
+Ref<FrameNetworkingContext> createEmptyFrameNetworkingContext()
+{
+ return EmptyFrameNetworkingContext::create();
+}
+
void EmptyEditorClient::EmptyTextCheckerClient::requestCheckingOfString(TextCheckingRequest&, const VisibleSelection&)
{
}
Modified: trunk/Source/WebCore/loader/EmptyClients.h (223980 => 223981)
--- trunk/Source/WebCore/loader/EmptyClients.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -203,8 +203,11 @@
RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; }
};
-void fillWithEmptyClients(PageConfiguration&);
-UniqueRef<EditorClient> createEmptyEditorClient();
+WEBCORE_EXPORT void fillWithEmptyClients(PageConfiguration&);
+WEBCORE_EXPORT UniqueRef<EditorClient> createEmptyEditorClient();
DiagnosticLoggingClient& emptyDiagnosticLoggingClient();
+class EmptyFrameNetworkingContext;
+WEBCORE_EXPORT Ref<FrameNetworkingContext> createEmptyFrameNetworkingContext();
+
}
Added: trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h (0 => 223981)
--- trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h (rev 0)
+++ trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -0,0 +1,205 @@
+/*
+ * 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. ``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
+ * 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.
+ */
+
+#include "FrameLoaderClient.h"
+
+namespace WebCore {
+
+class WEBCORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient {
+ Ref<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) override;
+
+ void frameLoaderDestroyed() final { }
+
+ uint64_t frameID() const override { return 0; }
+ uint64_t pageID() const override { return 0; }
+ PAL::SessionID sessionID() const override;
+
+ bool hasWebView() const final { return true; } // mainly for assertions
+
+ void makeRepresentation(DocumentLoader*) final { }
+#if PLATFORM(IOS)
+ bool forceLayoutOnRestoreFromPageCache() final { return false; }
+#endif
+ void forceLayoutForNonHTML() final { }
+
+ void setCopiesOnScroll() final { }
+
+ void detachedFromParent2() final { }
+ void detachedFromParent3() final { }
+
+ void convertMainResourceLoadToDownload(DocumentLoader*, PAL::SessionID, const ResourceRequest&, const ResourceResponse&) final { }
+
+ void assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const ResourceRequest&) final { }
+ bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) final { return false; }
+ void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) final { }
+ void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) final { }
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+ bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) final { return false; }
+#endif
+
+#if PLATFORM(IOS)
+ RetainPtr<CFDictionaryRef> connectionProperties(DocumentLoader*, unsigned long) final { return nullptr; }
+#endif
+
+ void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) final { }
+ void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) final { }
+ void dispatchDidFinishLoading(DocumentLoader*, unsigned long) final { }
+#if ENABLE(DATA_DETECTION)
+ void dispatchDidFinishDataDetection(NSArray *) final { }
+#endif
+ void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) final { }
+ bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) final { return false; }
+
+ void dispatchDidDispatchOnloadEvents() final { }
+ void dispatchDidReceiveServerRedirectForProvisionalLoad() final { }
+ void dispatchDidCancelClientRedirect() final { }
+ void dispatchWillPerformClientRedirect(const URL&, double, double) final { }
+ void dispatchDidChangeLocationWithinPage() final { }
+ void dispatchDidPushStateWithinPage() final { }
+ void dispatchDidReplaceStateWithinPage() final { }
+ void dispatchDidPopStateWithinPage() final { }
+ void dispatchWillClose() final { }
+ void dispatchDidStartProvisionalLoad() final { }
+ void dispatchDidReceiveTitle(const StringWithDirection&) final { }
+ void dispatchDidCommitLoad(std::optional<HasInsecureContent>) final { }
+ void dispatchDidFailProvisionalLoad(const ResourceError&) final { }
+ void dispatchDidFailLoad(const ResourceError&) final { }
+ void dispatchDidFinishDocumentLoad() final { }
+ void dispatchDidFinishLoad() final { }
+ void dispatchDidReachLayoutMilestone(LayoutMilestones) final { }
+
+ Frame* dispatchCreatePage(const NavigationAction&) final { return nullptr; }
+ void dispatchShow() final { }
+
+ void dispatchDecidePolicyForResponse(const ResourceResponse&, const ResourceRequest&, FramePolicyFunction&&) final { }
+ void dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, FramePolicyFunction&&) final;
+ void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, bool didReceiveRedirectResponse, FormState*, FramePolicyFunction&&) final;
+ void cancelPolicyCheck() final { }
+
+ void dispatchUnableToImplementPolicy(const ResourceError&) final { }
+
+ void dispatchWillSendSubmitEvent(Ref<FormState>&&) final;
+ void dispatchWillSubmitForm(FormState&, WTF::Function<void(void)>&&) final;
+
+ void revertToProvisionalState(DocumentLoader*) final { }
+ void setMainDocumentError(DocumentLoader*, const ResourceError&) final { }
+
+ void setMainFrameDocumentReady(bool) final { }
+
+ void startDownload(const ResourceRequest&, const String&) final { }
+
+ void willChangeTitle(DocumentLoader*) final { }
+ void didChangeTitle(DocumentLoader*) final { }
+
+ void willReplaceMultipartContent() final { }
+ void didReplaceMultipartContent() final { }
+
+ void committedLoad(DocumentLoader*, const char*, int) final { }
+ void finishedLoading(DocumentLoader*) final { }
+
+ ResourceError cancelledError(const ResourceRequest&) final { return { ResourceError::Type::Cancellation }; }
+ ResourceError blockedError(const ResourceRequest&) final { return { }; }
+ ResourceError blockedByContentBlockerError(const ResourceRequest&) final { return { }; }
+ ResourceError cannotShowURLError(const ResourceRequest&) final { return { }; }
+ ResourceError interruptedForPolicyChangeError(const ResourceRequest&) final { return { }; }
+#if ENABLE(CONTENT_FILTERING)
+ ResourceError blockedByContentFilterError(const ResourceRequest&) final { return { }; }
+#endif
+
+ ResourceError cannotShowMIMETypeError(const ResourceResponse&) final { return { }; }
+ ResourceError fileDoesNotExistError(const ResourceResponse&) final { return { }; }
+ ResourceError pluginWillHandleLoadError(const ResourceResponse&) final { return { }; }
+
+ bool shouldFallBack(const ResourceError&) final { return false; }
+
+ bool canHandleRequest(const ResourceRequest&) const final { return false; }
+ bool canShowMIMEType(const String&) const final { return false; }
+ bool canShowMIMETypeAsHTML(const String&) const final { return false; }
+ bool representationExistsForURLScheme(const String&) const final { return false; }
+ String generatedMIMETypeForURLScheme(const String&) const final { return emptyString(); }
+
+ void frameLoadCompleted() final { }
+ void restoreViewState() final { }
+ void provisionalLoadStarted() final { }
+ void didFinishLoad() final { }
+ void prepareForDataSourceReplacement() final { }
+
+ void updateCachedDocumentLoader(DocumentLoader&) final { }
+ void setTitle(const StringWithDirection&, const URL&) final { }
+
+ String userAgent(const URL&) final { return emptyString(); }
+
+ void savePlatformDataToCachedFrame(CachedFrame*) final { }
+ void transitionToCommittedFromCachedFrame(CachedFrame*) final { }
+#if PLATFORM(IOS)
+ void didRestoreFrameHierarchyForCachedFrame() final { }
+#endif
+ void transitionToCommittedForNewPage() final { }
+
+ void didSaveToPageCache() final { }
+ void didRestoreFromPageCache() final { }
+
+ void dispatchDidBecomeFrameset(bool) final { }
+
+ void updateGlobalHistory() final { }
+ void updateGlobalHistoryRedirectLinks() final { }
+ bool shouldGoToHistoryItem(HistoryItem*) const final { return false; }
+ void updateGlobalHistoryItemForPage() final { }
+ void saveViewStateToItem(HistoryItem&) final { }
+ bool canCachePage() const final { return false; }
+ void didDisplayInsecureContent() final { }
+ void didRunInsecureContent(SecurityOrigin&, const URL&) final { }
+ void didDetectXSS(const URL&, bool) final { }
+ RefPtr<Frame> createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&, bool, int, int) final;
+ RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool) final;
+ void recreatePlugin(Widget*) final;
+ RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&) final;
+
+ ObjectContentType objectContentType(const URL&, const String&) final { return ObjectContentType::None; }
+ String overrideMediaType() const final { return { }; }
+
+ void redirectDataToPlugin(Widget&) final { }
+ void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld&) final { }
+
+#if PLATFORM(COCOA)
+ RemoteAXObjectRef accessibilityRemoteObject() final { return nullptr; }
+ NSCachedURLResponse *willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse *response) const final { return response; }
+#endif
+
+#if PLATFORM(WIN) && USE(CFURLCONNECTION)
+ bool shouldCacheResponse(DocumentLoader*, unsigned long, const ResourceResponse&, const unsigned char*, unsigned long long) final { return true; }
+#endif
+
+ Ref<FrameNetworkingContext> createNetworkingContext() final;
+
+ bool isEmptyFrameLoaderClient() final { return true; }
+ void prefetchDNS(const String&) final { }
+
+#if USE(QUICK_LOOK)
+ RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) final { return nullptr; }
+#endif
+};
+
+}
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (223980 => 223981)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -313,17 +313,16 @@
m_progressTracker = std::make_unique<FrameProgressTracker>(m_frame);
}
-#if PLATFORM(IOS)
void FrameLoader::initForSynthesizedDocument(const URL&)
{
// FIXME: We need to initialize the document URL to the specified URL. Currently the URL is empty and hence
// FrameLoader::checkCompleted() will overwrite the URL of the document to be activeDocumentLoader()->documentURL().
- RefPtr<DocumentLoader> loader = m_client.createDocumentLoader(ResourceRequest(URL(ParsedURLString, emptyString())), SubstituteData());
+ auto loader = m_client.createDocumentLoader(ResourceRequest(URL(ParsedURLString, emptyString())), SubstituteData());
loader->attachToFrame(m_frame);
loader->setResponse(ResourceResponse(URL(), ASCIILiteral("text/html"), 0, String()));
loader->setCommitted(true);
- setDocumentLoader(loader.get());
+ setDocumentLoader(loader.ptr());
m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocument);
m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
@@ -338,7 +337,6 @@
m_networkingContext = m_client.createNetworkingContext();
m_progressTracker = std::make_unique<FrameProgressTracker>(m_frame);
}
-#endif
void FrameLoader::setDefersLoading(bool defers)
{
Modified: trunk/Source/WebCore/loader/FrameLoader.h (223980 => 223981)
--- trunk/Source/WebCore/loader/FrameLoader.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -93,9 +93,7 @@
~FrameLoader();
WEBCORE_EXPORT void init();
-#if PLATFORM(IOS)
void initForSynthesizedDocument(const URL&);
-#endif
Frame& frame() const { return m_frame; }
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (223980 => 223981)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -116,7 +116,11 @@
virtual bool hasWebView() const = 0; // mainly for assertions
virtual void makeRepresentation(DocumentLoader*) = 0;
-
+
+ virtual uint64_t pageID() const = 0;
+ virtual uint64_t frameID() const = 0;
+ virtual PAL::SessionID sessionID() const = 0;
+
#if PLATFORM(IOS)
// Returns true if the client forced the layout.
virtual bool forceLayoutOnRestoreFromPageCache() = 0;
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp (223980 => 223981)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -69,7 +69,7 @@
return;
}
client->didReceiveData(result.releaseReturnValue().releaseNonNull());
- client->didFail();
+ client->didFinish();
});
return;
}
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (223980 => 223981)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -61,7 +61,6 @@
void reportPendingActivity(bool) final { };
};
-// FIXME: Use a valid WorkerLoaderProxy
// FIXME: Use a valid WorkerReportingProxy
// FIXME: Use a valid WorkerObjectProxy
// FIXME: Use a valid IDBConnection
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h (223980 => 223981)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -38,6 +38,7 @@
class ContentSecurityPolicyResponseHeaders;
class MessagePortChannel;
class SerializedScriptValue;
+class WorkerLoaderProxy;
class WorkerObjectProxy;
struct ServiceWorkerContextData;
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (223980 => 223981)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -36,15 +36,28 @@
namespace WebCore {
-Ref<ServiceWorkerThreadProxy> ServiceWorkerThreadProxy::create(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData& data, PAL::SessionID sessionID, CacheStorageProvider& cacheStorageProvider)
+Ref<ServiceWorkerThreadProxy> ServiceWorkerThreadProxy::create(PageConfiguration&& pageConfiguration, uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData& data, PAL::SessionID sessionID, CacheStorageProvider& cacheStorageProvider)
{
- auto serviceWorker = adoptRef(*new ServiceWorkerThreadProxy { serverConnectionIdentifier, data, sessionID, cacheStorageProvider });
+ auto serviceWorker = adoptRef(*new ServiceWorkerThreadProxy { WTFMove(pageConfiguration), serverConnectionIdentifier, data, sessionID, cacheStorageProvider });
serviceWorker->m_serviceWorkerThread->start();
return serviceWorker;
}
-ServiceWorkerThreadProxy::ServiceWorkerThreadProxy(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData& data, PAL::SessionID sessionID, CacheStorageProvider& cacheStorageProvider)
- : m_serviceWorkerThread(ServiceWorkerThread::create(serverConnectionIdentifier, data, sessionID, *this))
+static inline UniqueRef<Page> createPageForServiceWorker(PageConfiguration&& configuration, const URL& url)
+{
+ auto page = makeUniqueRef<Page>(WTFMove(configuration));
+ auto& mainFrame = page->mainFrame();
+ mainFrame.loader().initForSynthesizedDocument({ });
+ auto document = Document::createNonRenderedPlaceholder(&mainFrame, url);
+ document->createDOMWindow();
+ mainFrame.setDocument(WTFMove(document));
+ return page;
+}
+
+ServiceWorkerThreadProxy::ServiceWorkerThreadProxy(PageConfiguration&& pageConfiguration, uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData& data, PAL::SessionID sessionID, CacheStorageProvider& cacheStorageProvider)
+ : m_page(createPageForServiceWorker(WTFMove(pageConfiguration), data.scriptURL))
+ , m_document(*m_page->mainFrame().document())
+ , m_serviceWorkerThread(ServiceWorkerThread::create(serverConnectionIdentifier, data, sessionID, *this))
, m_cacheStorageProvider(cacheStorageProvider)
, m_sessionID(sessionID)
{
@@ -58,9 +71,11 @@
return true;
}
-void ServiceWorkerThreadProxy::postTaskToLoader(ScriptExecutionContext::Task&&)
+void ServiceWorkerThreadProxy::postTaskToLoader(ScriptExecutionContext::Task&& task)
{
- // Implement this.
+ RunLoop::main().dispatch([task = WTFMove(task), this, protectedThis = makeRef(*this)] () mutable {
+ task.performTask(m_document.get());
+ });
}
Ref<CacheStorageConnection> ServiceWorkerThreadProxy::createCacheStorageConnection()
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h (223980 => 223981)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -41,17 +41,19 @@
class ServiceWorkerThreadProxy final : public ThreadSafeRefCounted<ServiceWorkerThreadProxy>, public WorkerLoaderProxy {
public:
- WEBCORE_EXPORT static Ref<ServiceWorkerThreadProxy> create(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID, CacheStorageProvider&);
+ WEBCORE_EXPORT static Ref<ServiceWorkerThreadProxy> create(PageConfiguration&&, uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID, CacheStorageProvider&);
uint64_t identifier() const { return m_serviceWorkerThread->identifier(); }
ServiceWorkerThread& thread() { return m_serviceWorkerThread.get(); }
private:
- ServiceWorkerThreadProxy(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID, CacheStorageProvider&);
+ ServiceWorkerThreadProxy(PageConfiguration&&, uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID, CacheStorageProvider&);
bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task&&, const String& mode) final;
void postTaskToLoader(ScriptExecutionContext::Task&&) final;
Ref<CacheStorageConnection> createCacheStorageConnection() final;
+ UniqueRef<Page> m_page;
+ Ref<Document> m_document;
Ref<ServiceWorkerThread> m_serviceWorkerThread;
CacheStorageProvider& m_cacheStorageProvider;
RefPtr<CacheStorageConnection> m_cacheStorageConnection;
Modified: trunk/Source/WebKit/ChangeLog (223980 => 223981)
--- trunk/Source/WebKit/ChangeLog 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/ChangeLog 2017-10-25 21:17:46 UTC (rev 223981)
@@ -1,3 +1,59 @@
+2017-10-25 Youenn Fablet <[email protected]>
+
+ Enable ServiceWorker to fetch resources
+ https://bugs.webkit.org/show_bug.cgi?id=178673
+
+ Reviewed by Brady Eidson.
+
+ ServiceWorkerContextManager makes use of the new ServiceWorkerThreadProxy.
+ It creates the necessary environment for the thread to make use of network loads, web sockets and cache storage.
+ Fetch is functional with these changes.
+
+ ServiceWorkerProcessProxy is introduced as a UIProcess proxy to the service worker process.
+ This process proxy is responsible to give the pageID used by all service worker thread instances for network loads.
+ ServiceWorkerContextManager is responsible to give a unique frameID for all service worker threads.
+ This is necessary as these two ids are currently needed for any network load.
+
+ ServiceWorkerThreadProxy creates its own FrameLoaderClient which is now used to get pageID, frameID and sessionID.
+
+ * UIProcess/ServiceWorkerProcessProxy.cpp: Added.
+ (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
+ (WebKit::m_serviceWorkerPageID):
+ (WebKit::ServiceWorkerProcessProxy::~ServiceWorkerProcessProxy):
+ (WebKit::ServiceWorkerProcessProxy::start):
+ * UIProcess/ServiceWorkerProcessProxy.h: Added.
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::getWorkerContextProcessConnection):
+ (WebKit::WebProcessPool::createNewWebProcess):
+ (WebKit::WebProcessPool::initializeNewWebProcess):
+ (WebKit::WebProcessPool::disconnectProcess):
+ (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
+ (WebKit::WebProcessPool::createWebPage):
+ * UIProcess/WebProcessPool.h:
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::generatePageID):
+ * UIProcess/WebProcessProxy.h:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/Network/WebLoaderStrategy.cpp:
+ (WebKit::WebLoaderStrategy::scheduleLoad):
+ (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
+ (WebKit::WebLoaderStrategy::startPingLoad):
+ * WebProcess/Network/WebLoaderStrategy.h:
+ * WebProcess/Storage/ServiceWorkerContextManager.cpp:
+ (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
+ (WebKit::ServiceWorkerContextManager::startServiceWorker):
+ (WebKit::ServiceWorkerContextManager::startFetch):
+ * WebProcess/Storage/ServiceWorkerContextManager.h:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::pageID const):
+ (WebKit::WebFrameLoaderClient::frameID const):
+ (WebKit::WebFrameLoaderClient::sessionID const):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::getWorkerContextConnection):
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+
2017-10-25 Yousuke Kimoto <[email protected]>
[WinCairo] Add WebKit platform files for wincairo webkit
Copied: trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (from rev 223980, trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h) (0 => 223981)
--- trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+#include "ServiceWorkerProcessProxy.h"
+
+#include "WebPreferencesStore.h"
+#include "WebProcessMessages.h"
+
+namespace WebKit {
+
+ServiceWorkerProcessProxy::ServiceWorkerProcessProxy(WebProcessPool& pool, WebsiteDataStore& store)
+ : WebProcessProxy { pool, store }
+ , m_serviceWorkerPageID(generatePageID())
+{
+}
+
+ServiceWorkerProcessProxy::~ServiceWorkerProcessProxy()
+{
+}
+
+void ServiceWorkerProcessProxy::start(const WebPreferencesStore& store)
+{
+ send(Messages::WebProcess::GetWorkerContextConnection(m_serviceWorkerPageID, store), 0);
+}
+
+} // namespace WebKit
Copied: trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h (from rev 223980, trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h) (0 => 223981)
--- trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -0,0 +1,48 @@
+/*
+ * 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
+
+#include "WebProcessProxy.h"
+
+namespace WebKit {
+struct WebPreferencesStore;
+
+class ServiceWorkerProcessProxy final : public WebProcessProxy {
+public:
+ static Ref<ServiceWorkerProcessProxy> create(WebProcessPool& pool, WebsiteDataStore& store)
+ {
+ return adoptRef(*new ServiceWorkerProcessProxy { pool, store });
+ }
+ ~ServiceWorkerProcessProxy();
+
+ void start(const WebPreferencesStore&);
+
+private:
+ ServiceWorkerProcessProxy(WebProcessPool&, WebsiteDataStore&);
+ uint64_t m_serviceWorkerPageID { 0 };
+};
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (223980 => 223981)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -46,6 +46,7 @@
#include "NetworkProcessProxy.h"
#include "PerActivityStateCPUUsageSampler.h"
#include "SandboxExtension.h"
+#include "ServiceWorkerProcessProxy.h"
#include "StatisticsData.h"
#include "StorageProcessCreationParameters.h"
#include "StorageProcessMessages.h"
@@ -588,15 +589,18 @@
void WebProcessPool::getWorkerContextProcessConnection(StorageProcessProxy& proxy)
{
ASSERT_UNUSED(proxy, &proxy == m_storageProcess);
-
- if (m_workerContextProcess)
+
+ if (m_serviceWorkerProcess)
return;
if (!m_websiteDataStore)
m_websiteDataStore = API::WebsiteDataStore::defaultDataStore().ptr();
- auto& newProcess = createNewWebProcess(m_websiteDataStore->websiteDataStore());
- m_workerContextProcess = &newProcess;
- m_workerContextProcess->send(Messages::WebProcess::GetWorkerContextConnection(m_defaultPageGroup->preferences().store()), 0);
+
+ auto serviceWorkerProcessProxy = ServiceWorkerProcessProxy::create(*this, m_websiteDataStore->websiteDataStore());
+ m_serviceWorkerProcess = serviceWorkerProcessProxy.ptr();
+ initializeNewWebProcess(serviceWorkerProcessProxy.get(), m_websiteDataStore->websiteDataStore());
+ m_processes.append(WTFMove(serviceWorkerProcessProxy));
+ m_serviceWorkerProcess->start(m_defaultPageGroup->preferences().store());
}
void WebProcessPool::didGetWorkerContextProcessConnection(const IPC::Attachment& connection)
@@ -686,10 +690,17 @@
WebProcessProxy& WebProcessPool::createNewWebProcess(WebsiteDataStore& websiteDataStore)
{
+ auto processProxy = WebProcessProxy::create(*this, websiteDataStore);
+ auto& process = processProxy.get();
+ initializeNewWebProcess(process, websiteDataStore);
+ m_processes.append(WTFMove(processProxy));
+ return process;
+}
+
+void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDataStore& websiteDataStore)
+{
ensureNetworkProcess();
- Ref<WebProcessProxy> process = WebProcessProxy::create(*this, websiteDataStore);
-
WebProcessCreationParameters parameters;
websiteDataStore.resolveDirectoriesIfNecessary();
@@ -811,22 +822,20 @@
RefPtr<API::Object> injectedBundleInitializationUserData = m_injectedBundleClient->getInjectedBundleInitializationUserData(*this);
if (!injectedBundleInitializationUserData)
injectedBundleInitializationUserData = m_injectedBundleInitializationUserData;
- parameters.initializationUserData = UserData(process->transformObjectsToHandles(injectedBundleInitializationUserData.get()));
+ parameters.initializationUserData = UserData(process.transformObjectsToHandles(injectedBundleInitializationUserData.get()));
- process->send(Messages::WebProcess::InitializeWebProcess(parameters), 0);
+ process.send(Messages::WebProcess::InitializeWebProcess(parameters), 0);
#if PLATFORM(COCOA)
- process->send(Messages::WebProcess::SetQOS(webProcessLatencyQOS(), webProcessThroughputQOS()), 0);
+ process.send(Messages::WebProcess::SetQOS(webProcessLatencyQOS(), webProcessThroughputQOS()), 0);
#endif
if (WebPreferences::anyPagesAreUsingPrivateBrowsing())
- process->send(Messages::WebProcess::EnsurePrivateBrowsingSession(PAL::SessionID::legacyPrivateSessionID()), 0);
+ process.send(Messages::WebProcess::EnsurePrivateBrowsingSession(PAL::SessionID::legacyPrivateSessionID()), 0);
if (m_automationSession)
- process->send(Messages::WebProcess::EnsureAutomationSessionProxy(m_automationSession->sessionIdentifier()), 0);
+ process.send(Messages::WebProcess::EnsureAutomationSessionProxy(m_automationSession->sessionIdentifier()), 0);
- m_processes.append(process.ptr());
-
ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty());
#if ENABLE(REMOTE_INSPECTOR)
@@ -833,8 +842,6 @@
// Initialize remote inspector connection now that we have a sub-process that is hosting one of our web views.
Inspector::RemoteInspector::singleton();
#endif
-
- return process;
}
void WebProcessPool::warmInitialProcess()
@@ -916,8 +923,8 @@
if (m_processWithPageCache == process)
m_processWithPageCache = nullptr;
#if ENABLE(SERVICE_WORKER)
- if (m_workerContextProcess == process)
- m_workerContextProcess = nullptr;
+ if (m_serviceWorkerProcess == process)
+ m_serviceWorkerProcess = nullptr;
#endif
static_cast<WebContextSupplement*>(supplement<WebGeolocationManagerProxy>())->processDidClose(process);
@@ -949,7 +956,7 @@
if (mustMatchDataStore && &process->websiteDataStore() != &websiteDataStore)
continue;
#if ENABLE(SERVICE_WORKER)
- if (process.get() == m_workerContextProcess)
+ if (process.get() == m_serviceWorkerProcess)
continue;
#endif
// Choose the process with fewest pages.
@@ -992,7 +999,7 @@
process = &createNewWebProcessRespectingProcessCountLimit(pageConfiguration->websiteDataStore()->websiteDataStore());
#if ENABLE(SERVICE_WORKER)
- ASSERT(process.get() != m_workerContextProcess);
+ ASSERT(process.get() != m_serviceWorkerProcess);
#endif
return process->createWebPage(pageClient, WTFMove(pageConfiguration));
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (223980 => 223981)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -85,6 +85,7 @@
class HighPerformanceGraphicsUsageSampler;
class UIGamepad;
class PerActivityStateCPUUsageSampler;
+class ServiceWorkerProcessProxy;
class WebAutomationSession;
class WebContextSupplement;
class WebPageGroup;
@@ -425,6 +426,7 @@
void platformInvalidateContext();
WebProcessProxy& createNewWebProcess(WebsiteDataStore&);
+ void initializeNewWebProcess(WebProcessProxy&, WebsiteDataStore&);
void requestWebContentStatistics(StatisticsRequest*);
void requestNetworkingStatistics(StatisticsRequest*);
@@ -484,7 +486,7 @@
WebProcessProxy* m_processWithPageCache;
#if ENABLE(SERVICE_WORKER)
- WebProcessProxy* m_workerContextProcess { nullptr };
+ ServiceWorkerProcessProxy* m_serviceWorkerProcess { nullptr };
bool m_waitingForWorkerContextProcessConnection { false };
#endif
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (223980 => 223981)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -77,7 +77,7 @@
namespace WebKit {
-static uint64_t generatePageID()
+uint64_t WebProcessProxy::generatePageID()
{
static uint64_t uniquePageID;
return ++uniquePageID;
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (223980 => 223981)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -192,9 +192,11 @@
void didExceedActiveMemoryLimit();
void didExceedInactiveMemoryLimit();
-private:
+protected:
+ static uint64_t generatePageID();
explicit WebProcessProxy(WebProcessPool&, WebsiteDataStore&);
+private:
// From ChildProcessProxy
void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
void connectionWillOpen(IPC::Connection&) override;
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (223980 => 223981)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-10-25 21:17:46 UTC (rev 223981)
@@ -895,6 +895,8 @@
4131F3D51F96E9350059995A /* ServiceWorkerContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */; };
4131F3E21F9880840059995A /* WebServiceWorkerFetchTaskClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4131F3E01F98712C0059995A /* WebServiceWorkerFetchTaskClient.cpp */; };
4135FBD11F4FB8090074C47B /* CacheStorageEngineCaches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4135FBCF1F4FB7F20074C47B /* CacheStorageEngineCaches.cpp */; };
+ 414DEDD71F9EDDE50047C40D /* ServiceWorkerProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 414DEDD51F9EDDDF0047C40D /* ServiceWorkerProcessProxy.h */; };
+ 414DEDD81F9EDDE50047C40D /* ServiceWorkerProcessProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 414DEDD61F9EDDE00047C40D /* ServiceWorkerProcessProxy.cpp */; };
41897ECF1F415D620016FA42 /* WebCacheStorageConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41897ECE1F415D5C0016FA42 /* WebCacheStorageConnection.cpp */; };
41897ED01F415D650016FA42 /* WebCacheStorageProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41897ECC1F415D5C0016FA42 /* WebCacheStorageProvider.cpp */; };
41897ED11F415D680016FA42 /* WebCacheStorageConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 41897ECD1F415D5C0016FA42 /* WebCacheStorageConnection.h */; };
@@ -3196,6 +3198,10 @@
4131F3E01F98712C0059995A /* WebServiceWorkerFetchTaskClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebServiceWorkerFetchTaskClient.cpp; sourceTree = "<group>"; };
4135FBCF1F4FB7F20074C47B /* CacheStorageEngineCaches.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageEngineCaches.cpp; sourceTree = "<group>"; };
4135FBD01F4FB7F20074C47B /* CacheStorageEngineCaches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageEngineCaches.h; sourceTree = "<group>"; };
+ 414DEDC41F9E4BEB0047C40D /* ServiceWorkerFrameLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerFrameLoaderClient.h; sourceTree = "<group>"; };
+ 414DEDC51F9E4BEC0047C40D /* ServiceWorkerFrameLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerFrameLoaderClient.cpp; sourceTree = "<group>"; };
+ 414DEDD51F9EDDDF0047C40D /* ServiceWorkerProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerProcessProxy.h; sourceTree = "<group>"; };
+ 414DEDD61F9EDDE00047C40D /* ServiceWorkerProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerProcessProxy.cpp; sourceTree = "<group>"; };
41897ECB1F415D5C0016FA42 /* WebCacheStorageConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebCacheStorageConnection.messages.in; sourceTree = "<group>"; };
41897ECC1F415D5C0016FA42 /* WebCacheStorageProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebCacheStorageProvider.cpp; sourceTree = "<group>"; };
41897ECD1F415D5C0016FA42 /* WebCacheStorageConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCacheStorageConnection.h; sourceTree = "<group>"; };
@@ -6206,6 +6212,8 @@
4131F3CF1F96A9360059995A /* ServiceWorkerClientFetch.messages.in */,
4131F3D31F96E9310059995A /* ServiceWorkerContextManager.cpp */,
4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */,
+ 414DEDC51F9E4BEC0047C40D /* ServiceWorkerFrameLoaderClient.cpp */,
+ 414DEDC41F9E4BEB0047C40D /* ServiceWorkerFrameLoaderClient.h */,
4131F3E01F98712C0059995A /* WebServiceWorkerFetchTaskClient.cpp */,
419ACF9B1F981D26009F1A83 /* WebServiceWorkerFetchTaskClient.h */,
51BEB6291F3A5ACD005029B9 /* WebServiceWorkerProvider.cpp */,
@@ -7003,6 +7011,8 @@
51E6C1611F2935CD00FD3437 /* ResourceLoadStatisticsPersistentStorage.h */,
BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */,
1A30066C1110F4F70031937C /* ResponsivenessTimer.h */,
+ 414DEDD61F9EDDE00047C40D /* ServiceWorkerProcessProxy.cpp */,
+ 414DEDD51F9EDDDF0047C40D /* ServiceWorkerProcessProxy.h */,
51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */,
514BDED216C98EDD00E4E25E /* StatisticsRequest.h */,
1AA417C912C00CCA002BE67B /* TextChecker.h */,
@@ -8831,6 +8841,7 @@
514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
4131F3D51F96E9350059995A /* ServiceWorkerContextManager.h in Headers */,
460F48901F996F7100CF4B87 /* ServiceWorkerContextManagerMessages.h in Headers */,
+ 414DEDD71F9EDDE50047C40D /* ServiceWorkerProcessProxy.h in Headers */,
1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
1A002D49196B345D00B9AD44 /* SessionStateCoding.h in Headers */,
753E3E0E1887398900188496 /* SessionTracker.h in Headers */,
@@ -10425,6 +10436,7 @@
617A52D81F43A9DA00DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp in Sources */,
4131F3D41F96E9350059995A /* ServiceWorkerContextManager.cpp in Sources */,
460F488F1F996F7100CF4B87 /* ServiceWorkerContextManagerMessageReceiver.cpp in Sources */,
+ 414DEDD81F9EDDE50047C40D /* ServiceWorkerProcessProxy.cpp in Sources */,
1AFDE6591954A42B00C48FFA /* SessionState.cpp in Sources */,
1A002D48196B345D00B9AD44 /* SessionStateCoding.mm in Sources */,
1A7284481959F8040007BCE5 /* SessionStateConversion.cpp in Sources */,
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -149,17 +149,13 @@
ResourceLoadIdentifier identifier = resourceLoader.identifier();
ASSERT(identifier);
- // FIXME: Some entities in WebCore use WebCore's "EmptyFrameLoaderClient" instead of having a proper WebFrameLoaderClient.
- // EmptyFrameLoaderClient shouldn't exist and everything should be using a WebFrameLoaderClient,
- // but in the meantime we have to make sure not to mis-cast.
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(resourceLoader.frameLoader()->client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
- WebPage* webPage = webFrame ? webFrame->page() : nullptr;
+ auto& frameLoaderClient = resourceLoader.frameLoader()->client();
WebResourceLoader::TrackingParameters trackingParameters;
- trackingParameters.pageID = webPage ? webPage->pageID() : 0;
- trackingParameters.frameID = webFrame ? webFrame->frameID() : 0;
+ trackingParameters.pageID = frameLoaderClient.pageID();
+ trackingParameters.frameID = frameLoaderClient.frameID();
trackingParameters.resourceID = identifier;
+ auto sessionID = frameLoaderClient.sessionID();
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
// If the DocumentLoader schedules this as an archive resource load,
@@ -206,6 +202,9 @@
}
#endif
+ auto* webFrameLoaderClient = toWebFrameLoaderClient(resourceLoader.frameLoader()->client());
+ auto* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
+ auto* webPage = webFrame ? webFrame->page() : nullptr;
if (webPage) {
if (auto* handler = webPage->urlSchemeHandlerForScheme(resourceLoader.request().url().protocol().toStringWithoutCopying())) {
LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, URL '%s' will be handled by a UIProcess URL scheme handler.", resourceLoader.url().string().utf8().data());
@@ -217,28 +216,24 @@
}
#if ENABLE(SERVICE_WORKER)
- WebServiceWorkerProvider::singleton().handleFetch(resourceLoader, resource, webPage ? webPage->sessionID() : PAL::SessionID::defaultSessionID(), [trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime = maximumBufferingTime(resource), resourceLoader = makeRef(resourceLoader)] (ServiceWorkerClientFetch::Result result) mutable {
+ WebServiceWorkerProvider::singleton().handleFetch(resourceLoader, resource, sessionID, [trackingParameters, sessionID, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime = maximumBufferingTime(resource), resourceLoader = makeRef(resourceLoader)] (ServiceWorkerClientFetch::Result result) mutable {
if (result != ServiceWorkerClientFetch::Result::Unhandled)
return;
LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled through ServiceWorker handle fetch algorithm", resourceLoader->url().string().latin1().data());
- WebProcess::singleton().webLoaderStrategy().scheduleLoadFromNetworkProcess(resourceLoader.get(), resourceLoader->originalRequest(), WTFMove(trackingParameters), shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime);
+ WebProcess::singleton().webLoaderStrategy().scheduleLoadFromNetworkProcess(resourceLoader.get(), resourceLoader->originalRequest(), trackingParameters, sessionID, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime);
});
#else
LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled through ServiceWorker handle fetch algorithm", resourceLoader.url().string().latin1().data());
- scheduleLoadFromNetworkProcess(resourceLoader, resourceLoader.request(), trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource));
+ scheduleLoadFromNetworkProcess(resourceLoader, resourceLoader.request(), trackingParameters, sessionID, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource));
#endif
}
-void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceLoader, const ResourceRequest& request, const WebResourceLoader::TrackingParameters& trackingParameters, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime)
+void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceLoader, const ResourceRequest& request, const WebResourceLoader::TrackingParameters& trackingParameters, PAL::SessionID sessionID, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime)
{
ResourceLoadIdentifier identifier = resourceLoader.identifier();
ASSERT(identifier);
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(resourceLoader.frameLoader()->client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
- WebPage* webPage = webFrame ? webFrame->page() : nullptr;
-
LOG(NetworkScheduling, "(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled with the NetworkProcess with priority %d", resourceLoader.url().string().latin1().data(), static_cast<int>(resourceLoader.request().priority()));
ContentSniffingPolicy contentSniffingPolicy = resourceLoader.shouldSniffContent() ? SniffContent : DoNotSniffContent;
@@ -246,14 +241,14 @@
NetworkResourceLoadParameters loadParameters;
loadParameters.identifier = identifier;
- loadParameters.webPageID = webPage ? webPage->pageID() : 0;
- loadParameters.webFrameID = webFrame ? webFrame->frameID() : 0;
- loadParameters.sessionID = webPage ? webPage->sessionID() : PAL::SessionID::defaultSessionID();
+ loadParameters.webPageID = trackingParameters.pageID;
+ loadParameters.webFrameID = trackingParameters.frameID;
+ loadParameters.sessionID = sessionID;
loadParameters.request = request;
loadParameters.contentSniffingPolicy = contentSniffingPolicy;
loadParameters.storedCredentialsPolicy = storedCredentialsPolicy;
// If there is no WebFrame then this resource cannot be authenticated with the client.
- loadParameters.clientCredentialPolicy = (webFrame && webPage && resourceLoader.isAllowedToAskUserForCredentials()) ? ClientCredentialPolicy::MayAskClientForCredentials : ClientCredentialPolicy::CannotAskClientForCredentials;
+ loadParameters.clientCredentialPolicy = (loadParameters.webFrameID && loadParameters.webPageID && resourceLoader.isAllowedToAskUserForCredentials()) ? ClientCredentialPolicy::MayAskClientForCredentials : ClientCredentialPolicy::CannotAskClientForCredentials;
loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect;
loadParameters.defersLoading = resourceLoader.defersLoading();
loadParameters.needsCertificateInfo = resourceLoader.shouldIncludeCertificateInfo();
@@ -441,8 +436,6 @@
WebFrameNetworkingContext* webContext = static_cast<WebFrameNetworkingContext*>(networkingContext);
WebFrameLoaderClient* webFrameLoaderClient = webContext->webFrameLoaderClient();
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
- WebPage* webPage = webFrame ? webFrame->page() : nullptr;
auto* document = frame.document();
if (!document) {
@@ -455,7 +448,7 @@
loadParameters.identifier = generateLoadIdentifier();
loadParameters.request = request;
loadParameters.sourceOrigin = &document->securityOrigin();
- loadParameters.sessionID = webPage ? webPage->sessionID() : PAL::SessionID::defaultSessionID();
+ loadParameters.sessionID = webFrameLoaderClient ? webFrameLoaderClient->sessionID() : PAL::SessionID::defaultSessionID();
loadParameters.storedCredentialsPolicy = options.credentials == FetchOptions::Credentials::Omit ? StoredCredentialsPolicy::DoNotUse : StoredCredentialsPolicy::Use;
loadParameters.mode = options.mode;
loadParameters.shouldFollowRedirects = options.redirect == FetchOptions::Redirect::Follow;
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -77,7 +77,7 @@
void addURLSchemeTaskProxy(WebURLSchemeTaskProxy&);
void removeURLSchemeTaskProxy(WebURLSchemeTaskProxy&);
- void scheduleLoadFromNetworkProcess(WebCore::ResourceLoader&, const WebCore::ResourceRequest&, const WebResourceLoader::TrackingParameters&, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime);
+ void scheduleLoadFromNetworkProcess(WebCore::ResourceLoader&, const WebCore::ResourceRequest&, const WebResourceLoader::TrackingParameters&, PAL::SessionID, bool shouldClearReferrerOnHTTPSToHTTPRedirect, Seconds maximumBufferingTime);
private:
void scheduleLoad(WebCore::ResourceLoader&, WebCore::CachedResource*, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -33,24 +33,58 @@
#include "StorageProcessMessages.h"
#include "WebCacheStorageProvider.h"
#include "WebCoreArgumentCoders.h"
+#include "WebDocumentLoader.h"
#include "WebPreferencesKeys.h"
#include "WebPreferencesStore.h"
#include "WebProcess.h"
#include "WebServiceWorkerFetchTaskClient.h"
+#include "WebSocketProvider.h"
+#include <WebCore/EditorClient.h>
+#include <WebCore/EmptyClients.h>
+#include <WebCore/EmptyFrameLoaderClient.h>
+#include <WebCore/LibWebRTCProvider.h>
#include <WebCore/MessagePortChannel.h>
-#include <WebCore/ResourceRequest.h>
-#include <WebCore/ResourceResponse.h>
+#include <WebCore/PageConfiguration.h>
#include <WebCore/RuntimeEnabledFeatures.h>
#include <WebCore/SerializedScriptValue.h>
#include <pal/SessionID.h>
+#if USE(QUICK_LOOK)
+#include <WebCore/PreviewLoaderClient.h>
+#endif
+
using namespace PAL;
using namespace WebCore;
namespace WebKit {
-ServiceWorkerContextManager::ServiceWorkerContextManager(Ref<IPC::Connection>&& connection, const WebPreferencesStore& store)
+class ServiceWorkerFrameLoaderClient final : public EmptyFrameLoaderClient {
+public:
+ ServiceWorkerFrameLoaderClient(PAL::SessionID sessionID, uint64_t pageID, uint64_t frameID)
+ : m_sessionID(sessionID)
+ , m_pageID(pageID)
+ , m_frameID(frameID)
+ {
+ }
+
+private:
+ Ref<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) final
+ {
+ return WebDocumentLoader::create(request, substituteData);
+ }
+
+ PAL::SessionID sessionID() const final { return m_sessionID; }
+ uint64_t pageID() const final { return m_pageID; }
+ uint64_t frameID() const final { return m_frameID; }
+
+ PAL::SessionID m_sessionID;
+ uint64_t m_pageID { 0 };
+ uint64_t m_frameID { 0 };
+};
+
+ServiceWorkerContextManager::ServiceWorkerContextManager(Ref<IPC::Connection>&& connection, uint64_t pageID, const WebPreferencesStore& store)
: m_connectionToStorageProcess(WTFMove(connection))
+ , m_pageID(pageID)
{
updatePreferences(store);
}
@@ -64,9 +98,21 @@
void ServiceWorkerContextManager::startServiceWorker(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData& data)
{
// FIXME: Provide a sensical session ID.
- auto serviceWorker = ServiceWorkerThreadProxy::create(serverConnectionIdentifier, data, SessionID::defaultSessionID(), WebProcess::singleton().cacheStorageProvider());
- auto serviceWorkerIdentifier = serviceWorker->identifier();
- auto result = m_workerMap.add(serviceWorkerIdentifier, WTFMove(serviceWorker));
+ auto sessionID = PAL::SessionID::defaultSessionID();
+
+ PageConfiguration pageConfiguration {
+ createEmptyEditorClient(),
+ WebSocketProvider::create(),
+ WebCore::LibWebRTCProvider::create(),
+ WebProcess::singleton().cacheStorageProvider()
+ };
+ fillWithEmptyClients(pageConfiguration);
+ auto frameLoaderClient = std::make_unique<ServiceWorkerFrameLoaderClient>(sessionID, m_pageID, ++m_previousServiceWorkerID);
+ pageConfiguration.loaderClientForMainFrame = frameLoaderClient.release();
+
+ auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), serverConnectionIdentifier, data, sessionID, WebProcess::singleton().cacheStorageProvider());
+ auto serviceWorkerIdentifier = serviceWorkerThreadProxy->identifier();
+ auto result = m_workerMap.add(serviceWorkerIdentifier, WTFMove(serviceWorkerThreadProxy));
ASSERT_UNUSED(result, result.isNewEntry);
LOG(ServiceWorker, "Context process PID: %i started worker thread %s\n", getpid(), data.workerID.utf8().data());
@@ -76,14 +122,14 @@
void ServiceWorkerContextManager::startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options)
{
- auto serviceWorker = m_workerMap.get(serviceWorkerIdentifier);
- if (!serviceWorker) {
+ auto serviceWorkerThreadProxy = serviceWorkerIdentifier ? m_workerMap.get(serviceWorkerIdentifier) : nullptr;
+ if (!serviceWorkerThreadProxy) {
m_connectionToStorageProcess->send(Messages::StorageProcess::DidNotHandleFetch(serverConnectionIdentifier, fetchIdentifier), 0);
return;
}
auto client = WebServiceWorkerFetchTaskClient::create(m_connectionToStorageProcess.copyRef(), serverConnectionIdentifier, fetchIdentifier);
- serviceWorker->thread().postFetchTask(WTFMove(client), WTFMove(request), WTFMove(options));
+ serviceWorkerThreadProxy->thread().postFetchTask(WTFMove(client), WTFMove(request), WTFMove(options));
}
void ServiceWorkerContextManager::postMessageToServiceWorkerGlobalScope(uint64_t serverConnectionIdentifier, uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin)
Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -43,7 +43,7 @@
class ServiceWorkerContextManager : public IPC::MessageReceiver {
public:
- ServiceWorkerContextManager(Ref<IPC::Connection>&&, const WebPreferencesStore&);
+ ServiceWorkerContextManager(Ref<IPC::Connection>&&, uint64_t pageID, const WebPreferencesStore&);
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
@@ -56,6 +56,8 @@
Ref<IPC::Connection> m_connectionToStorageProcess;
HashMap<uint64_t, RefPtr<WebCore::ServiceWorkerThreadProxy>> m_workerMap;
+ uint64_t m_pageID { 0 };
+ uint64_t m_previousServiceWorkerID { 0 };
};
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -105,7 +105,22 @@
WebFrameLoaderClient::~WebFrameLoaderClient()
{
}
-
+
+uint64_t WebFrameLoaderClient::pageID() const
+{
+ return m_frame && m_frame->page() ? m_frame->page()->pageID() : 0;
+}
+
+uint64_t WebFrameLoaderClient::frameID() const
+{
+ return m_frame ? m_frame->frameID() : 0;
+}
+
+PAL::SessionID WebFrameLoaderClient::sessionID() const
+{
+ return m_frame && m_frame->page() ? m_frame->page()->sessionID() : PAL::SessionID::defaultSessionID();
+}
+
void WebFrameLoaderClient::frameLoaderDestroyed()
{
m_frame->invalidate();
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -51,6 +51,10 @@
void applyToDocumentLoader(const WebsitePolicies&);
+ uint64_t pageID() const final;
+ uint64_t frameID() const final;
+ PAL::SessionID sessionID() const final;
+
private:
void frameLoaderDestroyed() final;
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -1640,7 +1640,7 @@
#endif
#if ENABLE(SERVICE_WORKER)
-void WebProcess::getWorkerContextConnection(const WebPreferencesStore& store)
+void WebProcess::getWorkerContextConnection(uint64_t pageID, const WebPreferencesStore& store)
{
ASSERT(!m_serviceWorkerManager);
@@ -1664,7 +1664,7 @@
auto workerContextConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
workerContextConnection->open();
- m_serviceWorkerManager = ServiceWorkerContextManager(WTFMove(workerContextConnection), store);
+ m_serviceWorkerManager = ServiceWorkerContextManager(WTFMove(workerContextConnection), pageID, store);
WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::DidGetWorkerContextConnection(connectionClientPort), 0);
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -299,7 +299,7 @@
void setNetworkProxySettings(const WebCore::SoupNetworkProxySettings&);
#endif
#if ENABLE(SERVICE_WORKER)
- void getWorkerContextConnection(const WebPreferencesStore&);
+ void getWorkerContextConnection(uint64_t pageID, const WebPreferencesStore&);
#endif
void releasePageCache();
Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (223980 => 223981)
--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2017-10-25 21:17:46 UTC (rev 223981)
@@ -115,6 +115,6 @@
#endif
#if ENABLE(SERVICE_WORKER)
- GetWorkerContextConnection(struct WebKit::WebPreferencesStore store)
+ GetWorkerContextConnection(uint64_t pageID, struct WebKit::WebPreferencesStore store)
#endif
}
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (223980 => 223981)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-10-25 21:17:46 UTC (rev 223981)
@@ -1,3 +1,18 @@
+2017-10-25 Youenn Fablet <[email protected]>
+
+ Enable ServiceWorker to fetch resources
+ https://bugs.webkit.org/show_bug.cgi?id=178673
+
+ Reviewed by Brady Eidson.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::pageID const):
+ (WebFrameLoaderClient::frameID const):
+ (WebFrameLoaderClient::sessionID const):
+
+ Added implementation to the new getters.
+ They are noop in the context of WK1.
+
2017-10-24 Eric Carlson <[email protected]>
Web Inspector: Enable WebKit logging configuration and display
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h (223980 => 223981)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -62,6 +62,10 @@
void frameLoaderDestroyed() final;
bool hasWebView() const final; // mainly for assertions
+ uint64_t pageID() const final;
+ uint64_t frameID() const final;
+ PAL::SessionID sessionID() const final;
+
void makeRepresentation(WebCore::DocumentLoader*) final;
bool hasHTMLView() const final;
#if PLATFORM(IOS)
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (223980 => 223981)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2017-10-25 21:17:46 UTC (rev 223981)
@@ -202,6 +202,24 @@
{
}
+uint64_t WebFrameLoaderClient::pageID() const
+{
+ RELEASE_ASSERT_NOT_REACHED();
+ return 0;
+}
+
+uint64_t WebFrameLoaderClient::frameID() const
+{
+ RELEASE_ASSERT_NOT_REACHED();
+ return 0;
+}
+
+PAL::SessionID WebFrameLoaderClient::sessionID() const
+{
+ RELEASE_ASSERT_NOT_REACHED();
+ return PAL::SessionID::defaultSessionID();
+}
+
void WebFrameLoaderClient::frameLoaderDestroyed()
{
[m_webFrame.get() _clearCoreFrame];
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (223980 => 223981)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2017-10-25 21:17:46 UTC (rev 223981)
@@ -1,3 +1,19 @@
+2017-10-25 Youenn Fablet <[email protected]>
+
+ Enable ServiceWorker to fetch resources
+ https://bugs.webkit.org/show_bug.cgi?id=178673
+
+ Reviewed by Brady Eidson.
+
+ Added implementation to the new getters.
+ They are noop in the context of WK1.
+
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::pageID const):
+ (WebFrameLoaderClient::frameID const):
+ (WebFrameLoaderClient::sessionID const):
+ * WebCoreSupport/WebFrameLoaderClient.h:
+
2017-10-20 Antoine Quint <[email protected]>
[Web Animations] Provide basic timeline and animation interfaces
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (223980 => 223981)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-25 21:17:46 UTC (rev 223981)
@@ -121,6 +121,24 @@
{
}
+uint64_t WebFrameLoaderClient::pageID() const
+{
+ RELEASE_ASSERT_NOT_REACHED();
+ return 0;
+}
+
+uint64_t WebFrameLoaderClient::frameID() const
+{
+ RELEASE_ASSERT_NOT_REACHED();
+ return 0;
+}
+
+PAL::SessionID WebFrameLoaderClient::sessionID() const
+{
+ RELEASE_ASSERT_NOT_REACHED();
+ return PAL::SessionID::defaultSessionID();
+}
+
bool WebFrameLoaderClient::hasWebView() const
{
return m_webFrame->webView();
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h (223980 => 223981)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h 2017-10-25 21:12:38 UTC (rev 223980)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h 2017-10-25 21:17:46 UTC (rev 223981)
@@ -51,6 +51,10 @@
void dispatchDidFailToStartPlugin(const WebCore::PluginView*) const;
+ uint64_t pageID() const final;
+ uint64_t frameID() const final;
+ PAL::SessionID sessionID() const final;
+
bool hasWebView() const override;
Ref<WebCore::FrameNetworkingContext> createNetworkingContext() override;