Backed out changeset 74293125739a (bug 1176341)
This commit is contained in:
@@ -34,7 +34,7 @@ namespace {
|
||||
|
||||
already_AddRefed<CacheStorage>
|
||||
CreateCacheStorage(nsIPrincipal* aPrincipal, ErrorResult& aRv,
|
||||
JS::MutableHandle<JSObject*>* aSandbox = nullptr)
|
||||
nsIXPConnectJSObjectHolder** aHolder = nullptr)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
@@ -44,20 +44,21 @@ CreateCacheStorage(nsIPrincipal* aPrincipal, ErrorResult& aRv,
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JS::Rooted<JSObject*> sandbox(jsapi.cx());
|
||||
aRv = xpc->CreateSandbox(jsapi.cx(), aPrincipal, sandbox.address());
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> sandbox;
|
||||
aRv = xpc->CreateSandbox(jsapi.cx(), aPrincipal, getter_AddRefs(sandbox));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> sandboxGlobalObject = xpc::NativeGlobal(sandbox);
|
||||
nsCOMPtr<nsIGlobalObject> sandboxGlobalObject =
|
||||
xpc::NativeGlobal(sandbox->GetJSObject());
|
||||
if (!sandboxGlobalObject) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aSandbox) {
|
||||
aSandbox->set(sandbox);
|
||||
if (aHolder) {
|
||||
sandbox.forget(aHolder);
|
||||
}
|
||||
|
||||
// We assume private browsing is not enabled here. The ScriptLoader
|
||||
@@ -319,8 +320,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;
|
||||
JS::MutableHandle<JSObject*> sandboxHandle(&mSandbox);
|
||||
mCacheStorage = CreateCacheStorage(aPrincipal, result, &sandboxHandle);
|
||||
mCacheStorage = CreateCacheStorage(aPrincipal, result, getter_AddRefs(mSandbox));
|
||||
if (NS_WARN_IF(result.Failed())) {
|
||||
MOZ_ASSERT(!result.IsErrorWithMessage());
|
||||
return result.StealNSResult();
|
||||
@@ -621,7 +621,7 @@ private:
|
||||
}
|
||||
|
||||
nsRefPtr<CompareCallback> mCallback;
|
||||
JS::PersistentRooted<JSObject*> mSandbox;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> mSandbox;
|
||||
nsRefPtr<CacheStorage> mCacheStorage;
|
||||
|
||||
nsRefPtr<CompareNetwork> mCN;
|
||||
|
||||
Reference in New Issue
Block a user