All pastes #75530 Raw Edit

Unnamed

public text v1 · immutable
#75530 ·published 2006-06-30 08:28 UTC
rendered paste body
Index: parser/htmlparser/public/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/parser/htmlparser/public/Makefile.in,v
retrieving revision 1.15
diff -p -u -8 -r1.15 Makefile.in
--- parser/htmlparser/public/Makefile.in	15 Mar 2006 17:45:25 -0000	1.15
+++ parser/htmlparser/public/Makefile.in	30 Jun 2006 08:26:51 -0000
@@ -45,16 +45,19 @@ include $(DEPTH)/config/autoconf.mk
 MODULE      = htmlparser
 GRE_MODULE	= 1
 
 XPIDLSRCS = \
 	nsIExpatSink.idl \
 	nsIExtendedExpatSink.idl \
 	$(NULL)
 
+REQUIRES =  js \
+		$(NULL)
+
 EXPORTS = \
 		nsIContentSink.h            \
 		nsITokenizer.h              \
 		nsIHTMLContentSink.h        \
 		nsIFragmentContentSink.h    \
 		nsIParserNode.h             \
 		nsIParser.h                 \
 		nsIDTD.h                    \
Index: parser/htmlparser/public/nsIExpatSink.idl
===================================================================
RCS file: /cvsroot/mozilla/parser/htmlparser/public/nsIExpatSink.idl,v
retrieving revision 1.10
diff -p -u -8 -r1.10 nsIExpatSink.idl
--- parser/htmlparser/public/nsIExpatSink.idl	21 Jan 2006 02:02:01 -0000	1.10
+++ parser/htmlparser/public/nsIExpatSink.idl	30 Jun 2006 08:26:51 -0000
@@ -31,24 +31,25 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
+#include "nsIScriptError.idl"
 
 /**
  * This interface should be implemented by any content sink that wants
  * to get output from expat and do something with it; in other words,
  * by any sink that handles some sort of XML dialect.
  */
 
-[scriptable, uuid(34CB3B34-7F15-4971-B262-370CE61ADE4D)]
+[scriptable, uuid(f61c56b5-ea5b-42b4-ad3c-17416e72e238)]
 interface nsIExpatSink : nsISupports 
 {
   /**
    * Called to handle the opening tag of an element.
    * @param aName the fully qualified tagname of the element
    * @param aAtts the array of attribute names and values.  There are
    *        aAttsCount/2 names and aAttsCount/2 values, so the total number of
    *        elements in the array is aAttsCount.  The names and values
@@ -128,9 +129,20 @@ interface nsIExpatSink : nsISupports 
   void HandleXMLDeclaration(in wstring aVersion,
                             in wstring aEncoding,
                             in long aStandalone);
 
   void ReportError(in wstring aErrorText,
                    in wstring aSourceText,
                    in long aLineNumber,
                    in long aColumnNumber);
+
+  /**
+   * Report an error to the content sink using a nsIScriptError.
+   *
+   * @param aErrorText  Error message to pass to content sink.
+   * @param aSourceText Source text of the document we're parsing.
+   * @param aError      Script error object with line number & column number
+   */
+  void ReportScriptError(in wstring aErrorText,
+                         in wstring aSourceText,
+                         in nsIScriptError aError);
 }; 
Index: parser/htmlparser/src/nsExpatDriver.cpp
===================================================================
RCS file: /cvsroot/mozilla/parser/htmlparser/src/nsExpatDriver.cpp,v
retrieving revision 3.98
diff -p -u -8 -r3.98 nsExpatDriver.cpp
--- parser/htmlparser/src/nsExpatDriver.cpp	30 Mar 2006 18:40:53 -0000	3.98
+++ parser/htmlparser/src/nsExpatDriver.cpp	30 Jun 2006 08:26:52 -0000
@@ -901,38 +901,53 @@ nsExpatDriver::HandleError()
 
   // Adjust the column number so that it is one based rather than zero based.
   PRInt32 colNumber = XML_GetCurrentColumnNumber(mExpatParser) + 1;
   PRInt32 lineNumber = XML_GetCurrentLineNumber(mExpatParser);
 
   nsAutoString errorText;
   CreateErrorText(description.get(), XML_GetBase(mExpatParser), lineNumber,
                   colNumber, errorText);
-
+/*
   nsCOMPtr<nsIConsoleService> cs
     (do_GetService(NS_CONSOLESERVICE_CONTRACTID));
+ */
   nsCOMPtr<nsIScriptError> serr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
-  if (serr && cs) {
-    if (NS_SUCCEEDED(serr->Init(description.get(),
-                                mURISpec.get(),
-                                mLastLine.get(),
-                                lineNumber, colNumber,
-                                nsIScriptError::errorFlag, "malformed-xml")))
+  if (serr /* && cs */) {
+    nsresult rv = serr->Init(description.get(),
+                             mURISpec.get(),
+                             mLastLine.get(),
+                             lineNumber, colNumber,
+                             nsIScriptError::errorFlag, "malformed-xml");
+    if (NS_SUCCEEDED(rv))
+    {
+/*
       cs->LogMessage(serr);
+ */
+    }
   }
 
   nsAutoString sourceText(mLastLine);
   AppendErrorPointer(colNumber, mLastLine.get(), sourceText);
 
   NS_ASSERTION(mSink, "no sink?");
   if (mSink) {
-    mSink->ReportError(errorText.get(), 
-                       sourceText.get(), 
-                       lineNumber, 
-                       colNumber);
+    nsresult rv = NS_OK;
+    if (serr) {
+      rv = mSink->ReportScriptError(errorText.get(), 
+                                    sourceText.get(), 
+                                    serr);
+    }
+    if (!serr || NS_FAILED(rv)) {
+      // Fall back to old routine.
+      mSink->ReportError(errorText.get(), 
+                         sourceText.get(), 
+                         lineNumber, 
+                         colNumber);
+    }
   }
 
   return NS_ERROR_HTMLPARSER_STOPPARSING;
 }
 
 void
 nsExpatDriver::ParseBuffer(const PRUnichar *aBuffer,
                            PRUint32 aLength,
Index: parser/xml/src/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/parser/xml/src/Makefile.in,v
retrieving revision 1.3
diff -p -u -8 -r1.3 Makefile.in
--- parser/xml/src/Makefile.in	6 Jun 2006 23:06:12 -0000	1.3
+++ parser/xml/src/Makefile.in	30 Jun 2006 08:26:52 -0000
@@ -46,16 +46,18 @@ LIBRARY_NAME	= saxp
 
 MOZILLA_INTERNAL_API = 1
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= \
 		necko \
 		xpcom \
 		string \
+		js \
+		xpconnect \
 		htmlparser \
 		content \
 		uconv \
 		$(NULL)
 
 CPPSRCS		= \
 		nsSAXAttributes.cpp \
 		nsSAXLocator.cpp \
Index: parser/xml/src/nsSAXXMLReader.cpp
===================================================================
RCS file: /cvsroot/mozilla/parser/xml/src/nsSAXXMLReader.cpp,v
retrieving revision 1.8
diff -p -u -8 -r1.8 nsSAXXMLReader.cpp
--- parser/xml/src/nsSAXXMLReader.cpp	28 Jun 2006 22:44:42 -0000	1.8
+++ parser/xml/src/nsSAXXMLReader.cpp	30 Jun 2006 08:26:53 -0000
@@ -291,16 +291,24 @@ nsSAXXMLReader::ReportError(const PRUnic
   /// XXX need to settle what to do about the input setup, so I have
   /// coherent values for the nsISAXLocator here. nsnull for now.
   if (mErrorHandler) {
     return mErrorHandler->FatalError(nsnull, nsDependentString(aErrorText));
   }
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsSAXXMLReader::ReportScriptError(const PRUnichar *aErrorText,
+                                      const PRUnichar *aSourceText,
+                                      nsIScriptError *aError)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 // nsISAXXMLReader
 
 NS_IMETHODIMP
 nsSAXXMLReader::GetBaseURI(nsIURI **aBaseURI)
 {
   NS_IF_ADDREF(*aBaseURI = mBaseURI);
   return NS_OK;
 }
Index: content/xml/document/src/nsLoadSaveContentSink.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/xml/document/src/nsLoadSaveContentSink.cpp,v
retrieving revision 1.12
diff -p -u -8 -r1.12 nsLoadSaveContentSink.cpp
--- content/xml/document/src/nsLoadSaveContentSink.cpp	30 Mar 2006 07:57:04 -0000	1.12
+++ content/xml/document/src/nsLoadSaveContentSink.cpp	30 Jun 2006 08:26:59 -0000
@@ -204,8 +204,16 @@ nsLoadSaveContentSink::ReportError(const
                                    PRInt32 aLineNumber,
                                    PRInt32 aColumnNumber)
 {
   // XXX Do error reporting here.  I see no reason to call ReportError
   // on the "base" sink; all we need to do is drop the document on the
   // floor...
   return NS_OK;
 }
+
+NS_IMETHODIMP
+nsLoadSaveContentSink::ReportScriptError(const PRUnichar *aErrorText,
+                                      const PRUnichar *aSourceText,
+                                      nsIScriptError *aError)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
Index: content/xml/document/src/nsXMLContentSink.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/xml/document/src/nsXMLContentSink.cpp,v
retrieving revision 1.388
diff -p -u -8 -r1.388 nsXMLContentSink.cpp
--- content/xml/document/src/nsXMLContentSink.cpp	15 Jun 2006 20:30:44 -0000	1.388
+++ content/xml/document/src/nsXMLContentSink.cpp	30 Jun 2006 08:27:00 -0000
@@ -1346,16 +1346,25 @@ nsXMLContentSink::ReportError(const PRUn
   NS_ENSURE_SUCCESS(rv,rv); 
   
   rv = HandleEndElement(parsererror.get());
   NS_ENSURE_SUCCESS(rv,rv);
 
   return NS_OK;
 }
 
+
+NS_IMETHODIMP
+nsXMLContentSink::ReportScriptError(const PRUnichar *aErrorText,
+                                      const PRUnichar *aSourceText,
+                                      nsIScriptError *aError)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 nsresult
 nsXMLContentSink::AddAttributes(const PRUnichar** aAtts,
                                 nsIContent* aContent)
 {
   // Add tag attributes to the content attributes
   nsCOMPtr<nsIAtom> prefix, localName;
   while (*aAtts) {
     PRInt32 nameSpaceID;
Index: content/xml/document/src/nsXMLFragmentContentSink.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/xml/document/src/nsXMLFragmentContentSink.cpp,v
retrieving revision 1.15
diff -p -u -8 -r1.15 nsXMLFragmentContentSink.cpp
--- content/xml/document/src/nsXMLFragmentContentSink.cpp	30 Mar 2006 07:57:04 -0000	1.15
+++ content/xml/document/src/nsXMLFragmentContentSink.cpp	30 Jun 2006 08:27:00 -0000
@@ -73,16 +73,20 @@ public:
                                          const PRUnichar *aData);
   NS_IMETHOD HandleXMLDeclaration(const PRUnichar *aVersion,
                                   const PRUnichar *aEncoding,
                                   PRInt32 aStandalone);
   NS_IMETHOD ReportError(const PRUnichar* aErrorText, 
                          const PRUnichar* aSourceText,
                          PRInt32 aLineNumber,
                          PRInt32 aColumnNumber);
+  NS_IMETHOD ReportScriptError(const PRUnichar* aErrorText, 
+                               const PRUnichar* aSourceText,
+                               nsIScriptError *aError);
+                         
 
   // nsIContentSink
   NS_IMETHOD WillBuildModel(void);
   NS_IMETHOD DidBuildModel();
   NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
   virtual nsISupports *GetTarget();
 
   // nsIXMLContentSink
@@ -92,16 +96,17 @@ public:
   NS_IMETHOD SetTargetDocument(nsIDocument* aDocument);
   NS_IMETHOD WillBuildContent();
   NS_IMETHOD DidBuildContent();
   NS_IMETHOD IgnoreFirstContainer();
 
 protected:
   virtual PRBool SetDocElement(PRInt32 aNameSpaceID, 
                                nsIAtom *aTagName,
+
                                nsIContent *aContent);
   virtual nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
                                  nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
                                  nsIContent** aResult, PRBool* aAppendContent);
   virtual nsresult CloseElement(nsIContent* aContent, nsIContent* aParent,
                                 PRBool* aAppendContent);
 
   // nsContentSink overrides
@@ -344,16 +349,25 @@ nsXMLFragmentContentSink::ReportError(co
   // Clear any buffered-up text we have.  It's enough to set the length to 0.
   // The buffer itself is allocated when we're created and deleted in our
   // destructor, so don't mess with it.
   mTextLength = 0;
 
   return NS_OK; 
 }
 
+
+NS_IMETHODIMP
+nsXMLFragmentContentSink::ReportScriptError(const PRUnichar *aErrorText,
+                                      const PRUnichar *aSourceText,
+                                      nsIScriptError *aError)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 nsresult
 nsXMLFragmentContentSink::ProcessStyleLink(nsIContent* aElement,
                                            const nsSubstring& aHref,
                                            PRBool aAlternate,
                                            const nsSubstring& aTitle,
                                            const nsSubstring& aType,
                                            const nsSubstring& aMedia)
 {
Index: content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp,v
retrieving revision 1.44
diff -p -u -8 -r1.44 txMozillaStylesheetCompiler.cpp
--- content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp	15 Jun 2006 20:30:44 -0000	1.44
+++ content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp	30 Jun 2006 08:27:01 -0000
@@ -236,16 +236,24 @@ txStylesheetSink::ReportError(const PRUn
                               PRInt32 aLineNumber,
                               PRInt32 aColumnNumber)
 {
     mCompiler->cancel(NS_ERROR_FAILURE, aErrorText, aSourceText);
 
     return NS_OK;
 }
 
+NS_IMETHODIMP
+txStylesheetSink::ReportScriptError(const PRUnichar *aErrorText,
+                                      const PRUnichar *aSourceText,
+                                      nsIScriptError *aError)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 NS_IMETHODIMP 
 txStylesheetSink::DidBuildModel()
 {  
     return mCompiler->doneLoading();
 }
 
 NS_IMETHODIMP
 txStylesheetSink::OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext,
Index: content/xul/document/src/nsXULContentSink.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/xul/document/src/nsXULContentSink.cpp,v
retrieving revision 1.167
diff -p -u -8 -r1.167 nsXULContentSink.cpp
--- content/xul/document/src/nsXULContentSink.cpp	13 Jun 2006 03:07:45 -0000	1.167
+++ content/xul/document/src/nsXULContentSink.cpp	30 Jun 2006 08:27:02 -0000
@@ -1068,16 +1068,24 @@ XULContentSinkImpl::ReportError(const PR
   NS_ENSURE_SUCCESS(rv,rv); 
   
   rv = HandleEndElement(parsererror.get());
   NS_ENSURE_SUCCESS(rv,rv);
 
   return rv;
 }
 
+NS_IMETHODIMP
+XULContentSinkImpl::ReportScriptError(const PRUnichar *aErrorText,
+                                      const PRUnichar *aSourceText,
+                                      nsIScriptError *aError)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 nsresult
 XULContentSinkImpl::SetElementScriptType(nsXULPrototypeElement* element,
                                          const PRUnichar** aAttributes, 
                                          const PRUint32 aAttrLen)
 {
     // First check if the attributes specify an explicit script type.
     nsresult rv = NS_OK;
     PRUint32 i;
Index: rdf/base/src/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/rdf/base/src/Makefile.in,v
retrieving revision 1.36
diff -p -u -8 -r1.36 Makefile.in
--- rdf/base/src/Makefile.in	18 Nov 2005 20:34:19 -0000	1.36
+++ rdf/base/src/Makefile.in	30 Jun 2006 08:27:03 -0000
@@ -47,16 +47,18 @@ LIBRARY_NAME	= rdfbase_s
 LIBXUL_LIBRARY  = 1
 
 REQUIRES	= xpcom \
 		  string \
 		  rdfutil \
 		  necko \
 		  content \
 		  htmlparser \
+		  js \
+		  xpconnect \
 		  unicharutil \
 		  $(NULL)
 
 CPPSRCS		= \
 		rdfTriplesSerializer.cpp \
 		nsCompositeDataSource.cpp \
 		nsContainerEnumerator.cpp \
 		nsDefaultResourceFactory.cpp \
Index: rdf/base/src/nsRDFContentSink.cpp
===================================================================
RCS file: /cvsroot/mozilla/rdf/base/src/nsRDFContentSink.cpp,v
retrieving revision 1.128
diff -p -u -8 -r1.128 nsRDFContentSink.cpp
--- rdf/base/src/nsRDFContentSink.cpp	17 Apr 2006 22:39:20 -0000	1.128
+++ rdf/base/src/nsRDFContentSink.cpp	30 Jun 2006 08:27:04 -0000
@@ -593,16 +593,24 @@ NS_IMETHODIMP
 RDFContentSinkImpl::ReportError(const PRUnichar* aErrorText, 
                                 const PRUnichar* aSourceText,
                                 PRInt32 aLineNumber,
                                 PRInt32 aColumnNumber)
 {
   return NS_OK;
 }
 
+NS_IMETHODIMP
+RDFContentSinkImpl::ReportScriptError(const PRUnichar *aErrorText,
+                                      const PRUnichar *aSourceText,
+                                      nsIScriptError *aError)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 ////////////////////////////////////////////////////////////////////////
 // nsIContentSink interface
 
 NS_IMETHODIMP 
 RDFContentSinkImpl::WillBuildModel(void)
 {
     if (mDataSource) {
         nsCOMPtr<nsIRDFXMLSink> sink = do_QueryInterface(mDataSource);