mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1397128 P8 Track which storage "namespace" each Cache object is associated with. r=tt
This commit is contained in:
parent
65f88cc067
commit
9e8538fa6a
4
dom/cache/Cache.cpp
vendored
4
dom/cache/Cache.cpp
vendored
@ -256,12 +256,14 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Cache)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
Cache::Cache(nsIGlobalObject* aGlobal, CacheChild* aActor)
|
||||
Cache::Cache(nsIGlobalObject* aGlobal, CacheChild* aActor, Namespace aNamespace)
|
||||
: mGlobal(aGlobal)
|
||||
, mActor(aActor)
|
||||
, mNamespace(aNamespace)
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(mGlobal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mNamespace != INVALID_NAMESPACE);
|
||||
mActor->SetListener(this);
|
||||
}
|
||||
|
||||
|
3
dom/cache/Cache.h
vendored
3
dom/cache/Cache.h
vendored
@ -41,7 +41,7 @@ class Cache final : public nsISupports
|
||||
, public TypeUtils
|
||||
{
|
||||
public:
|
||||
Cache(nsIGlobalObject* aGlobal, CacheChild* aActor);
|
||||
Cache(nsIGlobalObject* aGlobal, CacheChild* aActor, Namespace aNamespace);
|
||||
|
||||
// webidl interface methods
|
||||
already_AddRefed<Promise>
|
||||
@ -109,6 +109,7 @@ private:
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mGlobal;
|
||||
CacheChild* mActor;
|
||||
const Namespace mNamespace;
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
6
dom/cache/CacheOpChild.cpp
vendored
6
dom/cache/CacheOpChild.cpp
vendored
@ -158,8 +158,8 @@ CacheOpChild::Recv__delete__(const ErrorResult& aRv,
|
||||
}
|
||||
case CacheOpResult::TStorageOpenResult:
|
||||
{
|
||||
auto actor = static_cast<CacheChild*>(
|
||||
aResult.get_StorageOpenResult().actorChild());
|
||||
auto result = aResult.get_StorageOpenResult();
|
||||
auto actor = static_cast<CacheChild*>(result.actorChild());
|
||||
|
||||
// If we have a success status then we should have an actor. Gracefully
|
||||
// reject instead of crashing, though, if we get a nullptr here.
|
||||
@ -176,7 +176,7 @@ CacheOpChild::Recv__delete__(const ErrorResult& aRv,
|
||||
CacheWorkerHolder::AllowIdleShutdownStart);
|
||||
|
||||
actor->SetWorkerHolder(workerHolder);
|
||||
RefPtr<Cache> cache = new Cache(mGlobal, actor);
|
||||
RefPtr<Cache> cache = new Cache(mGlobal, actor, result.ns());
|
||||
mPromise->MaybeResolve(cache);
|
||||
break;
|
||||
}
|
||||
|
2
dom/cache/CacheTypes.ipdlh
vendored
2
dom/cache/CacheTypes.ipdlh
vendored
@ -10,6 +10,7 @@ include ChannelInfo;
|
||||
include PBackgroundSharedTypes;
|
||||
|
||||
using HeadersGuardEnum from "mozilla/dom/FetchIPCTypes.h";
|
||||
using Namespace from "mozilla/dom/cache/IPCUtils.h";
|
||||
using OpenMode from "mozilla/dom/cache/IPCUtils.h";
|
||||
using ReferrerPolicy from "mozilla/dom/FetchIPCTypes.h";
|
||||
using RequestCredentials from "mozilla/dom/FetchIPCTypes.h";
|
||||
@ -212,6 +213,7 @@ struct StorageHasResult
|
||||
struct StorageOpenResult
|
||||
{
|
||||
nullable PCache actor;
|
||||
Namespace ns;
|
||||
};
|
||||
|
||||
struct StorageDeleteResult
|
||||
|
4
dom/cache/Manager.cpp
vendored
4
dom/cache/Manager.cpp
vendored
@ -1342,7 +1342,9 @@ public:
|
||||
Complete(Listener* aListener, ErrorResult&& aRv) override
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(aRv.Failed() || mCacheId != INVALID_CACHE_ID);
|
||||
aListener->OnOpComplete(Move(aRv), StorageOpenResult(), mCacheId);
|
||||
aListener->OnOpComplete(Move(aRv),
|
||||
StorageOpenResult(nullptr, nullptr, mNamespace),
|
||||
mCacheId);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user