Fixing bugscape 3109, LiveConnect exploit. sr=jband, brendan.

Fixing 58021, exploit in "open in new window," bug 55237. sr=brendan
This commit is contained in:
[email protected] committed 2000-11-07 01:14:08 +00:00
1 parent 10cf357362
commit cb2bc2fdbd
3 files changed
+47 -5

No files matched your search

+23
View File
@@ -1102,6 +1102,29 @@ nsScriptSecurityManager::GetPrincipalAndFrame(JSContext *cx,
return NS_OK;
}
}
//-- If there's no principal on the stack, look at the global object
// and return the innermost frame for annotations.
if (cx)
{
nsCOMPtr<nsIScriptContext> scriptContext =
NS_REINTERPRET_CAST(nsIScriptContext*,JS_GetContextPrivate(cx));
if (scriptContext)
{
nsCOMPtr<nsIScriptGlobalObject> global = scriptContext->GetGlobalObject();
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
nsCOMPtr<nsIScriptObjectPrincipal> globalData = do_QueryInterface(global);
NS_ENSURE_TRUE(globalData, NS_ERROR_FAILURE);
globalData->GetPrincipal(result);
if (*result)
{
JSStackFrame *inner = nsnull;
*frameResult = JS_FrameIterator(cx, &inner);
return NS_OK;
}
}
}
*result = nsnull;
return NS_OK;
}