зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug 214874. Script should not execute while innerHTML is being set.
r+sr=jst, a=dveditz
This commit is contained in:
Родитель
d62eec97b3
Коммит
2120752cbd
|
@ -324,11 +324,30 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement,
|
|||
aObserver);
|
||||
}
|
||||
|
||||
// If scripts aren't enabled there's no point in going on.
|
||||
// Check whether we should be executing scripts at all for this document
|
||||
if (!mDocument->IsScriptEnabled()) {
|
||||
return FireErrorNotification(NS_ERROR_NOT_AVAILABLE, aElement, aObserver);
|
||||
}
|
||||
|
||||
// Script evaluation can also be disabled in the current script
|
||||
// context even though it's enabled in the document.
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||
if (globalObject)
|
||||
{
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
if (NS_SUCCEEDED(globalObject->GetContext(getter_AddRefs(context)))
|
||||
&& context) {
|
||||
PRBool scriptsEnabled = PR_TRUE;
|
||||
context->GetScriptsEnabled(&scriptsEnabled);
|
||||
// If scripts aren't enabled in the current context, there's no
|
||||
// point in going on.
|
||||
if (!scriptsEnabled) {
|
||||
return FireErrorNotification(NS_ERROR_NOT_AVAILABLE, aElement, aObserver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool isJavaScript = PR_TRUE;
|
||||
const char* jsVersionString = nsnull;
|
||||
nsAutoString language, type, src;
|
||||
|
@ -409,8 +428,6 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement,
|
|||
return FireErrorNotification(rv, aElement, aObserver);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||
// After the security manager, the content-policy stuff gets a veto
|
||||
if (globalObject) {
|
||||
nsCOMPtr<nsIDOMWindow> domWin(do_QueryInterface(globalObject));
|
||||
|
|
Загрузка…
Ссылка в новой задаче