From ef8556bca92b4eb099aaa5ffa25ef093dd57716f Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Mon, 11 Sep 2000 22:27:53 +0000 Subject: [PATCH] 36082: don't load contents of script tag if script evaluation is off. r=brendan git-svn-id: svn://10.0.0.236/trunk@78786 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 16 ++++++++++++++-- .../html/document/src/nsHTMLContentSink.cpp | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index cafa6bcaaa9..e46eb7327f5 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -4884,8 +4884,20 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) MOZ_TIMER_STOP(mWatch); // Don't process scripts that aren't JavaScript and don't process - // scripts that are inside iframes, noframe, or noscript tags. - if (isJavaScript && !mNumOpenIFRAMES && !mInsideNoXXXTag) { + // scripts that are inside iframes, noframe, or noscript tags, + // or if the script context has script evaluation disabled: + PRBool scriptsEnabled = PR_TRUE; + nsCOMPtr globalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject)); + if (globalObject) + { + nsCOMPtr context; + if (NS_SUCCEEDED(globalObject->GetContext(getter_AddRefs(context))) + && context) + context->GetScriptsEnabled(&scriptsEnabled); + } + + if (scriptsEnabled && isJavaScript && !mNumOpenIFRAMES && !mInsideNoXXXTag) { mScriptLanguageVersion = jsVersionString; // If there is a SRC attribute... diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index cafa6bcaaa9..e46eb7327f5 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -4884,8 +4884,20 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) MOZ_TIMER_STOP(mWatch); // Don't process scripts that aren't JavaScript and don't process - // scripts that are inside iframes, noframe, or noscript tags. - if (isJavaScript && !mNumOpenIFRAMES && !mInsideNoXXXTag) { + // scripts that are inside iframes, noframe, or noscript tags, + // or if the script context has script evaluation disabled: + PRBool scriptsEnabled = PR_TRUE; + nsCOMPtr globalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject)); + if (globalObject) + { + nsCOMPtr context; + if (NS_SUCCEEDED(globalObject->GetContext(getter_AddRefs(context))) + && context) + context->GetScriptsEnabled(&scriptsEnabled); + } + + if (scriptsEnabled && isJavaScript && !mNumOpenIFRAMES && !mInsideNoXXXTag) { mScriptLanguageVersion = jsVersionString; // If there is a SRC attribute...