Bug 1147946, part 3 - Eliminate unused case for non-JS scripting languages in XULContentSinkImpl::OpenScript(). r=baku
authorAndrew McCreight <continuation@gmail.com>
Thu, 02 Apr 2015 12:13:15 -0700
changeset 267279 226747de554e70027e4bb2af524b154cb48bcd3a
parent 267278 f23b648a2970d4003bd2f003932fe508853bc45e
child 267280 afe401fb6901a020fcc605846e46194234d337f1
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1147946
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1147946, part 3 - Eliminate unused case for non-JS scripting languages in XULContentSinkImpl::OpenScript(). r=baku langID is either be UNKNOWN or JAVASCRIPT so we never run the code here.
dom/xul/nsXULContentSink.cpp
--- a/dom/xul/nsXULContentSink.cpp
+++ b/dom/xul/nsXULContentSink.cpp
@@ -908,31 +908,17 @@ XULContentSinkImpl::OpenScript(const cha
           if (nsContentUtils::IsJavaScriptLanguage(lang)) {
               version = JSVERSION_DEFAULT;
               langID = nsIProgrammingLanguage::JAVASCRIPT;
           }
       }
       aAttributes += 2;
   }
 
-  // Not all script languages have a "sandbox" concept.  At time of
-  // writing, Python is the only other language, and it does not.
-  // For such languages, neither any inline script nor remote script are
-  // safe to execute from untrusted sources.
-  // So for such languages, we only allow script when the document
-  // itself is from chrome.  We then don't bother to check the
-  // "src=" tag - we trust chrome to do the right thing.
-  // (See also similar code in nsScriptLoader.cpp)
   nsCOMPtr<nsIDocument> doc(do_QueryReferent(mDocument));
-  if (langID != nsIProgrammingLanguage::UNKNOWN && 
-      langID != nsIProgrammingLanguage::JAVASCRIPT &&
-      doc && !nsContentUtils::IsChromeDoc(doc)) {
-      langID = nsIProgrammingLanguage::UNKNOWN;
-      NS_WARNING("Non JS language called from non chrome - ignored");
-  }
 
   // Don't process scripts that aren't known
   if (langID != nsIProgrammingLanguage::UNKNOWN) {
       nsCOMPtr<nsIScriptGlobalObject> globalObject;
       if (doc)
           globalObject = do_QueryInterface(doc->GetWindow());
       nsRefPtr<nsXULPrototypeScript> script =
           new nsXULPrototypeScript(aLineNumber, version);