Skip to content
Permalink
Browse files
IndexedDB in service workers is using a memory backed store
https://bugs.webkit.org/show_bug.cgi?id=182574
<rdar://problem/37316205>

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline WPT test that is now passing.

* web-platform-tests/service-workers/service-worker/indexeddb.https-expected.txt:

Source/WebKit:

Make sure we pass a proper WebDatabaseProvider to the ServiceWorkerProcess via
PageConfiguration. Otherwise, we end up using the default EmptyDatabaseProvider
which uses an InProcessIDBServer and a memory-backed store for IndexedDB.

* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::start):
* UIProcess/WebProcessPool.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

LayoutTests:

Unskip test that no longer times out.

* TestExpectations:


Canonical link: https://commits.webkit.org/198370@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228230 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Feb 7, 2018
1 parent 62c3d89 commit 2919effdc19f9b791e0be3bcdc645eb1d62b3f63
@@ -1,3 +1,15 @@
2018-02-07 Chris Dumez <cdumez@apple.com>

IndexedDB in service workers is using a memory backed store
https://bugs.webkit.org/show_bug.cgi?id=182574
<rdar://problem/37316205>

Reviewed by Youenn Fablet.

Unskip test that no longer times out.

* TestExpectations:

2018-02-07 Ms2ger <Ms2ger@igalia.com>

[WPE] Enable http/wpt/fetch/response-status-text.html
@@ -159,7 +159,6 @@ imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-
imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/client-navigate.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-include-uncontrolled.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/indexeddb.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html [ Skip ]

# Requires additional test infrastructure.
@@ -1,3 +1,15 @@
2018-02-07 Chris Dumez <cdumez@apple.com>

IndexedDB in service workers is using a memory backed store
https://bugs.webkit.org/show_bug.cgi?id=182574
<rdar://problem/37316205>

Reviewed by Youenn Fablet.

Rebaseline WPT test that is now passing.

* web-platform-tests/service-workers/service-worker/indexeddb.https-expected.txt:

2018-02-05 Chris Dumez <cdumez@apple.com>

Unreviewed, unskip fetch-event-respond-with-partial-stream.https.html as it no longer times out
@@ -1,8 +1,5 @@
CONSOLE MESSAGE: line 14: NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.

Harness Error (FAIL), message = NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.

TIMEOUT Verify Indexed DB operation in a Service Worker Test timed out
NOTRUN clean up: registration
NOTRUN clean up: database
PASS Verify Indexed DB operation in a Service Worker
PASS clean up: registration
PASS clean up: database

@@ -1,3 +1,27 @@
2018-02-07 Chris Dumez <cdumez@apple.com>

IndexedDB in service workers is using a memory backed store
https://bugs.webkit.org/show_bug.cgi?id=182574
<rdar://problem/37316205>

Reviewed by Youenn Fablet.

Make sure we pass a proper WebDatabaseProvider to the ServiceWorkerProcess via
PageConfiguration. Otherwise, we end up using the default EmptyDatabaseProvider
which uses an InProcessIDBServer and a memory-backed store for IndexedDB.

* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::start):
* UIProcess/WebProcessPool.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

2018-02-07 Michael Catanzaro <mcatanzaro@igalia.com>

[GTK] Typo in a translatable string
@@ -28,6 +28,7 @@

#include "AuthenticationChallengeProxy.h"
#include "WebCredential.h"
#include "WebPageGroup.h"
#include "WebPreferencesStore.h"
#include "WebProcessMessages.h"
#include "WebProcessPool.h"
@@ -69,7 +70,7 @@ void ServiceWorkerProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions&

void ServiceWorkerProcessProxy::start(const WebPreferencesStore& store, std::optional<PAL::SessionID> initialSessionID)
{
send(Messages::WebProcess::EstablishWorkerContextConnectionToStorageProcess { m_serviceWorkerPageID, store, initialSessionID.value_or(PAL::SessionID::defaultSessionID()) }, 0);
send(Messages::WebProcess::EstablishWorkerContextConnectionToStorageProcess { processPool().defaultPageGroup().pageGroupID(), m_serviceWorkerPageID, store, initialSessionID.value_or(PAL::SessionID::defaultSessionID()) }, 0);
}

void ServiceWorkerProcessProxy::setUserAgent(const String& userAgent)
@@ -205,6 +205,8 @@ class WebProcessPool final : public API::ObjectImpl<API::Object::Type::ProcessPo
ProcessID networkProcessIdentifier();
ProcessID storageProcessIdentifier();

WebPageGroup& defaultPageGroup() { return m_defaultPageGroup.get(); }

void setAlwaysUsesComplexTextCodePath(bool);
void setShouldUseFontSmoothing(bool);

@@ -34,6 +34,7 @@
#include "StorageProcessMessages.h"
#include "WebCacheStorageProvider.h"
#include "WebCoreArgumentCoders.h"
#include "WebDatabaseProvider.h"
#include "WebDocumentLoader.h"
#include "WebPreferencesKeys.h"
#include "WebPreferencesStore.h"
@@ -101,8 +102,9 @@ class ServiceWorkerFrameLoaderClient final : public EmptyFrameLoaderClient {
String m_userAgent;
};

WebSWContextManagerConnection::WebSWContextManagerConnection(Ref<IPC::Connection>&& connection, uint64_t pageID, const WebPreferencesStore& store)
WebSWContextManagerConnection::WebSWContextManagerConnection(Ref<IPC::Connection>&& connection, uint64_t pageGroupID, uint64_t pageID, const WebPreferencesStore& store)
: m_connectionToStorageProcess(WTFMove(connection))
, m_pageGroupID(pageGroupID)
, m_pageID(pageID)
, m_userAgent(standardUserAgentWithApplicationName({ }))
{
@@ -133,8 +135,13 @@ void WebSWContextManagerConnection::installServiceWorker(const ServiceWorkerCont
WebCore::LibWebRTCProvider::create(),
WebProcess::singleton().cacheStorageProvider()
};

fillWithEmptyClients(pageConfiguration);

#if ENABLE(INDEXED_DATABASE)
pageConfiguration.databaseProvider = WebDatabaseProvider::getOrCreate(m_pageGroupID);
#endif

// FIXME: This method should be moved directly to WebCore::SWContextManager::Connection
// If it weren't for ServiceWorkerFrameLoaderClient's dependence on WebDocumentLoader, this could already happen.
auto frameLoaderClient = std::make_unique<ServiceWorkerFrameLoaderClient>(*this, sessionID, m_pageID, ++m_previousServiceWorkerID, m_userAgent);
@@ -51,7 +51,7 @@ struct WebPreferencesStore;

class WebSWContextManagerConnection final : public WebCore::SWContextManager::Connection, public IPC::MessageReceiver {
public:
WebSWContextManagerConnection(Ref<IPC::Connection>&&, uint64_t pageID, const WebPreferencesStore&);
WebSWContextManagerConnection(Ref<IPC::Connection>&&, uint64_t pageGroupID, uint64_t pageID, const WebPreferencesStore&);
~WebSWContextManagerConnection();

void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
@@ -89,6 +89,7 @@ class WebSWContextManagerConnection final : public WebCore::SWContextManager::Co
void setUserAgent(String&& userAgent);

Ref<IPC::Connection> m_connectionToStorageProcess;
uint64_t m_pageGroupID;
uint64_t m_pageID { 0 };
uint64_t m_previousServiceWorkerID { 0 };

@@ -1653,13 +1653,13 @@ LibWebRTCNetwork& WebProcess::libWebRTCNetwork()
#endif

#if ENABLE(SERVICE_WORKER)
void WebProcess::establishWorkerContextConnectionToStorageProcess(uint64_t pageID, const WebPreferencesStore& store, PAL::SessionID initialSessionID)
void WebProcess::establishWorkerContextConnectionToStorageProcess(uint64_t pageGroupID, uint64_t pageID, const WebPreferencesStore& store, PAL::SessionID initialSessionID)
{
// We are in the Service Worker context process and the call below establishes our connection to the Storage Process
// by calling webToStorageProcessConnection. SWContextManager needs to use the same underlying IPC::Connection as the
// WebToStorageProcessConnection for synchronization purposes.
auto& ipcConnection = ensureWebToStorageProcessConnection(initialSessionID).connection();
SWContextManager::singleton().setConnection(std::make_unique<WebSWContextManagerConnection>(ipcConnection, pageID, store));
SWContextManager::singleton().setConnection(std::make_unique<WebSWContextManagerConnection>(ipcConnection, pageGroupID, pageID, store));
}

void WebProcess::registerServiceWorkerClients(PAL::SessionID sessionID)
@@ -311,7 +311,7 @@ class WebProcess : public ChildProcess {
void setNetworkProxySettings(const WebCore::SoupNetworkProxySettings&);
#endif
#if ENABLE(SERVICE_WORKER)
void establishWorkerContextConnectionToStorageProcess(uint64_t pageID, const WebPreferencesStore&, PAL::SessionID);
void establishWorkerContextConnectionToStorageProcess(uint64_t pageGroupID, uint64_t pageID, const WebPreferencesStore&, PAL::SessionID);
void registerServiceWorkerClients(PAL::SessionID);
#endif

@@ -116,7 +116,7 @@ messages -> WebProcess LegacyReceiver {
#endif

#if ENABLE(SERVICE_WORKER)
EstablishWorkerContextConnectionToStorageProcess(uint64_t pageID, struct WebKit::WebPreferencesStore store, PAL::SessionID initialSessionID)
EstablishWorkerContextConnectionToStorageProcess(uint64_t pageGroupID, uint64_t pageID, struct WebKit::WebPreferencesStore store, PAL::SessionID initialSessionID)
RegisterServiceWorkerClients(PAL::SessionID sessionID)
#endif

0 comments on commit 2919eff

Please sign in to comment.