diff --git a/mozilla/caps/src/nsScriptSecurityManager.cpp b/mozilla/caps/src/nsScriptSecurityManager.cpp index a9d22c6c78f..adf5c9b4379 100644 --- a/mozilla/caps/src/nsScriptSecurityManager.cpp +++ b/mozilla/caps/src/nsScriptSecurityManager.cpp @@ -1369,7 +1369,7 @@ nsScriptSecurityManager::GetRootDocShell(JSContext *cx, nsIDocShell **result) if (!scriptContext) return NS_ERROR_FAILURE; nsCOMPtr 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 docshellTreeItem(do_QueryInterface(docshell, &rv)); @@ -1415,32 +1415,15 @@ nsScriptSecurityManager::CanExecuteScripts(JSContext* cx, } //-- See if the current window allows JS execution - nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(cx); - if (!scriptContext) return NS_ERROR_FAILURE; - nsCOMPtr globalObject; - scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); - if (!globalObject) return NS_ERROR_FAILURE; nsCOMPtr docshell; - rv = globalObject->GetDocShell(getter_AddRefs(docshell)); - if (NS_FAILED(rv)) return rv; - nsCOMPtr treeItem(do_QueryInterface(docshell)); - if (!treeItem) return NS_ERROR_UNEXPECTED; - nsCOMPtr 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; diff --git a/mozilla/docshell/base/nsIDocShell.idl b/mozilla/docshell/base/nsIDocShell.idl index 619d514bea1..73c8a9843ff 100644 --- a/mozilla/docshell/base/nsIDocShell.idl +++ b/mozilla/docshell/base/nsIDocShell.idl @@ -145,7 +145,7 @@ interface nsIDocShell : nsISupports * document. Note if you want to get the current URI, use the read-only * property on nsIWebNavigation. */ - void setCurrentURI(in nsIURI aURI); + [noscript] void setCurrentURI(in nsIURI aURI); /** * Notify the associated content viewer and all child docshells that they are