Fixing bug 235457. Make new windows opened through window.open be opened on the context of the opener, and make caps not lie about when capabilities are enabled. r=danm-moz@comcast.net, r=caillon@aillon.org, sr=brendan@mozilla.org, a=dbaron@dbaron.org
git-svn-id: svn://10.0.0.236/trunk@154020 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1990,16 +1990,15 @@ nsScriptSecurityManager::IsCapabilityEnabled(const char *capability,
|
||||
nsresult rv;
|
||||
JSStackFrame *fp = nsnull;
|
||||
JSContext *cx = GetCurrentJSContext();
|
||||
fp = cx ? JS_FrameIterator(cx, &fp) : nsnull;
|
||||
if (!fp)
|
||||
if (!cx)
|
||||
{
|
||||
// No script code on stack. Allow execution.
|
||||
// No context reachable. Allow execution.
|
||||
*result = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
*result = PR_FALSE;
|
||||
nsCOMPtr<nsIPrincipal> previousPrincipal;
|
||||
do
|
||||
while ((fp = JS_FrameIterator(cx, &fp)) != nsnull)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
if (NS_FAILED(GetFramePrincipal(cx, fp, getter_AddRefs(principal))))
|
||||
@@ -2031,7 +2030,7 @@ nsScriptSecurityManager::IsCapabilityEnabled(const char *capability,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (*result)
|
||||
return NS_OK;
|
||||
} while ((fp = JS_FrameIterator(cx, &fp)) != nsnull);
|
||||
}
|
||||
|
||||
if (!previousPrincipal)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user