Bug 1356843 - Fix -Wcomma warning in dom/xml/nsXMLFragmentContentSink.cpp. r=bz, a=ritu
authorChris Peterson <cpeterson@mozilla.com>
Mon, 27 Mar 2017 19:41:50 -0700
changeset 578486 3a80d48a9249c162868272af23fa09c5c556bb0c
parent 578485 1d86e96610a1c431b8a10f35306d66804177dc92
child 578487 c8ba3f911eb1fdd4f763f7dbeb96fca09b22eca4
push id58939
push userbmo:cku@mozilla.com
push dateTue, 16 May 2017 04:17:59 +0000
reviewersbz, ritu
bugs1356843, 1134280
milestone52.1.2
Bug 1356843 - Fix -Wcomma warning in dom/xml/nsXMLFragmentContentSink.cpp. r=bz, a=ritu clang's -Wcomma warning warns about suspicious use of the comma operator such as calling a function for side effects within an expression. This warning indicates that nsXMLFragmentContentSink::CloseElement() has been calling aContent->IsHTMLElement() but not using its return value to determine whether to call PreventExecution(). This was a regression from bug 1134280 back in 2015. dom/xml/nsXMLFragmentContentSink.cpp:227:50 [-Wcomma] possible misuse of comma operator here MozReview-Commit-ID: 8y16ISsmNLh
dom/xml/nsXMLFragmentContentSink.cpp
--- a/dom/xml/nsXMLFragmentContentSink.cpp
+++ b/dom/xml/nsXMLFragmentContentSink.cpp
@@ -221,17 +221,17 @@ nsXMLFragmentContentSink::CreateElement(
   return rv;
 }
 
 nsresult
 nsXMLFragmentContentSink::CloseElement(nsIContent* aContent)
 {
   // don't do fancy stuff in nsXMLContentSink
   if (mPreventScriptExecution &&
-      (aContent->IsHTMLElement(nsGkAtoms::script),
+      (aContent->IsHTMLElement(nsGkAtoms::script) ||
        aContent->IsSVGElement(nsGkAtoms::script))) {
     nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aContent);
     NS_ASSERTION(sele, "script did QI correctly!");
     sele->PreventExecution();
   }
   return NS_OK;
 }