Backed out changeset 4c6e2e3f23f9 (bug 1539759) for failures on nsExpatDriver::WillBuildModel . CLOSED TREE
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Thu, 02 May 2019 13:42:29 +0300
changeset 531068 751ffd71976190312033e68a27affb501136bafb
parent 531067 bfebd4300498feec18eab878c5fecf005d468d13
child 531069 5cd3bf5c4248c420ffd083f9d1542f4f74963b84
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1539759
milestone68.0a1
backs out4c6e2e3f23f9adc7c89e8c500a14ec9cd9f074bd
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
Backed out changeset 4c6e2e3f23f9 (bug 1539759) for failures on nsExpatDriver::WillBuildModel . CLOSED TREE
parser/expat/lib/xmlparse.c
parser/htmlparser/nsExpatDriver.cpp
parser/htmlparser/nsExpatDriver.h
--- a/parser/expat/lib/xmlparse.c
+++ b/parser/expat/lib/xmlparse.c
@@ -1760,26 +1760,26 @@ XML_SetElementDeclHandler(XML_Parser par
 
 void XMLCALL
 XML_SetAttlistDeclHandler(XML_Parser parser,
                           XML_AttlistDeclHandler attdecl)
 {
   if (parser != NULL)
     attlistDeclHandler = attdecl;
 }
-#endif
-/* END MOZILLA CHANGE */
 
 void XMLCALL
 XML_SetEntityDeclHandler(XML_Parser parser,
                          XML_EntityDeclHandler handler)
 {
   if (parser != NULL)
     entityDeclHandler = handler;
 }
+#endif
+/* END MOZILLA CHANGE */
 
 void XMLCALL
 XML_SetXmlDeclHandler(XML_Parser parser,
                       XML_XmlDeclHandler handler) {
   if (parser != NULL)
     xmlDeclHandler = handler;
 }
 
--- a/parser/htmlparser/nsExpatDriver.cpp
+++ b/parser/htmlparser/nsExpatDriver.cpp
@@ -149,28 +149,16 @@ static int Driver_HandleExternalEntityRe
 
   nsExpatDriver* driver =
       static_cast<nsExpatDriver*>(aExternalEntityRefHandler);
 
   return driver->HandleExternalEntityRef(aOpenEntityNames, aBase, aSystemId,
                                          aPublicId);
 }
 
-static void Driver_HandleEntityDecl(
-    void* aUserData, const XML_Char* aEntityName, int aIsParameterEntity,
-    const XML_Char* aValue, int aValueLength, const XML_Char* aBase,
-    const XML_Char* aSystemId, const XML_Char* aPublicId,
-    const XML_Char* aNotationName) {
-  NS_ASSERTION(aUserData, "expat driver should exist");
-  if (aUserData) {
-    static_cast<nsExpatDriver*>(aUserData)->HandleEntityDecl(
-        aEntityName, aValue, aValueLength);
-  }
-}
-
 /***************************** END CALL BACKS ********************************/
 
 /***************************** CATALOG UTILS *********************************/
 
 // Initially added for bug 113400 to switch from the remote "XHTML 1.0 plus
 // MathML 2.0" DTD to the the lightweight customized version that Mozilla uses.
 // Since Mozilla is not validating, no need to fetch a *huge* file at each
 // click.
@@ -481,29 +469,16 @@ nsresult nsExpatDriver::HandleEndDoctype
     MaybeStopParser(rv);
   }
 
   mInternalSubset.Truncate();
 
   return NS_OK;
 }
 
-void nsExpatDriver::HandleEntityDecl(const char16_t* aEntityName,
-                                     const char16_t* aEntityValue,
-                                     const uint32_t aLength) {
-  MOZ_ASSERT(
-      mInInternalSubset || mInExternalDTD,
-      "Should only see entity declarations in the internal subset or in DTDs");
-  auto charLength = aLength / sizeof(char16_t);
-  nsDependentSubstring entityVal(aEntityValue, charLength);
-  if (entityVal.FindChar('<') != -1) {
-    MaybeStopParser(NS_ERROR_UNEXPECTED);
-  }
-}
-
 static nsresult ExternalDTDStreamReaderFunc(nsIUnicharInputStream* aIn,
                                             void* aClosure,
                                             const char16_t* aFromSegment,
                                             uint32_t aToOffset, uint32_t aCount,
                                             uint32_t* aWriteCount) {
   // Pass the buffer to expat for parsing.
   if (XML_Parse((XML_Parser)aClosure, (const char*)aFromSegment,
                 aCount * sizeof(char16_t), 0) == XML_STATUS_OK) {
@@ -1077,19 +1052,16 @@ nsExpatDriver::WillBuildModel(const CPar
       (XML_ExternalEntityRefHandler)Driver_HandleExternalEntityRef);
   XML_SetExternalEntityRefHandlerArg(mExpatParser, this);
   XML_SetCommentHandler(mExpatParser, Driver_HandleComment);
   XML_SetCdataSectionHandler(mExpatParser, Driver_HandleStartCdataSection,
                              Driver_HandleEndCdataSection);
 
   XML_SetParamEntityParsing(mExpatParser,
                             XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE);
-  if (doc->NodePrincipal()->IsSystemPrincipal()) {
-    XML_SetEntityDeclHandler(mExpatParser, Driver_HandleEntityDecl);
-  }
   XML_SetDoctypeDeclHandler(mExpatParser, Driver_HandleStartDoctypeDecl,
                             Driver_HandleEndDoctypeDecl);
 
   // Set up the user data.
   XML_SetUserData(mExpatParser, this);
 
   return mInternalState;
 }
--- a/parser/htmlparser/nsExpatDriver.h
+++ b/parser/htmlparser/nsExpatDriver.h
@@ -44,18 +44,16 @@ class nsExpatDriver : public nsIDTD, pub
   nsresult HandleDefault(const char16_t* aData, const uint32_t aLength);
   nsresult HandleStartCdataSection();
   nsresult HandleEndCdataSection();
   nsresult HandleStartDoctypeDecl(const char16_t* aDoctypeName,
                                   const char16_t* aSysid,
                                   const char16_t* aPubid,
                                   bool aHasInternalSubset);
   nsresult HandleEndDoctypeDecl();
-  void HandleEntityDecl(const char16_t* aEntityName,
-                        const char16_t* aEntityValue, const uint32_t aLength);
 
  private:
   // Load up an external stream to get external entity information
   nsresult OpenInputStreamFromExternalDTD(const char16_t* aFPIStr,
                                           const char16_t* aURLStr,
                                           const char16_t* aBaseURL,
                                           nsIInputStream** aStream,
                                           nsAString& aAbsURL);