From dd4dbf0fabf0d415174faddc64c60d2498a464a8 Mon Sep 17 00:00:00 2001 From: Mark Capella Date: Wed, 9 May 2012 07:24:24 -0700 Subject: [PATCH] Bug 749367 - script type=texttemplate content parsed as JavaScript (+E4X), r=jst, f=ms2ger, mbrubeck, jdm --- content/base/src/nsScriptLoader.cpp | 14 +------ content/base/test/Makefile.in | 1 + content/base/test/test_bug749367.html | 29 ++++++++++++++ content/xul/content/test/Makefile.in | 1 + content/xul/content/test/test_bug749367.xul | 39 +++++++++++++++++++ content/xul/document/src/nsXULContentSink.cpp | 10 +---- 6 files changed, 73 insertions(+), 21 deletions(-) create mode 100644 content/base/test/test_bug749367.html create mode 100644 content/xul/content/test/test_bug749367.xul diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index 56fa5d9a1fd4..7e11771ddf24 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -465,18 +465,8 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement) } } - if (isJavaScript) - typeID = nsIProgrammingLanguage::JAVASCRIPT; - else { - // Use the object factory to locate a matching language. - nsCOMPtr runtime; - rv = NS_GetJSRuntime(getter_AddRefs(runtime)); - if (NS_FAILED(rv) || runtime == nsnull) { - // Failed to get the explicitly specified language - NS_WARNING("Failed to find a scripting language"); - typeID = nsIProgrammingLanguage::UNKNOWN; - } else - typeID = nsIProgrammingLanguage::JAVASCRIPT; + if (!isJavaScript) { + typeID = nsIProgrammingLanguage::UNKNOWN; } if (typeID != nsIProgrammingLanguage::UNKNOWN) { diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index 686c1a6f839c..555dd089c91d 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -578,6 +578,7 @@ _TEST_FILES2 = \ test_bug719533.html \ test_bug737087.html \ test_bug433662.html \ + test_bug749367.html \ $(NULL) _CHROME_FILES = \ diff --git a/content/base/test/test_bug749367.html b/content/base/test/test_bug749367.html new file mode 100644 index 000000000000..565588f411a9 --- /dev/null +++ b/content/base/test/test_bug749367.html @@ -0,0 +1,29 @@ + + + + + + Test for Bug 749367 + + + + + +Mozilla Bug 749367 + +
+
+  
+
+  
+
+  
+ + + diff --git a/content/xul/content/test/Makefile.in b/content/xul/content/test/Makefile.in index 2057ea8c5ffd..2f46aea9f292 100644 --- a/content/xul/content/test/Makefile.in +++ b/content/xul/content/test/Makefile.in @@ -46,6 +46,7 @@ include $(topsrcdir)/config/rules.mk _TEST_FILES = \ test_bug486990.xul \ + test_bug749367.xul \ $(NULL) _CHROME_FILES = \ diff --git a/content/xul/content/test/test_bug749367.xul b/content/xul/content/test/test_bug749367.xul new file mode 100644 index 000000000000..478a119e828a --- /dev/null +++ b/content/xul/content/test/test_bug749367.xul @@ -0,0 +1,39 @@ + + + + + + + + + + diff --git a/content/xul/document/src/nsXULContentSink.cpp b/content/xul/document/src/nsXULContentSink.cpp index 6ea39269796c..592e0f204beb 100644 --- a/content/xul/document/src/nsXULContentSink.cpp +++ b/content/xul/document/src/nsXULContentSink.cpp @@ -928,15 +928,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes, langID = nsIProgrammingLanguage::JAVASCRIPT; version = JSVERSION_LATEST; } else { - // Use the script object factory to locate the language. - nsCOMPtr runtime; - rv = NS_GetJSRuntime(getter_AddRefs(runtime)); - if (NS_FAILED(rv) || runtime == nsnull) { - // Failed to get the explicitly specified language - NS_WARNING("Failed to find a scripting language"); - langID = nsIProgrammingLanguage::UNKNOWN; - } else - langID = nsIProgrammingLanguage::JAVASCRIPT; + langID = nsIProgrammingLanguage::UNKNOWN; } if (langID != nsIProgrammingLanguage::UNKNOWN) {