Bug 865729 - Use sXPConnect directly in caps. r=gabor

It's tempting to go through nsContentUtils here, but I'm pretty sure caps is
initialized before nsContentUtils.
This commit is contained in:
Bobby Holley 2013-04-29 11:16:21 -07:00
parent b3058238af
commit dde0ee15d3
2 changed files with 2 additions and 8 deletions

View File

@ -16,7 +16,6 @@
#include "nsHashtable.h"
#include "nsCOMPtr.h"
#include "nsIChannelEventSink.h"
#include "nsIJSContextStack.h"
#include "nsIObserver.h"
#include "pldhash.h"
#include "plstr.h"
@ -523,7 +522,6 @@ private:
static nsIIOService *sIOService;
static nsIXPConnect *sXPConnect;
static nsIThreadJSContextStack* sJSContextStack;
static nsIStringBundle *sStrBundle;
static JSRuntime *sRuntime;
};

View File

@ -22,7 +22,6 @@
#include "nsXPIDLString.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsIJSContextStack.h"
#include "nsError.h"
#include "nsDOMCID.h"
#include "jsdbgapi.h"
@ -73,7 +72,6 @@ static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
nsIIOService *nsScriptSecurityManager::sIOService = nullptr;
nsIXPConnect *nsScriptSecurityManager::sXPConnect = nullptr;
nsIThreadJSContextStack *nsScriptSecurityManager::sJSContextStack = nullptr;
nsIStringBundle *nsScriptSecurityManager::sStrBundle = nullptr;
JSRuntime *nsScriptSecurityManager::sRuntime = 0;
bool nsScriptSecurityManager::sStrictFileOriginPolicy = true;
@ -265,7 +263,7 @@ nsScriptSecurityManager::GetCurrentJSContext()
{
// Get JSContext from stack.
JSContext *cx;
if (NS_FAILED(sJSContextStack->Peek(&cx)))
if (NS_FAILED(sXPConnect->Peek(&cx)))
return nullptr;
return cx;
}
@ -274,7 +272,7 @@ JSContext *
nsScriptSecurityManager::GetSafeJSContext()
{
// Get JSContext from stack.
return sJSContextStack->GetSafeJSContext();
return sXPConnect->GetSafeJSContext();
}
/* static */
@ -2423,7 +2421,6 @@ nsresult nsScriptSecurityManager::Init()
return NS_ERROR_FAILURE;
NS_ADDREF(sXPConnect = xpconnect);
NS_ADDREF(sJSContextStack = xpconnect);
JSContext* cx = GetSafeJSContext();
if (!cx) return NS_ERROR_FAILURE; // this can happen of xpt loading fails
@ -2500,7 +2497,6 @@ nsScriptSecurityManager::Shutdown()
NS_IF_RELEASE(sIOService);
NS_IF_RELEASE(sXPConnect);
NS_IF_RELEASE(sJSContextStack);
NS_IF_RELEASE(sStrBundle);
}