mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1154494 - patch 2 - Hold a ref to the sandbox. r=baku
This commit is contained in:
parent
ba01e3a362
commit
b9f39271ea
@ -23,7 +23,8 @@ namespace serviceWorkerScriptCache {
|
||||
namespace {
|
||||
|
||||
already_AddRefed<CacheStorage>
|
||||
CreateCacheStorage(nsIPrincipal* aPrincipal, ErrorResult& aRv)
|
||||
CreateCacheStorage(nsIPrincipal* aPrincipal, ErrorResult& aRv,
|
||||
nsIXPConnectJSObjectHolder** aHolder = nullptr)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
@ -46,6 +47,10 @@ CreateCacheStorage(nsIPrincipal* aPrincipal, ErrorResult& aRv)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aHolder) {
|
||||
sandbox.forget(aHolder);
|
||||
}
|
||||
|
||||
return CacheStorage::CreateOnMainThread(cache::CHROME_ONLY_NAMESPACE,
|
||||
sandboxGlobalObject,
|
||||
aPrincipal, aRv);
|
||||
@ -281,7 +286,7 @@ public:
|
||||
// Always create a CacheStorage since we want to write the network entry to
|
||||
// the cache even if there isn't an existing one.
|
||||
ErrorResult result;
|
||||
mCacheStorage = CreateCacheStorage(aPrincipal, result);
|
||||
mCacheStorage = CreateCacheStorage(aPrincipal, result, getter_AddRefs(mSandbox));
|
||||
if (NS_WARN_IF(result.Failed())) {
|
||||
MOZ_ASSERT(!result.IsErrorWithMessage());
|
||||
return result.StealNSResult();
|
||||
@ -540,6 +545,7 @@ private:
|
||||
}
|
||||
|
||||
nsRefPtr<CompareCallback> mCallback;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> mSandbox;
|
||||
nsRefPtr<CacheStorage> mCacheStorage;
|
||||
|
||||
nsRefPtr<CompareNetwork> mCN;
|
||||
|
Loading…
Reference in New Issue
Block a user