Bug 1417209 - Do not fail when version parameter is found. r?mrbkap draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 16 Nov 2017 21:21:39 +0900
changeset 699723 f7a6112e1e22101aac4a4747b44b0858fef70330
parent 699096 a3f183201f7f183c263d554bfb15fbf0b0ed2ea4
child 740696 146ae1a80ee9311f251d82c5266b843dc1e41090
push id89644
push userVYV03354@nifty.ne.jp
push dateFri, 17 Nov 2017 15:04:10 +0000
reviewersmrbkap
bugs1417209
milestone59.0a1
Bug 1417209 - Do not fail when version parameter is found. r?mrbkap I used ReportToConsoleNonLocalized to make the patch upliftable. MozReview-Commit-ID: LsOBOfzU9Hr
dom/xul/nsXULContentSink.cpp
--- a/dom/xul/nsXULContentSink.cpp
+++ b/dom/xul/nsXULContentSink.cpp
@@ -863,17 +863,23 @@ XULContentSinkImpl::OpenScript(const cha
               isJavaScript = true;
               version = JSVERSION_DEFAULT;
 
               // Get the version string, and ensure that JavaScript supports it.
               nsAutoString versionName;
               rv = parser.GetParameter("version", versionName);
 
               if (NS_SUCCEEDED(rv)) {
-                  version = JSVERSION_UNKNOWN;
+                  nsContentUtils::ReportToConsoleNonLocalized(
+                      NS_LITERAL_STRING("Versioned JavaScripts are no longer supported. "
+                                        "Please remove the version parameter."),
+                      nsIScriptError::errorFlag,
+                      NS_LITERAL_CSTRING("XUL Document"),
+                      nullptr, mDocumentURL, EmptyString(), aLineNumber);
+                  isJavaScript = false;
               } else if (rv != NS_ERROR_INVALID_ARG) {
                   return rv;
               }
           } else {
               isJavaScript = false;
           }
       } else if (key.EqualsLiteral("language")) {
           // Language is deprecated, and the impl in ScriptLoader ignores the