bug 580128 - Set nsGlobalChromeWindows' principals to chrome even before they know it. r=jst

This commit is contained in:
Blake Kaplan 2010-09-17 14:54:41 -07:00
Родитель 2a3b7cc2e2
Коммит 56e262cc3d
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -2460,11 +2460,18 @@ nsJSContext::CreateNativeGlobalForInner(
nsIXPConnect *xpc = nsContentUtils::XPConnect();
PRUint32 flags = aIsChrome? nsIXPConnect::FLAG_SYSTEM_GLOBAL_OBJECT : 0;
nsCOMPtr<nsIXPConnectJSObjectHolder> jsholder;
nsCOMPtr<nsIPrincipal> systemPrincipal;
if (aIsChrome) {
nsIScriptSecurityManager *ssm = nsContentUtils::GetSecurityManager();
ssm->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
}
nsresult rv = xpc->
InitClassesWithNewWrappedGlobal(mContext,
aNewInner, NS_GET_IID(nsISupports),
aPrincipal, EmptyCString(),
flags,
aIsChrome ? systemPrincipal.get() : aPrincipal,
EmptyCString(), flags,
getter_AddRefs(jsholder));
if (NS_FAILED(rv))
return rv;