diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 26c0eb99f57..e148f73a305 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -137,7 +137,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID); #include "nsDateTimeFormatCID.h" #include "nsIDateTimeFormat.h" -#include "nsIComponentRegistrar.h" static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID); static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID); @@ -784,9 +783,6 @@ nsDocument::~nsDocument() delete mBoxObjectTable; } -PRBool gCheckedForXPathDOM = PR_FALSE; -PRBool gHaveXPathDOM = PR_FALSE; - NS_INTERFACE_MAP_BEGIN(nsDocument) NS_INTERFACE_MAP_ENTRY(nsIDocument) NS_INTERFACE_MAP_ENTRY(nsIDOMDocument) @@ -814,21 +810,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocument) aIID.Equals(NS_GET_IID(nsIXPathEvaluatorInternal))) { if (!mXPathEvaluatorTearoff) { nsresult rv; - if (!gCheckedForXPathDOM) { - nsCOMPtr cr; - rv = NS_GetComponentRegistrar(getter_AddRefs(cr)); - NS_ENSURE_SUCCESS(rv, rv); - - gCheckedForXPathDOM = PR_TRUE; - - cr->IsContractIDRegistered(NS_XPATH_EVALUATOR_CONTRACTID, - &gHaveXPathDOM); - } - - if (!gHaveXPathDOM) { - return NS_ERROR_NO_INTERFACE; - } - mXPathEvaluatorTearoff = do_CreateInstance(NS_XPATH_EVALUATOR_CONTRACTID, NS_STATIC_CAST(nsIDocument *, this), &rv); diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 053e564c19c..f274989611b 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -102,7 +102,6 @@ #include "jsapi.h" -#include "nsIDOMXPathEvaluator.h" #include "nsNodeInfoManager.h" #include "nsICategoryManager.h" #include "nsIDOMNSFeatureFactory.h" @@ -1195,9 +1194,6 @@ nsGenericElement::SetPrefix(const nsAString& aPrefix) return NS_OK; } -extern PRBool gCheckedForXPathDOM; -extern PRBool gHaveXPathDOM; - nsresult nsGenericElement::InternalIsSupported(nsISupports* aObject, const nsAString& aFeature, @@ -1239,18 +1235,11 @@ nsGenericElement::InternalIsSupported(nsISupports* aObject, PL_strcmp(v, "2.0") == 0) { *aReturn = PR_TRUE; } - } else if ((!gCheckedForXPathDOM || gHaveXPathDOM) && - PL_strcasecmp(f, "XPath") == 0 && - (aVersion.IsEmpty() || - PL_strcmp(v, "3.0") == 0)) { - if (!gCheckedForXPathDOM) { - nsCOMPtr evaluator = - do_CreateInstance(NS_XPATH_EVALUATOR_CONTRACTID); - gHaveXPathDOM = (evaluator != nsnull); - gCheckedForXPathDOM = PR_TRUE; + } else if (PL_strcasecmp(f, "XPath") == 0) { + if (aVersion.IsEmpty() || + PL_strcmp(v, "3.0") == 0) { + *aReturn = PR_TRUE; } - - *aReturn = gHaveXPathDOM; } #ifdef MOZ_SVG else if (PL_strcasecmp(f, "SVGEvents") == 0 || diff --git a/mozilla/content/xslt/src/xpath/Makefile.in b/mozilla/content/xslt/src/xpath/Makefile.in index 82b195c5846..2939aeaf28a 100644 --- a/mozilla/content/xslt/src/xpath/Makefile.in +++ b/mozilla/content/xslt/src/xpath/Makefile.in @@ -97,7 +97,6 @@ CPPSRCS = txAdditiveExpr.cpp \ txVariableRefExpr.cpp ifndef MOZ_XSLT_STANDALONE CPPSRCS += nsXPathEvaluator.cpp \ - nsXPathException.cpp \ nsXPathExpression.cpp \ nsXPathNSResolver.cpp \ nsXPathResult.cpp \ diff --git a/mozilla/content/xslt/src/xpath/nsXFormsXPathEvaluator.cpp b/mozilla/content/xslt/src/xpath/nsXFormsXPathEvaluator.cpp index 302701088cf..3a75b11ee1d 100644 --- a/mozilla/content/xslt/src/xpath/nsXFormsXPathEvaluator.cpp +++ b/mozilla/content/xslt/src/xpath/nsXFormsXPathEvaluator.cpp @@ -40,7 +40,6 @@ #include "nsCOMPtr.h" #include "nsIAtom.h" #include "nsIDOMClassInfo.h" -#include "nsXPathException.h" #include "nsXPathExpression.h" #include "nsXPathNSResolver.h" #include "nsXPathResult.h" diff --git a/mozilla/content/xslt/src/xpath/nsXPath1Scheme.cpp b/mozilla/content/xslt/src/xpath/nsXPath1Scheme.cpp index 30f450d0ba9..d574e116d51 100755 --- a/mozilla/content/xslt/src/xpath/nsXPath1Scheme.cpp +++ b/mozilla/content/xslt/src/xpath/nsXPath1Scheme.cpp @@ -45,7 +45,6 @@ #include "nsXPath1Scheme.h" #include "nsXPathEvaluator.h" -#include "nsXPathException.h" #include "nsDOMError.h" #include "nsXPathResult.h" #include "nsIDOMNode.h" diff --git a/mozilla/content/xslt/src/xpath/nsXPathEvaluator.cpp b/mozilla/content/xslt/src/xpath/nsXPathEvaluator.cpp index 785fcfcd86b..24bb67087d1 100644 --- a/mozilla/content/xslt/src/xpath/nsXPathEvaluator.cpp +++ b/mozilla/content/xslt/src/xpath/nsXPathEvaluator.cpp @@ -40,7 +40,6 @@ #include "nsCOMPtr.h" #include "nsIAtom.h" #include "nsIDOMClassInfo.h" -#include "nsXPathException.h" #include "nsXPathExpression.h" #include "nsXPathNSResolver.h" #include "nsXPathResult.h" @@ -56,11 +55,44 @@ #include "txError.h" #include "nsContentUtils.h" +// txIParseContext implementation +class nsXPathEvaluatorParseContext : public txIParseContext +{ +public: + nsXPathEvaluatorParseContext(nsIDOMXPathNSResolver *aResolver, + PRBool aIsCaseSensitive) + : mResolver(aResolver), + mLastError(NS_OK), + mIsCaseSensitive(aIsCaseSensitive) + { + } + + ~nsXPathEvaluatorParseContext() + { + } + + nsresult getError() + { + return mLastError; + } + + nsresult resolveNamespacePrefix(nsIAtom* aPrefix, PRInt32& aID); + nsresult resolveFunctionCall(nsIAtom* aName, PRInt32 aID, + FunctionCall*& aFunction); + PRBool caseInsensitiveNameTests(); + void SetErrorOffset(PRUint32 aOffset); + +private: + nsIDOMXPathNSResolver* mResolver; + nsresult mLastError; + PRBool mIsCaseSensitive; +}; + NS_IMPL_AGGREGATED(nsXPathEvaluator) NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsXPathEvaluator) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathEvaluator) NS_INTERFACE_MAP_ENTRY(nsIXPathEvaluatorInternal) - NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathEvaluator) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPathEvaluator) NS_INTERFACE_MAP_END nsXPathEvaluator::nsXPathEvaluator(nsISupports *aOuter) @@ -93,7 +125,8 @@ nsXPathEvaluator::CreateExpression(const nsAString & aExpression, } nsCOMPtr doc = do_QueryReferent(mDocument); - ParseContextImpl pContext(aResolver, !doc || doc->IsCaseSensitive()); + nsXPathEvaluatorParseContext pContext(aResolver, + !doc || doc->IsCaseSensitive()); nsAutoPtr expression; rv = txExprParser::createExpr(PromiseFlatString(aExpression), &pContext, getter_Transfers(expression)); @@ -157,11 +190,11 @@ nsXPathEvaluator::SetDocument(nsIDOMDocument* aDocument) } /* - * Implementation of txIParseContext private to nsXPathEvaluator - * ParseContextImpl bases on a nsIDOMXPathNSResolver + * Implementation of txIParseContext private to nsXPathEvaluator, based on a + * nsIDOMXPathNSResolver */ -nsresult nsXPathEvaluator::ParseContextImpl::resolveNamespacePrefix +nsresult nsXPathEvaluatorParseContext::resolveNamespacePrefix (nsIAtom* aPrefix, PRInt32& aID) { aID = kNameSpaceID_Unknown; @@ -194,19 +227,19 @@ nsresult nsXPathEvaluator::ParseContextImpl::resolveNamespacePrefix } nsresult -nsXPathEvaluator::ParseContextImpl::resolveFunctionCall(nsIAtom* aName, - PRInt32 aID, - FunctionCall*& aFn) +nsXPathEvaluatorParseContext::resolveFunctionCall(nsIAtom* aName, + PRInt32 aID, + FunctionCall*& aFn) { return NS_ERROR_XPATH_UNKNOWN_FUNCTION; } -PRBool nsXPathEvaluator::ParseContextImpl::caseInsensitiveNameTests() +PRBool nsXPathEvaluatorParseContext::caseInsensitiveNameTests() { return !mIsCaseSensitive; } void -nsXPathEvaluator::ParseContextImpl::SetErrorOffset(PRUint32 aOffset) +nsXPathEvaluatorParseContext::SetErrorOffset(PRUint32 aOffset) { } diff --git a/mozilla/content/xslt/src/xpath/nsXPathEvaluator.h b/mozilla/content/xslt/src/xpath/nsXPathEvaluator.h index 9655ae39dde..c53812ca0ac 100644 --- a/mozilla/content/xslt/src/xpath/nsXPathEvaluator.h +++ b/mozilla/content/xslt/src/xpath/nsXPathEvaluator.h @@ -40,7 +40,6 @@ #define nsXPathEvaluator_h__ #include "nsIDOMXPathEvaluator.h" -#include "txIXPathContext.h" #include "nsIXPathEvaluatorInternal.h" #include "nsIWeakReference.h" #include "nsAutoPtr.h" @@ -71,38 +70,6 @@ public: NS_IMETHOD SetDocument(nsIDOMDocument* aDocument); private: - // txIParseContext implementation - class ParseContextImpl : public txIParseContext - { - public: - ParseContextImpl(nsIDOMXPathNSResolver* aResolver, - PRBool aIsCaseSensitive) - : mResolver(aResolver), mLastError(NS_OK), - mIsCaseSensitive(aIsCaseSensitive) - { - } - - ~ParseContextImpl() - { - } - - nsresult getError() - { - return mLastError; - } - - nsresult resolveNamespacePrefix(nsIAtom* aPrefix, PRInt32& aID); - nsresult resolveFunctionCall(nsIAtom* aName, PRInt32 aID, - FunctionCall*& aFunction); - PRBool caseInsensitiveNameTests(); - void SetErrorOffset(PRUint32 aOffset); - - private: - nsIDOMXPathNSResolver* mResolver; - nsresult mLastError; - PRBool mIsCaseSensitive; - }; - nsWeakPtr mDocument; nsRefPtr mRecycler; }; diff --git a/mozilla/content/xslt/src/xpath/nsXPathException.cpp b/mozilla/content/xslt/src/xpath/nsXPathException.cpp deleted file mode 100644 index e7a732ff2e1..00000000000 --- a/mozilla/content/xslt/src/xpath/nsXPathException.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is TransforMiiX XSLT processor code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Peter Van der Beken - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * 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 "nsXPathException.h" -#include "nsCRT.h" -#include "nsIDOMClassInfo.h" -#include "nsIBaseDOMException.h" -#include "prprf.h" - -static const char kInvalidExpressionErrName[] = "NS_ERROR_DOM_INVALID_EXPRESSION_ERR"; -static const char kInvalidExpressionErrMessage[] = NS_ERROR_DOM_INVALID_EXPRESSION_MSG; -static const char kTypeErrName[] = "NS_ERROR_DOM_TYPE_ERR"; -static const char kTypeErrMessage[] = NS_ERROR_DOM_TYPE_MSG; - -static void -TXResultToNameAndMessage(nsresult aNSResult, - const char** aName, - const char** aMessage) -{ - if (aNSResult == NS_ERROR_DOM_INVALID_EXPRESSION_ERR) { - *aName = kInvalidExpressionErrName; - *aMessage = kInvalidExpressionErrMessage; - } - else if (aNSResult == NS_ERROR_DOM_TYPE_ERR) { - *aName = kTypeErrName; - *aMessage = kTypeErrMessage; - } - else { - NS_WARNING("Huh, someone is throwing non-XPath DOM errors using the XPath DOM module!"); - *aName = nsnull; - *aMessage = nsnull; - } - - return; -} - - -IMPL_DOM_EXCEPTION_HEAD(nsXPathException, nsIDOMXPathException) - NS_DECL_NSIDOMXPATHEXCEPTION -IMPL_DOM_EXCEPTION_TAIL(nsXPathException, nsIDOMXPathException, XPathException, - NS_ERROR_MODULE_DOM_XPATH, TXResultToNameAndMessage) - -NS_IMETHODIMP -nsXPathException::GetCode(PRUint16* aCode) -{ - NS_ENSURE_ARG_POINTER(aCode); - nsresult result; - mBase->GetResult(&result); - *aCode = NS_ERROR_GET_CODE(result); - - return NS_OK; -} - - -NS_IMPL_ISUPPORTS1(nsXPathExceptionProvider, nsIExceptionProvider) - -nsXPathExceptionProvider::nsXPathExceptionProvider() -{ -} - -nsXPathExceptionProvider::~nsXPathExceptionProvider() -{ -} - -NS_IMETHODIMP -nsXPathExceptionProvider::GetException(nsresult aNSResult, - nsIException *aDefaultException, - nsIException **aException) -{ - NS_ENSURE_ARG_POINTER(aException); - - NS_NewXPathException(aNSResult, aDefaultException, aException); - NS_ENSURE_TRUE(*aException, NS_ERROR_OUT_OF_MEMORY); - - return NS_OK; -} diff --git a/mozilla/content/xslt/src/xpath/nsXPathException.h b/mozilla/content/xslt/src/xpath/nsXPathException.h deleted file mode 100644 index 48df489e00e..00000000000 --- a/mozilla/content/xslt/src/xpath/nsXPathException.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is TransforMiiX XSLT processor code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Peter Van der Beken - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * 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 ***** */ - -#ifndef nsXPathException_h__ -#define nsXPathException_h__ - -#include "nsCOMPtr.h" -#include "nsIDOMXPathException.h" -#include "nsIException.h" -#include "nsIExceptionService.h" - -/* DOM error codes from http://www.w3.org/TR/DOM-Level-3-XPath */ - -#define NS_ERROR_DOM_INVALID_EXPRESSION_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_XPATH, 51) -#define NS_ERROR_DOM_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_XPATH, 52) - -#define NS_ERROR_DOM_INVALID_EXPRESSION_MSG "The expression is not a legal expression." -#define NS_ERROR_DOM_TYPE_MSG "The expression cannot be converted to return the specified type." - -class nsXPathExceptionProvider : public nsIExceptionProvider -{ -public: - nsXPathExceptionProvider(); - virtual ~nsXPathExceptionProvider(); - - // nsISupports interface - NS_DECL_ISUPPORTS - - // nsIExceptionProvider interface - NS_DECL_NSIEXCEPTIONPROVIDER -}; - -#endif diff --git a/mozilla/content/xslt/src/xpath/nsXPathExpression.cpp b/mozilla/content/xslt/src/xpath/nsXPathExpression.cpp index 86cd1d94e2f..b21d362b123 100644 --- a/mozilla/content/xslt/src/xpath/nsXPathExpression.cpp +++ b/mozilla/content/xslt/src/xpath/nsXPathExpression.cpp @@ -55,7 +55,7 @@ NS_INTERFACE_MAP_BEGIN(nsXPathExpression) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathExpression) NS_INTERFACE_MAP_ENTRY(nsIDOMNSXPathExpression) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathExpression) - NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathExpression) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPathExpression) NS_INTERFACE_MAP_END nsXPathExpression::nsXPathExpression(nsAutoPtr& aExpression, diff --git a/mozilla/content/xslt/src/xpath/nsXPathNSResolver.cpp b/mozilla/content/xslt/src/xpath/nsXPathNSResolver.cpp index a38f583e0a4..d95d64f049c 100644 --- a/mozilla/content/xslt/src/xpath/nsXPathNSResolver.cpp +++ b/mozilla/content/xslt/src/xpath/nsXPathNSResolver.cpp @@ -39,13 +39,14 @@ #include "nsXPathNSResolver.h" #include "nsIDOMClassInfo.h" #include "nsDOMString.h" +#include "nsContentUtils.h" NS_IMPL_ADDREF(nsXPathNSResolver) NS_IMPL_RELEASE(nsXPathNSResolver) NS_INTERFACE_MAP_BEGIN(nsXPathNSResolver) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathNSResolver) - NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathNSResolver) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPathNSResolver) NS_INTERFACE_MAP_END nsXPathNSResolver::nsXPathNSResolver(nsIDOMNode* aNode) diff --git a/mozilla/content/xslt/src/xpath/nsXPathNamespace.cpp b/mozilla/content/xslt/src/xpath/nsXPathNamespace.cpp index 54af8e3a5f6..96432e6846c 100644 --- a/mozilla/content/xslt/src/xpath/nsXPathNamespace.cpp +++ b/mozilla/content/xslt/src/xpath/nsXPathNamespace.cpp @@ -45,7 +45,7 @@ NS_INTERFACE_MAP_BEGIN(nsXPathNamespace) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNamespace) NS_INTERFACE_MAP_ENTRY(nsIDOMNode) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathNamespace) - NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathNamespace) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPathNamespace) NS_INTERFACE_MAP_END nsXPathNamespace::nsXPathNamespace() diff --git a/mozilla/content/xslt/src/xpath/nsXPathResult.cpp b/mozilla/content/xslt/src/xpath/nsXPathResult.cpp index a6f646c5c5a..9d72866acb1 100644 --- a/mozilla/content/xslt/src/xpath/nsXPathResult.cpp +++ b/mozilla/content/xslt/src/xpath/nsXPathResult.cpp @@ -43,7 +43,6 @@ #include "nsIContent.h" #include "nsIDOMClassInfo.h" #include "nsIDOMNode.h" -#include "nsXPathException.h" #include "nsIDOMDocument.h" #include "nsDOMString.h" @@ -68,7 +67,7 @@ NS_INTERFACE_MAP_BEGIN(nsXPathResult) NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver) NS_INTERFACE_MAP_ENTRY(nsIXPathResult) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathResult) - NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathResult) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPathResult) NS_INTERFACE_MAP_END NS_IMETHODIMP diff --git a/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp b/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp index 1702f590dff..b4f5ca7a5a4 100644 --- a/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp +++ b/mozilla/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp @@ -251,7 +251,7 @@ NS_INTERFACE_MAP_BEGIN(txMozillaXSLTProcessor) NS_INTERFACE_MAP_ENTRY(nsIDocumentTransformer) NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXSLTProcessor) - NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XSLTProcessor) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XSLTProcessor) NS_INTERFACE_MAP_END txMozillaXSLTProcessor::txMozillaXSLTProcessor() : mStylesheetDocument(nsnull), diff --git a/mozilla/dom/public/nsDOMError.h b/mozilla/dom/public/nsDOMError.h index ffbe556074c..3b6d89d346b 100644 --- a/mozilla/dom/public/nsDOMError.h +++ b/mozilla/dom/public/nsDOMError.h @@ -82,6 +82,11 @@ #define NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SVG,2) #endif +/* DOM error codes from http://www.w3.org/TR/DOM-Level-3-XPath/ */ + +#define NS_ERROR_DOM_INVALID_EXPRESSION_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_XPATH, 51) +#define NS_ERROR_DOM_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_XPATH, 52) + /* DOM error codes defined by us */ #define NS_ERROR_DOM_SECURITY_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,1000) diff --git a/mozilla/dom/public/nsIDOMClassInfo.h b/mozilla/dom/public/nsIDOMClassInfo.h index 67565646fa5..fad33a16163 100644 --- a/mozilla/dom/public/nsIDOMClassInfo.h +++ b/mozilla/dom/public/nsIDOMClassInfo.h @@ -355,6 +355,16 @@ enum nsDOMClassInfoID { // WindowUtils eDOMClassInfo_WindowUtils_id, + // XSLTProcessor + eDOMClassInfo_XSLTProcessor_id, + + // DOM Level 3 XPath objects + eDOMClassInfo_XPathEvaluator_id, + eDOMClassInfo_XPathException_id, + eDOMClassInfo_XPathExpression_id, + eDOMClassInfo_XPathNSResolver_id, + eDOMClassInfo_XPathResult_id, + // Define this near the end so that enabling/disabling foreignobject doesn't // break binary compatibility #if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT) diff --git a/mozilla/dom/src/base/domerr.msg b/mozilla/dom/src/base/domerr.msg index 4f2dd868209..28756325e5e 100644 --- a/mozilla/dom/src/base/domerr.msg +++ b/mozilla/dom/src/base/domerr.msg @@ -77,6 +77,11 @@ DOM_MSG_DEF(NS_ERROR_DOM_SVG_INVALID_VALUE_ERR, "One of the parameters has an in DOM_MSG_DEF(NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE, "The matrix could not be computed") #endif +/* DOM error codes from http://www.w3.org/TR/DOM-Level-3-XPath/ */ + +DOM_MSG_DEF(NS_ERROR_DOM_INVALID_EXPRESSION_ERR, "The expression is not a legal expression.") +DOM_MSG_DEF(NS_ERROR_DOM_TYPE_ERR, "The expression cannot be converted to return the specified type.") + /* DOM error codes defined by us */ /* XXX string should be specified by norris */ diff --git a/mozilla/dom/src/base/nsDOMClassInfo.cpp b/mozilla/dom/src/base/nsDOMClassInfo.cpp index 396e361b195..e05da53a18a 100644 --- a/mozilla/dom/src/base/nsDOMClassInfo.cpp +++ b/mozilla/dom/src/base/nsDOMClassInfo.cpp @@ -186,6 +186,12 @@ #include "nsStyleSet.h" #include "nsStyleContext.h" #include "nsAutoPtr.h" +#include "nsMemory.h" + +// Tranformiix +#include "nsIDOMXPathEvaluator.h" +#include "nsIXSLTProcessor.h" +#include "nsIXSLTProcessorObsolete.h" // includes needed for the prototype chain interfaces #include "nsIDOMNavigator.h" @@ -312,7 +318,11 @@ #include "nsIXULTemplateBuilder.h" #include "nsITreeColumns.h" #endif -#include "nsIDOMXPathEvaluator.h" +#include "nsIDOMXPathException.h" +#include "nsIDOMXPathExpression.h" +#include "nsIDOMNSXPathExpression.h" +#include "nsIDOMXPathNSResolver.h" +#include "nsIDOMXPathResult.h" #ifdef MOZ_SVG #include "nsIDOMGetSVGDocument.h" @@ -1057,6 +1067,20 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(WindowUtils, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(XSLTProcessor, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + + NS_DEFINE_CLASSINFO_DATA(XPathEvaluator, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(XPathException, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(XPathExpression, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(XPathNSResolver, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(XPathResult, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + // Define MOZ_SVG_FOREIGNOBJECT here so that when it gets switched on, // we preserve binary compatibility. New classes should be added // at the end. @@ -1066,6 +1090,24 @@ static nsDOMClassInfoData sClassInfoData[] = { #endif }; +// Objects that shuld be constructable through |new Name();| +struct nsContractIDMapData +{ + PRInt32 mDOMClassInfoID; + const char * const mContractID; +}; + +#define NS_DEFINE_CONSTRUCTOR_DATA(_class, _contract_id) \ + { eDOMClassInfo_##_class##_id, _contract_id }, + +static nsContractIDMapData sConstructorMap[] = +{ + NS_DEFINE_CONSTRUCTOR_DATA(XPathEvaluator, + NS_XPATH_EVALUATOR_CONTRACTID) + NS_DEFINE_CONSTRUCTOR_DATA(XSLTProcessor, + "@mozilla.org/document-transformer;1?type=xslt") +}; + nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull; nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nsnull; PRBool nsDOMClassInfo::sIsInitialized = PR_FALSE; @@ -1592,7 +1634,8 @@ nsDOMClassInfo::RegisterExternalClasses() DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Document) \ - DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node) + DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node) \ + DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathEvaluator) #define DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLElement) \ @@ -1609,10 +1652,6 @@ nsDOMClassInfo::RegisterExternalClasses() DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSUIEvent) \ DOM_CLASSINFO_EVENT_MAP_ENTRIES -#define DOM_CLASSINFO_MAP_END_WITH_XPATH \ - xpathEvaluatorIID, \ - DOM_CLASSINFO_MAP_END - nsresult nsDOMClassInfo::Init() { @@ -1654,19 +1693,6 @@ nsDOMClassInfo::Init() rv = stack->GetSafeJSContext(&cx); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr cr; - NS_GetComponentRegistrar(getter_AddRefs(cr)); - - const nsIID* xpathEvaluatorIID = nsnull; - if (cr) { - PRBool haveXPathDOM; - cr->IsContractIDRegistered(NS_XPATH_EVALUATOR_CONTRACTID, - &haveXPathDOM); - if (haveXPathDOM) { - xpathEvaluatorIID = &NS_GET_IID(nsIDOMXPathEvaluator); - } - } - DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) @@ -1725,7 +1751,7 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXMLDocument) DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END_WITH_XPATH + DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(DocumentType, nsIDOMDocumentType) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentType) @@ -1847,7 +1873,7 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLDocument) DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END_WITH_XPATH + DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(HTMLCollection, nsIDOMHTMLCollection) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeList) @@ -2283,7 +2309,7 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument) DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END_WITH_XPATH + DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(XULElement, nsIDOMXULElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULElement) @@ -2372,7 +2398,7 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIImageDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLDocument) DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END_WITH_XPATH + DOM_CLASSINFO_MAP_END #ifdef MOZ_XUL DOM_CLASSINFO_MAP_BEGIN(XULTemplateBuilder, nsIXULTemplateBuilder) @@ -2435,7 +2461,7 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGDocument) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument) DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END_WITH_XPATH + DOM_CLASSINFO_MAP_END // SVG element classes @@ -2886,6 +2912,33 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_END #endif // MOZ_ENABLE_CANVAS + DOM_CLASSINFO_MAP_BEGIN(XSLTProcessor, nsIXSLTProcessor) + DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessor) + DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessorObsolete) // XXX DEPRECATED + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(XPathEvaluator, nsIDOMXPathEvaluator) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathEvaluator) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(XPathException, nsIDOMXPathException) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathException) + DOM_CLASSINFO_MAP_ENTRY(nsIException) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(XPathExpression, nsIDOMXPathExpression) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathExpression) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSXPathExpression) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(XPathNSResolver, nsIDOMXPathNSResolver) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathNSResolver) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(XPathResult, nsIDOMXPathResult) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathResult) + DOM_CLASSINFO_MAP_END + #if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT) DOM_CLASSINFO_MAP_BEGIN(SVGForeignObjectElement, nsIDOMSVGForeignObjectElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGForeignObjectElement) @@ -2895,7 +2948,7 @@ nsDOMClassInfo::Init() #ifdef NS_DEBUG { - PRUint32 i = sizeof(sClassInfoData) / sizeof(sClassInfoData[0]); + PRUint32 i = NS_ARRAY_LENGTH(sClassInfoData); if (i != eDOMClassInfoIDCount) { NS_ERROR("The number of items in sClassInfoData doesn't match the " @@ -4342,13 +4395,29 @@ nsWindowSH::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, return NS_OK; } +static const char* +FindConstructorContractID(PRInt32 aDOMClassInfoID) +{ + PRUint32 i; + for (i = 0; i < NS_ARRAY_LENGTH(sConstructorMap); ++i) { + if (sConstructorMap[i].mDOMClassInfoID == aDOMClassInfoID) { + return sConstructorMap[i].mContractID; + } + } + return nsnull; +} + static JSBool BaseStubConstructor(const nsGlobalNameStruct *name_struct, JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { nsresult rv; nsCOMPtr native; - if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) { + if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) { + const char *contractid = + FindConstructorContractID(name_struct->mDOMClassInfoID); + native = do_CreateInstance(contractid, &rv); + } else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) { native = do_CreateInstance(name_struct->mCID, &rv); } else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructorAlias) { native = do_CreateInstance(name_struct->mAlias->mCID, &rv); @@ -4507,7 +4576,9 @@ DOMJSClass_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, return JS_FALSE; } - if ((name_struct->mType != nsGlobalNameStruct::eTypeExternalClassInfo || + if ((name_struct->mType != nsGlobalNameStruct::eTypeClassConstructor || + !FindConstructorContractID(name_struct->mDOMClassInfoID)) && + (name_struct->mType != nsGlobalNameStruct::eTypeExternalClassInfo || !name_struct->mData->mConstructorCID) && name_struct->mType != nsGlobalNameStruct::eTypeExternalConstructor && name_struct->mType != nsGlobalNameStruct::eTypeExternalConstructorAlias) { diff --git a/mozilla/dom/src/base/nsDOMException.cpp b/mozilla/dom/src/base/nsDOMException.cpp index 033633cb843..e1edb97d129 100644 --- a/mozilla/dom/src/base/nsDOMException.cpp +++ b/mozilla/dom/src/base/nsDOMException.cpp @@ -46,6 +46,7 @@ #ifdef MOZ_SVG #include "nsIDOMSVGException.h" #endif +#include "nsIDOMXPathException.h" #include "nsString.h" #include "prprf.h" @@ -185,6 +186,22 @@ nsSVGException::GetCode(PRUint16* aCode) } #endif // MOZ_SVG +IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsXPathException, nsIDOMXPathException) + NS_DECL_NSIDOMXPATHEXCEPTION +IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsXPathException, nsIDOMXPathException, + XPathException, NS_ERROR_MODULE_DOM_XPATH, + NSResultToNameAndMessage) + +NS_IMETHODIMP +nsXPathException::GetCode(PRUint16* aCode) +{ + NS_ENSURE_ARG_POINTER(aCode); + nsresult result; + GetResult(&result); + *aCode = NS_ERROR_GET_CODE(result); + + return NS_OK; +} nsBaseDOMException::nsBaseDOMException() { diff --git a/mozilla/layout/build/nsLayoutModule.cpp b/mozilla/layout/build/nsLayoutModule.cpp index 4d78d9c853d..66e379ba8bb 100644 --- a/mozilla/layout/build/nsLayoutModule.cpp +++ b/mozilla/layout/build/nsLayoutModule.cpp @@ -129,17 +129,8 @@ #include "nsStyleSheetService.h" // Transformiix stuff -#include "nsIDOMXPathExpression.h" -#include "nsIDOMNSXPathExpression.h" -#include "nsIDOMXPathNSResolver.h" -#include "nsIDOMXPathResult.h" #include "nsXPathEvaluator.h" -#include "nsXPathException.h" -#include "txAtoms.h" #include "txMozillaXSLTProcessor.h" -#include "txLog.h" -#include "txURIUtils.h" -#include "txXSLTProcessor.h" #include "nsXPath1Scheme.h" #include "nsXFormsXPathEvaluator.h" @@ -237,142 +228,17 @@ void NS_FreeSVGRendererGDIPlusGlobals(); #endif // Transformiix -/* 1c1a3c01-14f6-11d6-a7f2-ea502af815dc */ -#define TRANSFORMIIX_DOMCI_EXTENSION_CID \ -{ 0x1c1a3c01, 0x14f6, 0x11d6, {0xa7, 0xf2, 0xea, 0x50, 0x2a, 0xf8, 0x15, 0xdc} } - /* {0C351177-0159-4500-86B0-A219DFDE4258} */ #define TRANSFORMIIX_XPATH1_SCHEME_CID \ { 0xc351177, 0x159, 0x4500, { 0x86, 0xb0, 0xa2, 0x19, 0xdf, 0xde, 0x42, 0x58 } } -#define TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID \ -"@mozilla.org/transformiix-domci-extender;1" - NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPath1SchemeProcessor) -NS_DOMCI_EXTENSION(Transformiix) - static NS_DEFINE_CID(kXSLTProcessorCID, TRANSFORMIIX_XSLT_PROCESSOR_CID); - NS_DOMCI_EXTENSION_ENTRY_BEGIN(XSLTProcessor) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIXSLTProcessor) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIXSLTProcessorObsolete) // XXX DEPRECATED - NS_DOMCI_EXTENSION_ENTRY_END(XSLTProcessor, nsIXSLTProcessor, PR_TRUE, - &kXSLTProcessorCID) - - static NS_DEFINE_CID(kXPathEvaluatorCID, TRANSFORMIIX_XPATH_EVALUATOR_CID); - NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathEvaluator) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathEvaluator) - NS_DOMCI_EXTENSION_ENTRY_END(XPathEvaluator, nsIDOMXPathEvaluator, PR_TRUE, - &kXPathEvaluatorCID) - - NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathException) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathException) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIException) - NS_DOMCI_EXTENSION_ENTRY_END(XPathException, nsIDOMXPathException, PR_TRUE, - nsnull) - - NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathExpression) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathExpression) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMNSXPathExpression) - NS_DOMCI_EXTENSION_ENTRY_END(XPathExpression, nsIDOMXPathExpression, - PR_TRUE, nsnull) - - NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathNSResolver) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathNSResolver) - NS_DOMCI_EXTENSION_ENTRY_END(XPathNSResolver, nsIDOMXPathNSResolver, - PR_TRUE, nsnull) - - NS_DOMCI_EXTENSION_ENTRY_BEGIN(XPathResult) - NS_DOMCI_EXTENSION_ENTRY_INTERFACE(nsIDOMXPathResult) - NS_DOMCI_EXTENSION_ENTRY_END(XPathResult, nsIDOMXPathResult, PR_TRUE, - nsnull) -NS_DOMCI_EXTENSION_END - // Factory Constructor NS_GENERIC_FACTORY_CONSTRUCTOR(txMozillaXSLTProcessor) - NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsXPathEvaluator, Init) +NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsXPathEvaluator, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsXFormsXPathEvaluator) -NS_DECL_DOM_CLASSINFO(XSLTProcessor) -NS_DECL_DOM_CLASSINFO(XPathEvaluator) -NS_DECL_DOM_CLASSINFO(XPathException) -NS_DECL_DOM_CLASSINFO(XPathExpression) -NS_DECL_DOM_CLASSINFO(XPathNSResolver) -NS_DECL_DOM_CLASSINFO(XPathResult) - -static NS_METHOD -RegisterTransformiix(nsIComponentManager *aCompMgr, - nsIFile *aPath, - const char *registryLocation, - const char *componentType, - const nsModuleComponentInfo *info) -{ - nsresult rv; - - nsCOMPtr catman = - do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); - - if (NS_FAILED(rv)) - return rv; - - nsXPIDLCString previous; - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS, - "XSLTProcessor", - TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS, - "XPathEvaluator", - TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS, - "XPathException", - TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS, - "XPathExpression", - TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS, - "XPathNSResolver", - TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS, - "XPathResult", - TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_ENSURE_SUCCESS(rv, rv); - - char* iidString = NS_GET_IID(nsIXSLTProcessorObsolete).ToString(); - if (!iidString) - return NS_ERROR_OUT_OF_MEMORY; - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_INTERFACE, - "nsIXSLTProcessorObsolete", - iidString, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_Free(iidString); - NS_ENSURE_SUCCESS(rv, rv); - - iidString = NS_GET_IID(nsIXSLTProcessor).ToString(); - if (!iidString) - return NS_ERROR_OUT_OF_MEMORY; - rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_INTERFACE, - "nsIXSLTProcessor", - iidString, - PR_TRUE, PR_TRUE, getter_Copies(previous)); - NS_Free(iidString); - - return rv; -} - //----------------------------------------------------------------------------- // Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and @@ -403,7 +269,6 @@ LayoutShutdownObserver::Observe(nsISupports *aSubject, //----------------------------------------------------------------------------- static PRBool gInitialized = PR_FALSE; -static nsIExceptionProvider *gXPathExceptionProvider; // Perform our one-time intialization for this module @@ -489,25 +354,17 @@ Initialize(nsIModule* aSelf) } nsDOMAttribute::Initialize(); - gXPathExceptionProvider = new nsXPathExceptionProvider(); - NS_IF_ADDREF(gXPathExceptionProvider); - if (!gXPathExceptionProvider || !txXSLTProcessor::init()) { + if (!txXSLTProcessor::init()) { Shutdown(); return NS_ERROR_OUT_OF_MEMORY; } - nsCOMPtr xs = - do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID); - if (xs) - xs->RegisterExceptionProvider(gXPathExceptionProvider, - NS_ERROR_MODULE_DOM_XPATH); // Add our shutdown observer. nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1"); if (observerService) { - LayoutShutdownObserver* observer = - new LayoutShutdownObserver(); + LayoutShutdownObserver* observer = new LayoutShutdownObserver(); if (!observer) { Shutdown(); @@ -535,21 +392,6 @@ Shutdown() gInitialized = PR_FALSE; - nsCOMPtr xs = - do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID); - if (xs && gXPathExceptionProvider) { - xs->UnregisterExceptionProvider(gXPathExceptionProvider, - NS_ERROR_MODULE_DOM_XPATH); - } - NS_IF_RELEASE(gXPathExceptionProvider); - - NS_IF_RELEASE(NS_CLASSINFO_NAME(XSLTProcessor)); - NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathEvaluator)); - NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathException)); - NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathExpression)); - NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathNSResolver)); - NS_IF_RELEASE(NS_CLASSINFO_NAME(XPathResult)); - txXSLTProcessor::shutdown(); nsDOMAttribute::Shutdown(); nsRange::Shutdown(); @@ -1518,8 +1360,7 @@ static const nsModuleComponentInfo gComponents[] = { { "XSLTProcessor", TRANSFORMIIX_XSLT_PROCESSOR_CID, TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID, - txMozillaXSLTProcessorConstructor, - RegisterTransformiix }, + txMozillaXSLTProcessorConstructor }, { "XPathEvaluator", TRANSFORMIIX_XPATH_EVALUATOR_CID, @@ -1531,11 +1372,6 @@ static const nsModuleComponentInfo gComponents[] = { NS_XFORMS_XPATH_EVALUATOR_CONTRACTID, nsXFormsXPathEvaluatorConstructor }, - { "Transformiix DOMCI Extender", - TRANSFORMIIX_DOMCI_EXTENSION_CID, - TRANSFORMIIX_DOMCI_EXTENSION_CONTRACTID, - NS_DOMCI_EXTENSION_CONSTRUCTOR(Transformiix) }, - { "XPath1 XPointer Scheme Processor", TRANSFORMIIX_XPATH1_SCHEME_CID, NS_XPOINTER_SCHEME_PROCESSOR_BASE "xpath1",