Bug 743888 - Part 1: Remove SVGException and XPathException. r=jonas

This commit is contained in:
Masatoshi Kimura 2012-06-13 21:12:37 -04:00
parent 4e1c54332f
commit 5e1cdc109a
14 changed files with 83 additions and 305 deletions

View File

@ -47,7 +47,6 @@ EXPORTS = \
nsDOMJSUtils.h \ nsDOMJSUtils.h \
nsDOMScriptObjectHolder.h \ nsDOMScriptObjectHolder.h \
nsDOMString.h \ nsDOMString.h \
nsIBaseDOMException.h \
nsIDOMClassInfo.h \ nsIDOMClassInfo.h \
nsIDOMScriptObjectFactory.h \ nsIDOMScriptObjectFactory.h \
nsIJSEventListener.h \ nsIJSEventListener.h \

View File

@ -33,17 +33,17 @@ DOM4_MSG_DEF(DataCloneError, "The object could not be cloned.", NS_ERROR_DOM_DAT
/* XXX Should be JavaScript native TypeError */ /* XXX Should be JavaScript native TypeError */
DOM4_MSG_DEF(TypeError, "The method parameter is missing or invalid.", NS_ERROR_TYPE_ERR) DOM4_MSG_DEF(TypeError, "The method parameter is missing or invalid.", NS_ERROR_TYPE_ERR)
DOM4_MSG_DEF(RangeError, "The method parameter is out of valid range.", NS_ERROR_RANGE_ERR)
/* SVG DOM error codes from http://www.w3.org/TR/SVG11/svgdom.html */ /* SVG DOM errors from http://www.w3.org/TR/SVG11/svgdom.html */
DOM_MSG_DEF(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR, "Unknown or invalid type") DOM4_MSG_DEF(TypeError, "Unknown or invalid type", NS_ERROR_DOM_SVG_WRONG_TYPE_ERR)
DOM_MSG_DEF(NS_ERROR_DOM_SVG_INVALID_VALUE_ERR, "One of the parameters has an invalid value") DOM4_MSG_DEF(InvalidStateError, "The matrix could not be computed", NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE)
DOM_MSG_DEF(NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE, "The matrix could not be computed")
/* DOM error codes from http://www.w3.org/TR/DOM-Level-3-XPath/ */ /* XPath errors 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.") DOM4_MSG_DEF(SyntaxError, "The expression is not a legal expression.", NS_ERROR_DOM_INVALID_EXPRESSION_ERR)
DOM_MSG_DEF(NS_ERROR_DOM_TYPE_ERR, "The expression cannot be converted to return the specified type.") DOM4_MSG_DEF(TypeError, "The expression cannot be converted to return the specified type.", NS_ERROR_DOM_TYPE_ERR)
/* IndexedDB errors http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#exceptions */ /* IndexedDB errors http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#exceptions */

View File

@ -315,7 +315,6 @@
#include "nsIXULTemplateBuilder.h" #include "nsIXULTemplateBuilder.h"
#include "nsTreeColumns.h" #include "nsTreeColumns.h"
#endif #endif
#include "nsIDOMXPathException.h"
#include "nsIDOMXPathExpression.h" #include "nsIDOMXPathExpression.h"
#include "nsIDOMNSXPathExpression.h" #include "nsIDOMNSXPathExpression.h"
#include "nsIDOMXPathNSResolver.h" #include "nsIDOMXPathNSResolver.h"
@ -358,7 +357,6 @@
#include "nsIDOMSVGElement.h" #include "nsIDOMSVGElement.h"
#include "nsIDOMSVGEllipseElement.h" #include "nsIDOMSVGEllipseElement.h"
#include "nsIDOMSVGEvent.h" #include "nsIDOMSVGEvent.h"
#include "nsIDOMSVGException.h"
#include "nsIDOMSVGFilterElement.h" #include "nsIDOMSVGFilterElement.h"
#include "nsIDOMSVGFilters.h" #include "nsIDOMSVGFilters.h"
#include "nsIDOMSVGFitToViewBox.h" #include "nsIDOMSVGFitToViewBox.h"
@ -1242,8 +1240,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGEvent, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(SVGEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGException, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGLength, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(SVGLength, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGLengthList, nsSVGLengthListSH, NS_DEFINE_CLASSINFO_DATA(SVGLengthList, nsSVGLengthListSH,
@ -1336,8 +1332,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(XPathEvaluator, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(XPathEvaluator, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(XPathException, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(XPathExpression, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(XPathExpression, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(XPathNSResolver, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(XPathNSResolver, nsDOMGenericSH,
@ -3787,11 +3781,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_EVENT_MAP_ENTRIES DOM_CLASSINFO_EVENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGException, nsIDOMSVGException)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGException)
DOM_CLASSINFO_MAP_ENTRY(nsIException)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGLength, nsIDOMSVGLength) DOM_CLASSINFO_MAP_BEGIN(SVGLength, nsIDOMSVGLength)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLength) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLength)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
@ -3978,11 +3967,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathEvaluator) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathEvaluator)
DOM_CLASSINFO_MAP_END 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_BEGIN(XPathExpression, nsIDOMXPathExpression)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathExpression) DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathExpression)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSXPathExpression) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSXPathExpression)

View File

@ -283,7 +283,6 @@ DOMCI_CLASS(SVGAnimatedRect)
DOMCI_CLASS(SVGAnimatedString) DOMCI_CLASS(SVGAnimatedString)
DOMCI_CLASS(SVGAnimatedTransformList) DOMCI_CLASS(SVGAnimatedTransformList)
DOMCI_CLASS(SVGEvent) DOMCI_CLASS(SVGEvent)
DOMCI_CLASS(SVGException)
DOMCI_CLASS(SVGLength) DOMCI_CLASS(SVGLength)
DOMCI_CLASS(SVGLengthList) DOMCI_CLASS(SVGLengthList)
DOMCI_CLASS(SVGMatrix) DOMCI_CLASS(SVGMatrix)
@ -340,7 +339,6 @@ DOMCI_CLASS(XSLTProcessor)
// DOM Level 3 XPath objects // DOM Level 3 XPath objects
DOMCI_CLASS(XPathEvaluator) DOMCI_CLASS(XPathEvaluator)
DOMCI_CLASS(XPathException)
DOMCI_CLASS(XPathExpression) DOMCI_CLASS(XPathExpression)
DOMCI_CLASS(XPathNSResolver) DOMCI_CLASS(XPathNSResolver)
DOMCI_CLASS(XPathResult) DOMCI_CLASS(XPathResult)

View File

@ -36,14 +36,14 @@
#define NS_ERROR_DOM_INVALID_NODE_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,24) #define NS_ERROR_DOM_INVALID_NODE_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,24)
#define NS_ERROR_DOM_DATA_CLONE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,25) #define NS_ERROR_DOM_DATA_CLONE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,25)
/* XXX Should be JavaScript native TypeError */ /* XXX Should be JavaScript native errors */
#define NS_ERROR_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,26) #define NS_ERROR_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,26)
#define NS_ERROR_RANGE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,27)
/* SVG DOM error codes from http://www.w3.org/TR/SVG11/svgdom.html */ /* SVG DOM error codes from http://www.w3.org/TR/SVG11/svgdom.html */
#define NS_ERROR_DOM_SVG_WRONG_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SVG,0) #define NS_ERROR_DOM_SVG_WRONG_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SVG,0)
#define NS_ERROR_DOM_SVG_INVALID_VALUE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SVG,1)
#define NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SVG,2) #define NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SVG,2)
/* DOM error codes from http://www.w3.org/TR/DOM-Level-3-XPath/ */ /* DOM error codes from http://www.w3.org/TR/DOM-Level-3-XPath/ */

View File

@ -10,53 +10,10 @@
#include "nsDOMError.h" #include "nsDOMError.h"
#include "nsDOMException.h" #include "nsDOMException.h"
#include "nsIDOMDOMException.h" #include "nsIDOMDOMException.h"
#include "nsIDOMSVGException.h"
#include "nsIDOMXPathException.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsString.h" #include "nsString.h"
#include "prprf.h" #include "prprf.h"
#define IMPL_INTERNAL_DOM_EXCEPTION_HEAD(domname) \
class ns##domname : public nsBaseDOMException, \
public nsIDOM##domname \
{ \
public: \
ns##domname(); \
virtual ~ns##domname(); \
\
NS_DECL_ISUPPORTS_INHERITED
#define IMPL_INTERNAL_DOM_EXCEPTION_TAIL(domname) \
}; \
\
ns##domname::ns##domname() {} \
ns##domname::~ns##domname() {} \
\
DOMCI_DATA(domname, ns##domname) \
\
NS_IMPL_ADDREF_INHERITED(ns##domname, nsBaseDOMException) \
NS_IMPL_RELEASE_INHERITED(ns##domname, nsBaseDOMException) \
NS_INTERFACE_MAP_BEGIN(ns##domname) \
NS_INTERFACE_MAP_ENTRY(nsIDOM##domname) \
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(domname) \
NS_INTERFACE_MAP_END_INHERITING(nsBaseDOMException) \
\
nsresult \
NS_New##domname(nsresult aNSResult, nsIException* aDefaultException, \
nsIException** aException) \
{ \
const char* name; \
const char* message; \
PRUint16 code; \
NSResultToNameAndMessage(aNSResult, &name, &message, &code); \
ns##domname* inst = new ns##domname(); \
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY); \
inst->Init(aNSResult, name, message, code, aDefaultException); \
*aException = inst; \
NS_ADDREF(*aException); \
return NS_OK; \
}
enum DOM4ErrorTypeCodeMap { enum DOM4ErrorTypeCodeMap {
/* DOM4 errors from http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#domexception */ /* DOM4 errors from http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#domexception */
IndexSizeError = nsIDOMDOMException::INDEX_SIZE_ERR, IndexSizeError = nsIDOMDOMException::INDEX_SIZE_ERR,
@ -83,8 +40,9 @@ enum DOM4ErrorTypeCodeMap {
InvalidNodeTypeError = nsIDOMDOMException::INVALID_NODE_TYPE_ERR, InvalidNodeTypeError = nsIDOMDOMException::INVALID_NODE_TYPE_ERR,
DataCloneError = nsIDOMDOMException::DATA_CLONE_ERR, DataCloneError = nsIDOMDOMException::DATA_CLONE_ERR,
/* XXX Should be JavaScript native TypeError */ /* XXX Should be JavaScript native errors */
TypeError = 0, TypeError = 0,
RangeError = 0,
/* IndexedDB errors http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#exceptions */ /* IndexedDB errors http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#exceptions */
UnknownError = 0, UnknownError = 0,
@ -166,9 +124,54 @@ NS_GetNameAndMessageForDOMNSResult(nsresult aNSResult, const char** aName,
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
} }
IMPL_INTERNAL_DOM_EXCEPTION_HEAD(DOMException)
class nsDOMException : public nsIException,
public nsIDOMDOMException
{
public:
nsDOMException() {}
virtual ~nsDOMException() {}
NS_DECL_ISUPPORTS
NS_DECL_NSIEXCEPTION
NS_IMETHOD Init(nsresult aNSResult, const char* aName,
const char* aMessage, PRUint16 aCode,
nsIException* aDefaultException);
NS_DECL_NSIDOMDOMEXCEPTION NS_DECL_NSIDOMDOMEXCEPTION
IMPL_INTERNAL_DOM_EXCEPTION_TAIL(DOMException)
protected:
const char* mName;
const char* mMessage;
nsCOMPtr<nsIException> mInner;
nsresult mResult;
PRUint16 mCode;
};
DOMCI_DATA(DOMException, nsDOMException)
NS_IMPL_ADDREF(nsDOMException)
NS_IMPL_RELEASE(nsDOMException)
NS_INTERFACE_MAP_BEGIN(nsDOMException)
NS_INTERFACE_MAP_ENTRY(nsIException)
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMException)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIException)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMException)
NS_INTERFACE_MAP_END
nsresult
NS_NewDOMException(nsresult aNSResult, nsIException* aDefaultException,
nsIException** aException)
{
const char* name;
const char* message;
PRUint16 code;
NSResultToNameAndMessage(aNSResult, &name, &message, &code);
nsDOMException* inst = new nsDOMException();
inst->Init(aNSResult, name, message, code, aDefaultException);
*aException = inst;
NS_ADDREF(*aException);
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsDOMException::GetCode(PRUint16* aCode) nsDOMException::GetCode(PRUint16* aCode)
@ -176,11 +179,9 @@ nsDOMException::GetCode(PRUint16* aCode)
NS_ENSURE_ARG_POINTER(aCode); NS_ENSURE_ARG_POINTER(aCode);
*aCode = mCode; *aCode = mCode;
// Warn only when the code was changed (IndexedDB or File API) // Warn only when the code was changed (other than DOM Core)
// or the code is useless (zero) // or the code is useless (zero)
if (NS_ERROR_GET_MODULE(mResult) == NS_ERROR_MODULE_DOM_INDEXEDDB || if (NS_ERROR_GET_MODULE(mResult) != NS_ERROR_MODULE_DOM || !mCode) {
NS_ERROR_GET_MODULE(mResult) == NS_ERROR_MODULE_DOM_FILE ||
!mCode) {
nsCOMPtr<nsIDocument> doc = nsCOMPtr<nsIDocument> doc =
do_QueryInterface(nsContentUtils::GetDocumentFromCaller()); do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
if (doc) { if (doc) {
@ -191,44 +192,8 @@ nsDOMException::GetCode(PRUint16* aCode)
return NS_OK; return NS_OK;
} }
IMPL_INTERNAL_DOM_EXCEPTION_HEAD(SVGException)
NS_DECL_NSIDOMSVGEXCEPTION
IMPL_INTERNAL_DOM_EXCEPTION_TAIL(SVGException)
NS_IMETHODIMP NS_IMETHODIMP
nsSVGException::GetCode(PRUint16* aCode) nsDOMException::GetMessageMoz(char **aMessage)
{
NS_ENSURE_ARG_POINTER(aCode);
*aCode = mCode;
return NS_OK;
}
IMPL_INTERNAL_DOM_EXCEPTION_HEAD(XPathException)
NS_DECL_NSIDOMXPATHEXCEPTION
IMPL_INTERNAL_DOM_EXCEPTION_TAIL(XPathException)
NS_IMETHODIMP
nsXPathException::GetCode(PRUint16* aCode)
{
NS_ENSURE_ARG_POINTER(aCode);
*aCode = mCode;
return NS_OK;
}
nsBaseDOMException::nsBaseDOMException()
{
}
nsBaseDOMException::~nsBaseDOMException()
{
}
NS_IMPL_ISUPPORTS2(nsBaseDOMException, nsIException, nsIBaseDOMException)
NS_IMETHODIMP
nsBaseDOMException::GetMessageMoz(char **aMessage)
{ {
if (mMessage) { if (mMessage) {
*aMessage = NS_strdup(mMessage); *aMessage = NS_strdup(mMessage);
@ -240,7 +205,7 @@ nsBaseDOMException::GetMessageMoz(char **aMessage)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetResult(PRUint32* aResult) nsDOMException::GetResult(PRUint32* aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);
@ -250,7 +215,7 @@ nsBaseDOMException::GetResult(PRUint32* aResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetName(char **aName) nsDOMException::GetName(char **aName)
{ {
NS_ENSURE_ARG_POINTER(aName); NS_ENSURE_ARG_POINTER(aName);
@ -264,7 +229,7 @@ nsBaseDOMException::GetName(char **aName)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetFilename(char **aFilename) nsDOMException::GetFilename(char **aFilename)
{ {
if (mInner) { if (mInner) {
return mInner->GetFilename(aFilename); return mInner->GetFilename(aFilename);
@ -278,7 +243,7 @@ nsBaseDOMException::GetFilename(char **aFilename)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetLineNumber(PRUint32 *aLineNumber) nsDOMException::GetLineNumber(PRUint32 *aLineNumber)
{ {
if (mInner) { if (mInner) {
return mInner->GetLineNumber(aLineNumber); return mInner->GetLineNumber(aLineNumber);
@ -292,7 +257,7 @@ nsBaseDOMException::GetLineNumber(PRUint32 *aLineNumber)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetColumnNumber(PRUint32 *aColumnNumber) nsDOMException::GetColumnNumber(PRUint32 *aColumnNumber)
{ {
if (mInner) { if (mInner) {
return mInner->GetColumnNumber(aColumnNumber); return mInner->GetColumnNumber(aColumnNumber);
@ -306,7 +271,7 @@ nsBaseDOMException::GetColumnNumber(PRUint32 *aColumnNumber)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetLocation(nsIStackFrame **aLocation) nsDOMException::GetLocation(nsIStackFrame **aLocation)
{ {
if (mInner) { if (mInner) {
return mInner->GetLocation(aLocation); return mInner->GetLocation(aLocation);
@ -320,7 +285,7 @@ nsBaseDOMException::GetLocation(nsIStackFrame **aLocation)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetInner(nsIException **aInner) nsDOMException::GetInner(nsIException **aInner)
{ {
NS_ENSURE_ARG_POINTER(aInner); NS_ENSURE_ARG_POINTER(aInner);
@ -330,7 +295,7 @@ nsBaseDOMException::GetInner(nsIException **aInner)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::GetData(nsISupports **aData) nsDOMException::GetData(nsISupports **aData)
{ {
if (mInner) { if (mInner) {
return mInner->GetData(aData); return mInner->GetData(aData);
@ -344,7 +309,7 @@ nsBaseDOMException::GetData(nsISupports **aData)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::ToString(char **aReturn) nsDOMException::ToString(char **aReturn)
{ {
*aReturn = nsnull; *aReturn = nsnull;
@ -388,9 +353,9 @@ nsBaseDOMException::ToString(char **aReturn)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBaseDOMException::Init(nsresult aNSResult, const char* aName, nsDOMException::Init(nsresult aNSResult, const char* aName,
const char* aMessage, PRUint16 aCode, const char* aMessage, PRUint16 aCode,
nsIException* aDefaultException) nsIException* aDefaultException)
{ {
mResult = aNSResult; mResult = aNSResult;
mName = aName; mName = aName;

View File

@ -4,41 +4,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIBaseDOMException.h"
#include "nsIException.h" #include "nsIException.h"
class nsBaseDOMException : public nsIException,
public nsIBaseDOMException
{
public:
nsBaseDOMException();
virtual ~nsBaseDOMException();
NS_DECL_ISUPPORTS
NS_DECL_NSIEXCEPTION
NS_IMETHOD Init(nsresult aNSResult, const char* aName,
const char* aMessage, PRUint16 aCode,
nsIException* aDefaultException);
protected:
nsresult mResult;
const char* mName;
const char* mMessage;
PRUint16 mCode; \
nsCOMPtr<nsIException> mInner;
};
nsresult nsresult
NS_GetNameAndMessageForDOMNSResult(nsresult aNSResult, const char** aName, NS_GetNameAndMessageForDOMNSResult(nsresult aNSResult, const char** aName,
const char** aMessage, const char** aMessage,
PRUint16* aCode = nsnull); PRUint16* aCode = nsnull);
#define DECL_INTERNAL_DOM_EXCEPTION(domname) \ nsresult
nsresult \ NS_NewDOMException(nsresult aNSResult, nsIException* aDefaultException,
NS_New##domname(nsresult aNSResult, nsIException* aDefaultException, \ nsIException** aException);
nsIException** aException);
DECL_INTERNAL_DOM_EXCEPTION(DOMException)
DECL_INTERNAL_DOM_EXCEPTION(SVGException)
DECL_INTERNAL_DOM_EXCEPTION(XPathException)

View File

@ -247,19 +247,16 @@ nsDOMExceptionProvider::GetException(nsresult result,
switch (NS_ERROR_GET_MODULE(result)) switch (NS_ERROR_GET_MODULE(result))
{ {
case NS_ERROR_MODULE_DOM:
case NS_ERROR_MODULE_SVG: case NS_ERROR_MODULE_SVG:
return NS_NewSVGException(result, aDefaultException, _retval);
case NS_ERROR_MODULE_DOM_XPATH: case NS_ERROR_MODULE_DOM_XPATH:
return NS_NewXPathException(result, aDefaultException, _retval); case NS_ERROR_MODULE_DOM_FILE:
case NS_ERROR_MODULE_XPCONNECT: case NS_ERROR_MODULE_DOM_INDEXEDDB:
return CreateXPConnectException(result, aDefaultException, _retval); case NS_ERROR_MODULE_DOM_FILEHANDLE:
default:
MOZ_ASSERT(NS_ERROR_GET_MODULE(result) == NS_ERROR_MODULE_DOM ||
NS_ERROR_GET_MODULE(result) == NS_ERROR_MODULE_DOM_FILE ||
NS_ERROR_GET_MODULE(result) == NS_ERROR_MODULE_DOM_INDEXEDDB ||
NS_ERROR_GET_MODULE(result) == NS_ERROR_MODULE_DOM_FILEHANDLE,
"Trying to create an exception for the wrong error module.");
return NS_NewDOMException(result, aDefaultException, _retval); return NS_NewDOMException(result, aDefaultException, _retval);
default:
NS_WARNING("Trying to create an exception for the wrong error module.");
return NS_ERROR_FAILURE;
} }
NS_NOTREACHED("Not reached"); NS_NOTREACHED("Not reached");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;

View File

@ -1,91 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsIBaseDOMException_h___
#define nsIBaseDOMException_h___
#include "nsIDOMClassInfo.h"
// {1f13b201-39fa-11d6-a7f2-df501ff820dc}
#define NS_BASE_DOM_EXCEPTION_CID \
{ 0x1f13b201, 0x39fa, 0x11d6, \
{ 0xa7, 0xf2, 0xdf, 0x50, 0x1f, 0xf8, 0x20, 0xdc } }
// {731d9701-39f8-11d6-a7f2-b39073384c9c}
#define NS_IBASEDOMEXCEPTION_IID \
{ 0xb33afd76, 0x5531, 0x423b, \
{ 0x99, 0x42, 0x90, 0x69, 0xf0, 0x9a, 0x3f, 0x5c } }
class nsIBaseDOMException : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBASEDOMEXCEPTION_IID)
NS_IMETHOD Init(nsresult aNSResult, const char* aName,
const char* aMessage, PRUint16 aCode,
nsIException* aDefaultException) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIBaseDOMException, NS_IBASEDOMEXCEPTION_IID)
#define IMPL_DOM_EXCEPTION_HEAD(classname, ifname) \
class classname : public nsIException, \
public ifname \
{ \
public: \
classname(nsIException* aInner); \
virtual ~classname(); \
\
NS_DECL_ISUPPORTS \
NS_FORWARD_NSIEXCEPTION(mBase->)
// Note: the exception implemented by this macro doesn't free the pointers
// it gets from the mapping_function and assumes they will be valid
// as long as the exception object is alive.
#define IMPL_DOM_EXCEPTION_TAIL(classname, ifname, domname, module, \
mapping_function) \
private: \
nsCOMPtr<nsIException> mBase; \
}; \
\
classname::classname(nsIException* aInner) : mBase(aInner) \
{ \
} \
classname::~classname() {} \
\
NS_IMPL_ADDREF(classname) \
NS_IMPL_RELEASE(classname) \
NS_INTERFACE_MAP_BEGIN(classname) \
NS_INTERFACE_MAP_ENTRY(nsIException) \
NS_INTERFACE_MAP_ENTRY(ifname) \
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIException) \
NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(domname) \
NS_INTERFACE_MAP_END \
\
NS_DEFINE_CID(kBaseDOMException_CID_##domname, NS_BASE_DOM_EXCEPTION_CID); \
\
nsresult \
NS_New##domname(nsresult aNSResult, nsIException* aDefaultException, \
nsIException** aException) \
{ \
if (!(NS_ERROR_GET_MODULE(aNSResult) == module)) { \
NS_WARNING("Trying to create an exception for the wrong error module."); \
return NS_ERROR_FAILURE; \
} \
const char* name; \
const char* message; \
mapping_function(aNSResult, &name, &message); \
nsCOMPtr<nsIBaseDOMException> baseException = \
do_CreateInstance(kBaseDOMException_CID_##domname); \
NS_ENSURE_TRUE(baseException, NS_ERROR_OUT_OF_MEMORY); \
baseException->Init(aNSResult, name, message, aDefaultException); \
nsCOMPtr<nsIException> inner = do_QueryInterface(baseException); \
*aException = new classname(inner); \
NS_ENSURE_TRUE(*aException, NS_ERROR_OUT_OF_MEMORY); \
NS_ADDREF(*aException); \
return NS_OK; \
}
#endif /* nsIBaseDOMException_h___ */

View File

@ -46,7 +46,6 @@ XPIDLSRCS = \
nsIDOMSVGElement.idl \ nsIDOMSVGElement.idl \
nsIDOMSVGEllipseElement.idl \ nsIDOMSVGEllipseElement.idl \
nsIDOMSVGEvent.idl \ nsIDOMSVGEvent.idl \
nsIDOMSVGException.idl \
nsIDOMSVGFilterElement.idl \ nsIDOMSVGFilterElement.idl \
nsIDOMSVGFilters.idl \ nsIDOMSVGFilters.idl \
nsIDOMSVGFitToViewBox.idl \ nsIDOMSVGFitToViewBox.idl \

View File

@ -1,21 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Corresponds to http://www.w3.org/TR/SVG11/svgdom.html#InterfaceSVGException
*/
#include "domstubs.idl"
[scriptable, uuid(64e6f0e1-af99-4bb9-ab25-7e56012f0021)]
interface nsIDOMSVGException : nsISupports
{
// SVGExceptionCode
const unsigned short SVG_WRONG_TYPE_ERR = 0;
const unsigned short SVG_INVALID_VALUE_ERR = 1;
const unsigned short SVG_MATRIX_NOT_INVERTABLE = 2;
readonly attribute unsigned short code;
};

View File

@ -14,7 +14,6 @@ XPIDL_MODULE = dom_xpath
XPIDLSRCS = \ XPIDLSRCS = \
nsIDOMXPathEvaluator.idl \ nsIDOMXPathEvaluator.idl \
nsIDOMXPathException.idl \
nsIDOMXPathExpression.idl \ nsIDOMXPathExpression.idl \
nsIDOMXPathNamespace.idl \ nsIDOMXPathNamespace.idl \
nsIDOMXPathNSResolver.idl \ nsIDOMXPathNSResolver.idl \

View File

@ -1,20 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208
*/
#include "domstubs.idl"
[scriptable, uuid(75506f89-b504-11d5-a7f2-ca108ab8b6fc)]
interface nsIDOMXPathException : nsISupports
{
// XPathExceptionCode
const unsigned short INVALID_EXPRESSION_ERR = 51;
const unsigned short TYPE_ERR = 52;
readonly attribute unsigned short code;
};

View File

@ -597,7 +597,6 @@ CreateHTMLAudioElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
#endif #endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMScriptObjectFactory) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMScriptObjectFactory)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBaseDOMException)
#define NS_GEOLOCATION_CID \ #define NS_GEOLOCATION_CID \
{ 0x1E1C3FF, 0x94A, 0xD048, { 0x44, 0xB4, 0x62, 0xD2, 0x9C, 0x7B, 0x4F, 0x39 } } { 0x1E1C3FF, 0x94A, 0xD048, { 0x44, 0xB4, 0x62, 0xD2, 0x9C, 0x7B, 0x4F, 0x39 } }
@ -699,7 +698,6 @@ NS_DEFINE_NAMED_CID(NS_XMLCONTENTBUILDER_CID);
#endif #endif
NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID); NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
NS_DEFINE_NAMED_CID(NS_DOM_SCRIPT_OBJECT_FACTORY_CID); NS_DEFINE_NAMED_CID(NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
NS_DEFINE_NAMED_CID(NS_BASE_DOM_EXCEPTION_CID);
NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_JSURI_CID); NS_DEFINE_NAMED_CID(NS_JSURI_CID);
NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID); NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID);
@ -968,7 +966,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
#endif #endif
{ &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, NULL, CreateContentDLF }, { &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, NULL, CreateContentDLF },
{ &kNS_DOM_SCRIPT_OBJECT_FACTORY_CID, false, NULL, nsDOMScriptObjectFactoryConstructor }, { &kNS_DOM_SCRIPT_OBJECT_FACTORY_CID, false, NULL, nsDOMScriptObjectFactoryConstructor },
{ &kNS_BASE_DOM_EXCEPTION_CID, false, NULL, nsBaseDOMExceptionConstructor },
{ &kNS_JSPROTOCOLHANDLER_CID, false, NULL, nsJSProtocolHandler::Create }, { &kNS_JSPROTOCOLHANDLER_CID, false, NULL, nsJSProtocolHandler::Create },
{ &kNS_JSURI_CID, false, NULL, nsJSURIConstructor }, { &kNS_JSURI_CID, false, NULL, nsJSURIConstructor },
{ &kNS_WINDOWCOMMANDTABLE_CID, false, NULL, CreateWindowCommandTableConstructor }, { &kNS_WINDOWCOMMANDTABLE_CID, false, NULL, CreateWindowCommandTableConstructor },