Use SecurityOriginData more consistently in Service Worker code
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2018 18:03:40 +0000 (18:03 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2018 18:03:40 +0000 (18:03 +0000)
commit2bdcce1979588999dbb4703515194532621688ec
tree8b2d585c3abd62c64ed2203617fa690563dba690
parent71716723ca5e44c7c2b09a876e93516c2d3b168d
Use SecurityOriginData more consistently in Service Worker code
https://bugs.webkit.org/show_bug.cgi?id=183969

Reviewed by Darin Adler.

Source/WebCore:

Use SecurityOriginData more consistently in Service Worker code to avoid constructing
SecurityOrigin objects unnecessarily.

I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces
code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily
in some cases as callers can now use SecurityOrigin::data() instead of
SecurityOriginData::fromSecurityOrigin().

No new tests, no Web-facing behavior change.

* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::origin const):
* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::storageDirectory const):
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::mediaKeysStorageDirectory const):
* Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
(WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::openInternal):
(WebCore::IDBFactory::deleteDatabase):
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
* Modules/webdatabase/Database.cpp:
(WebCore::Database::securityOrigin):
* Modules/webdatabase/DatabaseContext.cpp:
(WebCore::DatabaseContext::securityOrigin const):
* Modules/webdatabase/DatabaseContext.h:
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::fullPathForDatabase):
(WebCore::DatabaseManager::detailsForNameAndOrigin):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
* inspector/agents/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::findStorageArea):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
(WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
(WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
(WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
(WebCore::ApplicationCacheStorage::store):
(WebCore::ApplicationCacheStorage::ensureOriginRecord):
* page/DOMWindow.cpp:
(WebCore:: const):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::SecurityOrigin):
(WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
(WebCore::SecurityOrigin::canAccess const):
(WebCore::SecurityOrigin::canDisplay const):
(WebCore::SecurityOrigin::domainForCachePartition const):
(WebCore::SecurityOrigin::isLocal const):
(WebCore::SecurityOrigin::toString const):
(WebCore::SecurityOrigin::toRawString const):
(WebCore::SecurityOrigin::create):
(WebCore::SecurityOrigin::isSameSchemeHostPort const):
* page/SecurityOrigin.h:
(WebCore::SecurityOrigin::protocol const):
(WebCore::SecurityOrigin::host const):
(WebCore::SecurityOrigin::port const):
(WebCore::SecurityOrigin::data const):
(WebCore::SecurityOrigin::isHTTPFamily const):
* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::toString const):
(WebCore::SecurityOriginData::fromFrame):
* page/SecurityOriginData.h:
(WebCore::SecurityOriginData::fromURL):
* storage/StorageNamespaceProvider.cpp:
(WebCore::StorageNamespaceProvider::localStorageArea):
* testing/Internals.cpp:
(WebCore::Internals::clearCacheStorageMemoryRepresentation):
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::removeRegistration):
(WebCore::ServiceWorkerContainer::updateRegistration):
* workers/service/ServiceWorkerRegistrationKey.cpp:
(WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const):
* workers/service/ServiceWorkerRegistrationKey.h:
* workers/service/server/SWOriginStore.cpp:
(WebCore::SWOriginStore::add):
(WebCore::SWOriginStore::remove):
(WebCore::SWOriginStore::clear):
* workers/service/server/SWOriginStore.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::addRegistration):
(WebCore::SWServer::removeRegistration):
(WebCore::SWServer::clear):
(WebCore::SWServer::tryInstallContextData):
(WebCore::SWServer::serverToContextConnectionCreated):
(WebCore::SWServer::markAllWorkersForOriginAsTerminated):
(WebCore::SWServer::unregisterServiceWorkerClient):
(WebCore::SWServer::needsServerToContextConnectionForOrigin const):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerToContextConnection.cpp:
(WebCore::SWServerToContextConnection::SWServerToContextConnection):
(WebCore::SWServerToContextConnection::~SWServerToContextConnection):
(WebCore::SWServerToContextConnection::connectionForOrigin):
* workers/service/server/SWServerToContextConnection.h:
(WebCore::SWServerToContextConnection::securityOrigin const):
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::origin const):
(WebCore::SWServerWorker::securityOrigin const):
* workers/service/server/SWServerWorker.h:

Source/WebKit:

Use SecurityOriginData more consistently in Service Worker code to avoid constructing
SecurityOrigin objects unnecessarily.

* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
* Shared/API/c/WKSecurityOriginRef.cpp:
(WKSecurityOriginCopyDatabaseIdentifier):
* StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
(WebKit::WebSWOriginStore::addToStore):
(WebKit::WebSWOriginStore::removeFromStore):
* StorageProcess/ServiceWorker/WebSWOriginStore.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::scheduleJobInServer):
(WebKit::WebSWServerConnection::registerServiceWorkerClient):
* StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
* StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::connectionToContextProcessWasClosed):
(WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
(WebKit::StorageProcess::createStorageToWebProcessConnection):
(WebKit::StorageProcess::deleteWebsiteDataForOrigins):
(WebKit::StorageProcess::serverToContextConnectionForOrigin):
(WebKit::StorageProcess::createServerToContextConnection):
(WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
* StorageProcess/StorageProcess.h:
* UIProcess/API/APIFrameInfo.cpp:
(API::FrameInfo::create):
* UIProcess/API/C/WKApplicationCacheManager.cpp:
(WKApplicationCacheManagerDeleteEntriesForOrigin):
* UIProcess/API/C/WKKeyValueStorageManager.cpp:
(WKKeyValueStorageManagerDeleteEntriesForOrigin):
* UIProcess/API/C/WKResourceCacheManager.cpp:
(WKResourceCacheManagerClearCacheForOrigin):
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreRemoveFetchCacheForOrigin):
(WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::create):
(WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
(WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
* UIProcess/ServiceWorkerProcessProxy.h:
* UIProcess/Storage/StorageProcessProxy.cpp:
(WebKit::StorageProcessProxy::getStorageProcessConnection):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::updateProcessAssertions):
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataAndApply):
* WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
(WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageCopyOriginsWithApplicationCache):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
(WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::registerServiceWorkerClient):
(WebKit::WebSWClientConnection::matchRegistration):
(WebKit::WebSWClientConnection::whenRegistrationReady):
(WebKit::WebSWClientConnection::getRegistrations):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::exceededDatabaseQuota):
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::fetchWebsiteData):
* WebProcess/WebStorage/StorageAreaImpl.cpp:
(WebKit::StorageAreaImpl::securityOrigin const):
* WebProcess/WebStorage/StorageAreaImpl.h:
* WebProcess/WebStorage/StorageAreaMap.cpp:
(WebKit::StorageAreaMap::StorageAreaMap):
(WebKit::StorageAreaMap::dispatchSessionStorageEvent):
(WebKit::StorageAreaMap::dispatchLocalStorageEvent):
* WebProcess/WebStorage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):

Source/WebKitLegacy:

Use SecurityOrigin::data() instead of SecurityOriginData::fromSecurityOrigin().

* Storage/StorageTracker.cpp:
(WebKit::StorageTracker::diskUsageForOrigin):

Source/WebKitLegacy/mac:

Use SecurityOrigin::data() instead of SecurityOriginData::fromSecurityOrigin().

* Storage/WebDatabaseManager.mm:
(-[WebDatabaseManager databasesWithOrigin:]):
(-[WebDatabaseManager deleteOrigin:]):
(-[WebDatabaseManager deleteDatabase:withOrigin:]):
* Storage/WebDatabaseQuotaManager.mm:
(-[WebDatabaseQuotaManager usage]):
(-[WebDatabaseQuotaManager quota]):
(-[WebDatabaseQuotaManager setQuota:]):
* Storage/WebStorageManager.mm:
(-[WebStorageManager deleteOrigin:]):
* WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin databaseIdentifier]):
(-[WebSecurityOrigin usage]):
(-[WebSecurityOrigin quota]):
(-[WebSecurityOrigin setQuota:]):

Source/WebKitLegacy/win:

Use SecurityOrigin::data() instead of SecurityOriginData::fromSecurityOrigin().

* WebDatabaseManager.cpp:
(WebDatabaseManager::databasesWithOrigin):
(WebDatabaseManager::deleteOrigin):
(WebDatabaseManager::deleteDatabase):
(WebDatabaseManager::setQuota):
* WebSecurityOrigin.cpp:
(WebSecurityOrigin::usage):
(WebSecurityOrigin::quota):
(WebSecurityOrigin::setQuota):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
79 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/cache/DOMCacheStorage.cpp
Source/WebCore/Modules/encryptedmedia/CDM.cpp
Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp
Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp
Source/WebCore/Modules/indexeddb/IDBFactory.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
Source/WebCore/Modules/webdatabase/Database.cpp
Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
Source/WebCore/Modules/webdatabase/DatabaseContext.h
Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/inspector/agents/InspectorDOMStorageAgent.cpp
Source/WebCore/loader/EmptyClients.cpp
Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/SecurityOrigin.cpp
Source/WebCore/page/SecurityOrigin.h
Source/WebCore/page/SecurityOriginData.cpp
Source/WebCore/page/SecurityOriginData.h
Source/WebCore/storage/StorageArea.h
Source/WebCore/storage/StorageNamespaceProvider.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerRegistrationKey.cpp
Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h
Source/WebCore/workers/service/server/SWOriginStore.cpp
Source/WebCore/workers/service/server/SWOriginStore.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerToContextConnection.cpp
Source/WebCore/workers/service/server/SWServerToContextConnection.h
Source/WebCore/workers/service/server/SWServerWorker.cpp
Source/WebCore/workers/service/server/SWServerWorker.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp
Source/WebKit/Shared/API/c/WKSecurityOriginRef.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.h
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.h
Source/WebKit/StorageProcess/StorageProcess.cpp
Source/WebKit/StorageProcess/StorageProcess.h
Source/WebKit/UIProcess/API/APIFrameInfo.cpp
Source/WebKit/UIProcess/API/C/WKApplicationCacheManager.cpp
Source/WebKit/UIProcess/API/C/WKKeyValueStorageManager.cpp
Source/WebKit/UIProcess/API/C/WKResourceCacheManager.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h
Source/WebKit/UIProcess/Storage/StorageProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebStorage/StorageManager.cpp
Source/WebKit/UIProcess/WebStorage/StorageManager.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebStorage/StorageAreaImpl.cpp
Source/WebKit/WebProcess/WebStorage/StorageAreaImpl.h
Source/WebKit/WebProcess/WebStorage/StorageAreaMap.cpp
Source/WebKit/WebProcess/WebStorage/StorageNamespaceImpl.cpp
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/Storage/StorageAreaImpl.h
Source/WebKitLegacy/Storage/StorageTracker.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Storage/WebDatabaseManager.mm
Source/WebKitLegacy/mac/Storage/WebDatabaseQuotaManager.mm
Source/WebKitLegacy/mac/Storage/WebStorageManager.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebDatabaseManager.cpp
Source/WebKitLegacy/win/WebSecurityOrigin.cpp