mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1626555 - Make dom/localstorage
buildable outside of unified-build
environment. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D94034
This commit is contained in:
parent
2282fb5a6a
commit
f70bfd33ed
@ -18,4 +18,5 @@ dom/docs/
|
||||
dom/encoding/
|
||||
dom/events/
|
||||
dom/fetch/
|
||||
dom/localstorage/
|
||||
dom/quota/
|
||||
|
@ -9,7 +9,18 @@
|
||||
#include "mozilla/dom/ClientIPCTypes.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "ClientOpPromise.h"
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/ClientIPCTypes.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
struct nsID;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -24,7 +35,6 @@ namespace dom {
|
||||
class ClientManagerParent;
|
||||
class ClientSourceParent;
|
||||
class ClientHandleParent;
|
||||
class ContentParent;
|
||||
|
||||
// Define a singleton service to manage client activity throughout the
|
||||
// browser. This service runs on the PBackground thread. To interact
|
||||
|
@ -26,6 +26,7 @@ EXPORTS.mozilla += [
|
||||
'RemoteLazyInputStreamChild.h',
|
||||
'RemoteLazyInputStreamParent.h',
|
||||
'RemoteLazyInputStreamStorage.h',
|
||||
'RemoteLazyInputStreamThread.h',
|
||||
'RemoteLazyInputStreamUtils.h',
|
||||
]
|
||||
|
||||
|
@ -6,11 +6,18 @@
|
||||
|
||||
#include "ActorsChild.h"
|
||||
|
||||
#include "LocalStorageCommon.h"
|
||||
#include "ErrorList.h"
|
||||
#include "LSDatabase.h"
|
||||
#include "LSObject.h"
|
||||
#include "LSObserver.h"
|
||||
#include "LSSnapshot.h"
|
||||
#include "LocalStorageCommon.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Result.h"
|
||||
#include "mozilla/dom/LSValue.h"
|
||||
#include "mozilla/dom/Storage.h"
|
||||
#include "mozilla/dom/quota/QuotaCommon.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,11 +7,19 @@
|
||||
#ifndef mozilla_dom_localstorage_ActorsChild_h
|
||||
#define mozilla_dom_localstorage_ActorsChild_h
|
||||
|
||||
#include <cstdint>
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/PBackgroundLSDatabaseChild.h"
|
||||
#include "mozilla/dom/PBackgroundLSObserverChild.h"
|
||||
#include "mozilla/dom/PBackgroundLSRequest.h"
|
||||
#include "mozilla/dom/PBackgroundLSRequestChild.h"
|
||||
#include "mozilla/dom/PBackgroundLSSimpleRequest.h"
|
||||
#include "mozilla/dom/PBackgroundLSSimpleRequestChild.h"
|
||||
#include "mozilla/dom/PBackgroundLSSnapshotChild.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nscore.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -6,32 +6,75 @@
|
||||
|
||||
#include "ActorsParent.h"
|
||||
|
||||
#include "LocalStorageCommon.h"
|
||||
// Local includes
|
||||
#include "LSObject.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
// Global includes
|
||||
#include <cinttypes>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include "CrashAnnotations.h"
|
||||
#include "ErrorList.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozIStorageAsyncConnection.h"
|
||||
#include "mozIStorageConnection.h"
|
||||
#include "mozIStorageFunction.h"
|
||||
#include "mozIStorageService.h"
|
||||
#include "mozIStorageStatement.h"
|
||||
#include "mozIStorageValueArray.h"
|
||||
#include "mozStorageCID.h"
|
||||
#include "mozStorageHelper.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Result.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/StoragePrincipalHelper.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/Variant.h"
|
||||
#include "mozilla/dom/ClientManagerService.h"
|
||||
#include "mozilla/dom/FlippedOnce.h"
|
||||
#include "mozilla/dom/LSSnapshot.h"
|
||||
#include "mozilla/dom/LSValue.h"
|
||||
#include "mozilla/dom/LSWriteOptimizer.h"
|
||||
#include "mozilla/dom/LSWriteOptimizerImpl.h"
|
||||
#include "mozilla/dom/LocalStorageCommon.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/dom/PBackgroundLSDatabase.h"
|
||||
#include "mozilla/dom/PBackgroundLSDatabaseParent.h"
|
||||
#include "mozilla/dom/PBackgroundLSObserverParent.h"
|
||||
#include "mozilla/dom/PBackgroundLSRequestParent.h"
|
||||
#include "mozilla/dom/PBackgroundLSSharedTypes.h"
|
||||
#include "mozilla/dom/PBackgroundLSSimpleRequestParent.h"
|
||||
#include "mozilla/dom/PBackgroundLSSnapshotParent.h"
|
||||
#include "mozilla/dom/SnappyUtils.h"
|
||||
#include "mozilla/dom/StorageDBUpdater.h"
|
||||
#include "mozilla/dom/StorageUtils.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/dom/quota/CheckedUnsafePtr.h"
|
||||
#include "mozilla/dom/quota/Client.h"
|
||||
#include "mozilla/dom/quota/OriginScope.h"
|
||||
#include "mozilla/dom/quota/PersistenceType.h"
|
||||
#include "mozilla/dom/quota/QuotaCommon.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/dom/quota/QuotaObject.h"
|
||||
@ -41,18 +84,54 @@
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundParent.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/storage/Variant.h"
|
||||
#include "mozilla/StoragePrincipalHelper.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsExceptionHandler.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIBinaryInputStream.h"
|
||||
#include "nsIBinaryOutputStream.h"
|
||||
#include "nsIDirectoryEnumerator.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsISerialEventTarget.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPointerHashKeys.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "ReportInternalError.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringFlags.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTLiteralString.h"
|
||||
#include "nsTStringRepr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsVariant.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nscore.h"
|
||||
#include "prenv.h"
|
||||
#include "prtime.h"
|
||||
|
||||
#define DISABLE_ASSERTS_FOR_FUZZING 0
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
#ifndef mozilla_dom_localstorage_ActorsParent_h
|
||||
#define mozilla_dom_localstorage_ActorsParent_h
|
||||
|
||||
#include <cstdint>
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace ipc {
|
||||
|
@ -6,11 +6,36 @@
|
||||
|
||||
#include "LSDatabase.h"
|
||||
|
||||
// Local includes
|
||||
#include "ActorsChild.h"
|
||||
#include "LSObject.h"
|
||||
#include "LSSnapshot.h"
|
||||
|
||||
// Global includes
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/dom/PBackgroundLSDatabase.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nscore.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace mozilla::services;
|
||||
|
||||
namespace {
|
||||
|
||||
#define XPCOM_SHUTDOWN_OBSERVER_TOPIC "xpcom-shutdown"
|
||||
@ -53,7 +78,8 @@ LSDatabase::LSDatabase(const nsACString& aOrigin)
|
||||
|
||||
sObserver = new Observer();
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsSvc = GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
mozilla::services::GetObserverService();
|
||||
MOZ_ASSERT(obsSvc);
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
@ -353,7 +379,8 @@ void LSDatabase::AllowToClose() {
|
||||
|
||||
MOZ_ASSERT(sObserver);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsSvc = GetObserverService();
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
mozilla::services::GetObserverService();
|
||||
MOZ_ASSERT(obsSvc);
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
|
@ -7,10 +7,20 @@
|
||||
#ifndef mozilla_dom_localstorage_LSDatabase_h
|
||||
#define mozilla_dom_localstorage_LSDatabase_h
|
||||
|
||||
#include <cstdint>
|
||||
#include "ErrorList.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class LSDatabaseChild;
|
||||
class LSNotifyInfo;
|
||||
class LSObject;
|
||||
class LSSnapshot;
|
||||
|
||||
class LSDatabase final {
|
||||
|
@ -6,19 +6,53 @@
|
||||
|
||||
#include "LSObject.h"
|
||||
|
||||
// Local includes
|
||||
#include "ActorsChild.h"
|
||||
#include "LocalStorageCommon.h"
|
||||
#include "LSDatabase.h"
|
||||
#include "LSObserver.h"
|
||||
|
||||
// Global includes
|
||||
#include <utility>
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/RemoteLazyInputStreamThread.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/ThreadEventQueue.h"
|
||||
#include "mozilla/StorageAccess.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/ClientInfo.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/LocalStorageCommon.h"
|
||||
#include "mozilla/dom/PBackgroundLSRequest.h"
|
||||
#include "mozilla/dom/PBackgroundLSSharedTypes.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsISerialEventTarget.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTStringRepr.h"
|
||||
#include "nsThread.h"
|
||||
#include "RemoteLazyInputStreamThread.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nscore.h"
|
||||
|
||||
/**
|
||||
* Automatically cancel and abort synchronous LocalStorage requests (for example
|
||||
@ -228,8 +262,8 @@ void LSObject::Initialize() {
|
||||
NS_NewRunnableFunction("LSObject::Initialize", []() {
|
||||
AssertIsOnDOMFileThread();
|
||||
|
||||
PBackgroundChild* backgroundActor =
|
||||
BackgroundChild::GetOrCreateForCurrentThread();
|
||||
mozilla::ipc::PBackgroundChild* backgroundActor =
|
||||
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
|
||||
|
||||
if (NS_WARN_IF(!backgroundActor)) {
|
||||
return;
|
||||
@ -297,13 +331,15 @@ nsresult LSObject::CreateForWindow(nsPIDOMWindowInner* aWindow,
|
||||
MOZ_ASSERT(storagePrincipalInfo->type() ==
|
||||
PrincipalInfo::TContentPrincipalInfo);
|
||||
|
||||
if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(*storagePrincipalInfo))) {
|
||||
if (NS_WARN_IF(
|
||||
!quota::QuotaManager::IsPrincipalInfoValid(*storagePrincipalInfo))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
LS_TRY_INSPECT(const auto& quotaInfo,
|
||||
QuotaManager::GetInfoFromPrincipal(storagePrincipal.get()));
|
||||
LS_TRY_INSPECT(
|
||||
const auto& quotaInfo,
|
||||
quota::QuotaManager::GetInfoFromPrincipal(storagePrincipal.get()));
|
||||
|
||||
MOZ_ASSERT(originAttrSuffix == quotaInfo.mSuffix);
|
||||
|
||||
@ -385,7 +421,8 @@ nsresult LSObject::CreateForPrincipal(nsPIDOMWindowInner* aWindow,
|
||||
storagePrincipalInfo->type() == PrincipalInfo::TContentPrincipalInfo ||
|
||||
storagePrincipalInfo->type() == PrincipalInfo::TSystemPrincipalInfo);
|
||||
|
||||
if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(*storagePrincipalInfo))) {
|
||||
if (NS_WARN_IF(
|
||||
!quota::QuotaManager::IsPrincipalInfoValid(*storagePrincipalInfo))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -410,10 +447,10 @@ nsresult LSObject::CreateForPrincipal(nsPIDOMWindowInner* aWindow,
|
||||
&aPrincipal]() -> Result<nsAutoCString, nsresult> {
|
||||
if (storagePrincipalInfo->type() ==
|
||||
PrincipalInfo::TSystemPrincipalInfo) {
|
||||
return nsAutoCString{QuotaManager::GetOriginForChrome()};
|
||||
return nsAutoCString{quota::QuotaManager::GetOriginForChrome()};
|
||||
}
|
||||
|
||||
LS_TRY_RETURN(QuotaManager::GetOriginFromPrincipal(aPrincipal));
|
||||
LS_TRY_RETURN(quota::QuotaManager::GetOriginFromPrincipal(aPrincipal));
|
||||
}()));
|
||||
#endif
|
||||
|
||||
@ -441,7 +478,7 @@ nsresult LSObject::CreateForPrincipal(nsPIDOMWindowInner* aWindow,
|
||||
|
||||
object.forget(aObject);
|
||||
return NS_OK;
|
||||
}
|
||||
} // namespace dom
|
||||
|
||||
// static
|
||||
already_AddRefed<nsISerialEventTarget> LSObject::GetSyncLoopEventTarget() {
|
||||
@ -487,10 +524,11 @@ LSRequestChild* LSObject::StartRequest(nsIEventTarget* aMainEventTarget,
|
||||
LSRequestChildCallback* aCallback) {
|
||||
AssertIsOnDOMFileThread();
|
||||
|
||||
PBackgroundChild* backgroundActor =
|
||||
mozilla::ipc::PBackgroundChild* backgroundActor =
|
||||
XRE_IsParentProcess()
|
||||
? BackgroundChild::GetOrCreateForCurrentThread(aMainEventTarget)
|
||||
: BackgroundChild::GetForCurrentThread();
|
||||
? mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread(
|
||||
aMainEventTarget)
|
||||
: mozilla::ipc::BackgroundChild::GetForCurrentThread();
|
||||
if (NS_WARN_IF(!backgroundActor)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -836,8 +874,8 @@ nsresult LSObject::DoRequestSynchronously(const LSRequestParams& aParams,
|
||||
// too late to initialize PBackground child on the owning thread, because
|
||||
// it can fail and parent would keep an extra strong ref to the datastore or
|
||||
// observer.
|
||||
PBackgroundChild* backgroundActor =
|
||||
BackgroundChild::GetOrCreateForCurrentThread();
|
||||
mozilla::ipc::PBackgroundChild* backgroundActor =
|
||||
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
|
||||
if (NS_WARN_IF(!backgroundActor)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -882,8 +920,8 @@ nsresult LSObject::EnsureDatabase() {
|
||||
// We don't need this yet, but once the request successfully finishes, it's
|
||||
// too late to initialize PBackground child on the owning thread, because
|
||||
// it can fail and parent would keep an extra strong ref to the datastore.
|
||||
PBackgroundChild* backgroundActor =
|
||||
BackgroundChild::GetOrCreateForCurrentThread();
|
||||
mozilla::ipc::PBackgroundChild* backgroundActor =
|
||||
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
|
||||
if (NS_WARN_IF(!backgroundActor)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -984,7 +1022,8 @@ nsresult LSObject::EnsureObserver() {
|
||||
// Note that we now can't error out, otherwise parent will keep an extra
|
||||
// strong reference to the observer.
|
||||
|
||||
PBackgroundChild* backgroundActor = BackgroundChild::GetForCurrentThread();
|
||||
mozilla::ipc::PBackgroundChild* backgroundActor =
|
||||
mozilla::ipc::BackgroundChild::GetForCurrentThread();
|
||||
MOZ_ASSERT(backgroundActor);
|
||||
|
||||
RefPtr<LSObserver> observer = new LSObserver(mOrigin);
|
||||
|
@ -7,11 +7,24 @@
|
||||
#ifndef mozilla_dom_localstorage_LSObject_h
|
||||
#define mozilla_dom_localstorage_LSObject_h
|
||||
|
||||
#include "mozilla/dom/Storage.h"
|
||||
#include <cstdint>
|
||||
#include "ErrorList.h"
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/Storage.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsID.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
class nsGlobalWindowInner;
|
||||
class nsIEventTarget;
|
||||
class nsIPrincipal;
|
||||
class nsISerialEventTarget;
|
||||
class nsPIDOMWindowInner;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -6,11 +6,14 @@
|
||||
|
||||
#include "LSObserver.h"
|
||||
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
// Local includes
|
||||
#include "ActorsChild.h"
|
||||
|
||||
// Global includes
|
||||
#include <utility>
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,6 +7,10 @@
|
||||
#ifndef mozilla_dom_localstorage_LSObserver_h
|
||||
#define mozilla_dom_localstorage_LSObserver_h
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -4,14 +4,47 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "LSSnapshot.h"
|
||||
#include "mozilla/dom/LSSnapshot.h"
|
||||
|
||||
// Local includes
|
||||
#include "ActorsChild.h"
|
||||
#include "LocalStorageCommon.h"
|
||||
#include "LSDatabase.h"
|
||||
#include "LSWriteOptimizer.h"
|
||||
#include "LSWriteOptimizerImpl.h"
|
||||
#include "LocalStorageCommon.h"
|
||||
|
||||
// Global includes
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include "ErrorList.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/LSValue.h"
|
||||
#include "mozilla/dom/PBackgroundLSDatabase.h"
|
||||
#include "mozilla/dom/PBackgroundLSSharedTypes.h"
|
||||
#include "mozilla/dom/PBackgroundLSSnapshot.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringFlags.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTStringRepr.h"
|
||||
#include "nscore.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,15 +7,19 @@
|
||||
#ifndef mozilla_dom_localstorage_LSSnapshot_h
|
||||
#define mozilla_dom_localstorage_LSSnapshot_h
|
||||
|
||||
#include "LSValue.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include "ErrorList.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include "nsTHashtable.h"
|
||||
|
||||
class nsITimer;
|
||||
|
@ -4,7 +4,13 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "LSValue.h"
|
||||
#include "mozilla/dom/LSValue.h"
|
||||
|
||||
#include "mozIStorageStatement.h"
|
||||
#include "mozilla/dom/SnappyUtils.h"
|
||||
#include "mozilla/fallible.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,8 +7,14 @@
|
||||
#ifndef mozilla_dom_localstorage_LSValue_h
|
||||
#define mozilla_dom_localstorage_LSValue_h
|
||||
|
||||
#include <cstdint>
|
||||
#include "ErrorList.h"
|
||||
#include "SnappyUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Span.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTStringRepr.h"
|
||||
|
||||
class mozIStorageStatement;
|
||||
|
||||
|
@ -6,6 +6,10 @@
|
||||
|
||||
#include "LSWriteOptimizer.h"
|
||||
|
||||
#include <new>
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -7,8 +7,16 @@
|
||||
#ifndef mozilla_dom_localstorage_LSWriteOptimizer_h
|
||||
#define mozilla_dom_localstorage_LSWriteOptimizer_h
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -6,9 +6,26 @@
|
||||
|
||||
#include "LocalStorageCommon.h"
|
||||
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/net/MozURL.h"
|
||||
#include <cstdint>
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/dom/StorageUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "mozilla/net/MozURL.h"
|
||||
#include "mozilla/net/WebSocketFrame.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringFlags.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -56,15 +73,15 @@ bool CachedNextGenLocalStorageEnabled() {
|
||||
return !!gNextGenLocalStorageEnabled;
|
||||
}
|
||||
|
||||
nsresult GenerateOriginKey2(const PrincipalInfo& aPrincipalInfo,
|
||||
nsresult GenerateOriginKey2(const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
|
||||
nsACString& aOriginAttrSuffix,
|
||||
nsACString& aOriginKey) {
|
||||
OriginAttributes attrs;
|
||||
nsCString spec;
|
||||
|
||||
switch (aPrincipalInfo.type()) {
|
||||
case PrincipalInfo::TNullPrincipalInfo: {
|
||||
const NullPrincipalInfo& info = aPrincipalInfo.get_NullPrincipalInfo();
|
||||
case mozilla::ipc::PrincipalInfo::TNullPrincipalInfo: {
|
||||
const auto& info = aPrincipalInfo.get_NullPrincipalInfo();
|
||||
|
||||
attrs = info.attrs();
|
||||
spec = info.spec();
|
||||
@ -72,9 +89,8 @@ nsresult GenerateOriginKey2(const PrincipalInfo& aPrincipalInfo,
|
||||
break;
|
||||
}
|
||||
|
||||
case PrincipalInfo::TContentPrincipalInfo: {
|
||||
const ContentPrincipalInfo& info =
|
||||
aPrincipalInfo.get_ContentPrincipalInfo();
|
||||
case mozilla::ipc::PrincipalInfo::TContentPrincipalInfo: {
|
||||
const auto& info = aPrincipalInfo.get_ContentPrincipalInfo();
|
||||
|
||||
attrs = info.attrs();
|
||||
spec = info.spec();
|
||||
@ -118,7 +134,7 @@ nsresult GenerateOriginKey2(const PrincipalInfo& aPrincipalInfo,
|
||||
|
||||
// Append reversed domain
|
||||
nsAutoCString reverseDomain;
|
||||
rv = CreateReversedDomain(domainOrigin, reverseDomain);
|
||||
rv = StorageUtils::CreateReversedDomain(domainOrigin, reverseDomain);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -7,6 +7,13 @@
|
||||
#ifndef mozilla_dom_localstorage_LocalStorageCommon_h
|
||||
#define mozilla_dom_localstorage_LocalStorageCommon_h
|
||||
|
||||
#include <cstdint>
|
||||
#include "ErrorList.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/quota/QuotaCommon.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsStringFwd.h"
|
||||
|
||||
/*
|
||||
* Local storage
|
||||
* ~~~~~~~~~~~~~
|
||||
@ -182,10 +189,6 @@
|
||||
* interface.
|
||||
*/
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/quota/QuotaCommon.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// LocalStorage equivalents of QM_TRY.
|
||||
#define LS_TRY_GLUE(...) \
|
||||
QM_TRY_META(mozilla::dom::localstorage, MOZ_UNIQUE_VAR(tryResult), \
|
||||
|
@ -6,9 +6,42 @@
|
||||
|
||||
#include "LocalStorageManager2.h"
|
||||
|
||||
// Local includes
|
||||
#include "ActorsChild.h"
|
||||
#include "LSObject.h"
|
||||
|
||||
// Global includes
|
||||
#include <utility>
|
||||
#include "MainThreadUtils.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/RemoteLazyInputStreamThread.h"
|
||||
#include "mozilla/dom/LocalStorageCommon.h"
|
||||
#include "mozilla/dom/PBackgroundLSRequest.h"
|
||||
#include "mozilla/dom/PBackgroundLSSharedTypes.h"
|
||||
#include "mozilla/dom/PBackgroundLSSimpleRequest.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsILocalStorageManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nscore.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -140,8 +173,8 @@ nsresult CreatePromise(JSContext* aContext, Promise** aPromise) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CheckedPrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
|
||||
PrincipalInfo& aPrincipalInfo) {
|
||||
nsresult CheckedPrincipalToPrincipalInfo(
|
||||
nsIPrincipal* aPrincipal, mozilla::ipc::PrincipalInfo& aPrincipalInfo) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
|
||||
@ -150,12 +183,14 @@ nsresult CheckedPrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(aPrincipalInfo))) {
|
||||
if (NS_WARN_IF(!quota::QuotaManager::IsPrincipalInfoValid(aPrincipalInfo))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aPrincipalInfo.type() != PrincipalInfo::TContentPrincipalInfo &&
|
||||
aPrincipalInfo.type() != PrincipalInfo::TSystemPrincipalInfo) {
|
||||
if (aPrincipalInfo.type() !=
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo &&
|
||||
aPrincipalInfo.type() !=
|
||||
mozilla::ipc::PrincipalInfo::TSystemPrincipalInfo) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
@ -275,7 +310,7 @@ LocalStorageManager2::Preload(nsIPrincipal* aPrincipal, JSContext* aContext,
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
PrincipalInfo principalInfo;
|
||||
mozilla::ipc::PrincipalInfo principalInfo;
|
||||
rv = CheckedPrincipalToPrincipalInfo(aPrincipal, principalInfo);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
@ -355,8 +390,8 @@ LSRequestChild* LocalStorageManager2::StartRequest(
|
||||
const LSRequestParams& aParams, LSRequestChildCallback* aCallback) {
|
||||
AssertIsOnDOMFileThread();
|
||||
|
||||
PBackgroundChild* backgroundActor =
|
||||
BackgroundChild::GetOrCreateForCurrentThread();
|
||||
mozilla::ipc::PBackgroundChild* backgroundActor =
|
||||
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
|
||||
if (NS_WARN_IF(!backgroundActor)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -380,8 +415,8 @@ nsresult LocalStorageManager2::StartSimpleRequest(
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aPromise);
|
||||
|
||||
PBackgroundChild* backgroundActor =
|
||||
BackgroundChild::GetOrCreateForCurrentThread();
|
||||
mozilla::ipc::PBackgroundChild* backgroundActor =
|
||||
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
|
||||
if (NS_WARN_IF(!backgroundActor)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -7,8 +7,11 @@
|
||||
#ifndef mozilla_dom_localstorage_LocalStorageManager2_h
|
||||
#define mozilla_dom_localstorage_LocalStorageManager2_h
|
||||
|
||||
#include <cstdint>
|
||||
#include "ErrorList.h"
|
||||
#include "nsIDOMStorageManager.h"
|
||||
#include "nsILocalStorageManager.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,6 +7,8 @@
|
||||
#ifndef mozilla_dom_localstorage_ReportInternalError_h
|
||||
#define mozilla_dom_localstorage_ReportInternalError_h
|
||||
|
||||
#include <cstdint>
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
#define LS_WARNING(...) \
|
||||
|
@ -7,8 +7,9 @@
|
||||
#ifndef mozilla_dom_localstorage_SerializationHelpers_h
|
||||
#define mozilla_dom_localstorage_SerializationHelpers_h
|
||||
|
||||
#include <string>
|
||||
#include "chrome/common/ipc_message_utils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
#include "mozilla/dom/LSSnapshot.h"
|
||||
#include "mozilla/dom/LSValue.h"
|
||||
|
||||
|
@ -6,6 +6,11 @@
|
||||
|
||||
#include "SnappyUtils.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/fallible.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsString.h"
|
||||
#include "snappy/snappy.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -7,7 +7,8 @@
|
||||
#ifndef mozilla_StoragePrincipalHelper_h
|
||||
#define mozilla_StoragePrincipalHelper_h
|
||||
|
||||
#include "nsError.h"
|
||||
#include <cstdint>
|
||||
#include "ErrorList.h"
|
||||
|
||||
/**
|
||||
* StoragePrincipal
|
||||
@ -200,8 +201,10 @@
|
||||
*/
|
||||
|
||||
class nsIChannel;
|
||||
class nsICookieJarSettings;
|
||||
class nsILoadGroup;
|
||||
class nsIPrincipal;
|
||||
class nsIURI;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user