Don't block the parser on scripts we'll never execute. Bug 371743, r+sr=sicking

This commit is contained in:
bzbarsky@mit.edu 2007-04-11 13:18:11 -07:00
parent 076b7d4a14
commit 65e1a1fadf

View File

@ -252,17 +252,18 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// disabled.
// XXX is this different from the mDocument->IsScriptEnabled() call?
nsIScriptGlobalObject *globalObject = mDocument->GetScriptGlobalObject();
if (globalObject)
{
if (!globalObject) {
return NS_ERROR_NOT_AVAILABLE;
}
nsIScriptContext *context = globalObject->GetScriptContext(
nsIProgrammingLanguage::JAVASCRIPT);
// If scripts aren't enabled in the current context, there's no
// point in going on.
if (context && !context->GetScriptsEnabled()) {
if (!context || !context->GetScriptsEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}
}
// Default script language is whatever the root content specifies
// (which may come from a header or http-meta tag)
@ -423,7 +424,6 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
NS_ENSURE_SUCCESS(rv, rv);
// After the security manager, the content-policy stuff gets a veto
if (globalObject) {
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
nsIURI *docURI = mDocument->GetDocumentURI();
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SCRIPT,
@ -473,7 +473,6 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
rv = channel->AsyncOpen(loader, request);
NS_ENSURE_SUCCESS(rv, rv);
}
} else {
request->mLoading = PR_FALSE;
request->mIsInline = PR_TRUE;