Backing out my checkin to see if it fixes the Txul breakage

git-svn-id: svn://10.0.0.236/trunk@124236 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
harishd%netscape.com
2002-06-27 23:32:51 +00:00
parent 5664835ece
commit 6a17a8cbac
2 changed files with 7 additions and 24 deletions

View File

@@ -1369,7 +1369,7 @@ nsScriptSecurityManager::GetRootDocShell(JSContext *cx, nsIDocShell **result)
if (!scriptContext) return NS_ERROR_FAILURE;
nsCOMPtr<nsIScriptGlobalObject> globalObject;
scriptContext->GetGlobalObject(getter_AddRefs(globalObject));
if (!globalObject) return NS_ERROR_FAILURE;
if (!globalObject) return NS_ERROR_FAILURE;
rv = globalObject->GetDocShell(getter_AddRefs(docshell));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDocShellTreeItem> docshellTreeItem(do_QueryInterface(docshell, &rv));
@@ -1415,32 +1415,15 @@ nsScriptSecurityManager::CanExecuteScripts(JSContext* cx,
}
//-- See if the current window allows JS execution
nsCOMPtr<nsIScriptContext> scriptContext = (nsIScriptContext*)JS_GetContextPrivate(cx);
if (!scriptContext) return NS_ERROR_FAILURE;
nsCOMPtr<nsIScriptGlobalObject> globalObject;
scriptContext->GetGlobalObject(getter_AddRefs(globalObject));
if (!globalObject) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocShell> docshell;
rv = globalObject->GetDocShell(getter_AddRefs(docshell));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(docshell));
if (!treeItem) return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDocShellTreeItem> parentItem;
// Walk up the docshell tree to see if any containing docshell disallows scripts
do {
rv = GetRootDocShell(cx, getter_AddRefs(docshell));
if (NS_SUCCEEDED(rv))
{
rv = docshell->GetAllowJavascript(result);
if (NS_FAILED(rv)) return rv;
if (!*result)
return NS_OK; // Do not run scripts
rv = treeItem->GetParent(getter_AddRefs(parentItem));
if (NS_FAILED(rv)) return rv;
if (parentItem)
{
treeItem = parentItem;
docshell = do_QueryInterface(treeItem, &rv);
if (NS_FAILED(rv)) return rv;
}
} while (parentItem);
return NS_OK;
}
//-- See if JS is disabled globally (via prefs)
*result = mIsJavaScriptEnabled;