From 7706cbe7a8c3bef680551d14c9192ee124e0b32a Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Wed, 11 Apr 2012 17:55:21 -0400 Subject: [PATCH] Bug 730161 - Replace IDBDatabaseException and FileException with DOMException. r=sicking --- content/base/public/Makefile.in | 1 - content/base/public/nsIDOMFileException.idl | 50 ------ content/base/src/nsGenericDOMDataNode.cpp | 5 +- dom/base/domerr.msg | 85 +++++----- dom/base/nsDOMClassInfo.cpp | 16 -- dom/base/nsDOMClassInfoClasses.h | 2 - dom/base/nsDOMError.h | 9 +- dom/base/nsDOMException.cpp | 174 ++++++++++---------- dom/base/nsDOMException.h | 5 +- dom/base/nsDOMScriptObjectFactory.cpp | 8 +- dom/base/nsIBaseDOMException.h | 6 +- dom/contacts/fallback/ContactDB.jsm | 30 ++-- dom/indexedDB/IDBCursor.cpp | 4 +- dom/indexedDB/IDBDatabase.cpp | 2 +- dom/indexedDB/IDBEvents.cpp | 1 - dom/indexedDB/IDBFactory.cpp | 2 +- dom/indexedDB/Makefile.in | 1 - dom/indexedDB/nsIIDBDatabaseException.idl | 60 ------- js/xpconnect/src/dom_quickstubs.qsconf | 1 - 19 files changed, 159 insertions(+), 303 deletions(-) delete mode 100644 content/base/public/nsIDOMFileException.idl delete mode 100644 dom/indexedDB/nsIIDBDatabaseException.idl diff --git a/content/base/public/Makefile.in b/content/base/public/Makefile.in index 385e79dca618..7b55d82886cc 100644 --- a/content/base/public/Makefile.in +++ b/content/base/public/Makefile.in @@ -98,7 +98,6 @@ XPIDLSRCS = \ nsIDOMFile.idl \ nsIDOMFileReader.idl \ nsIDOMFileList.idl \ - nsIDOMFileException.idl \ nsIDOMFormData.idl \ nsIDOMParser.idl \ nsIDOMSerializer.idl \ diff --git a/content/base/public/nsIDOMFileException.idl b/content/base/public/nsIDOMFileException.idl deleted file mode 100644 index 03a63b493abe..000000000000 --- a/content/base/public/nsIDOMFileException.idl +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** 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 mozilla.org code. - * - * The Initial Developer of the Original Code is - * Mozilla Corporation - * Portions created by the Initial Developer are Copyright (C) 2007 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * 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 "domstubs.idl" - -[scriptable, uuid(b52356e1-45c5-4d61-b61a-fb9bd91690e1)] -interface nsIDOMFileException : nsISupports -{ - const unsigned short NOT_FOUND_ERR = 1; - const unsigned short SECURITY_ERR = 2; - const unsigned short ABORT_ERR = 3; - const unsigned short NOT_READABLE_ERR = 4; - const unsigned short ENCODING_ERR = 5; - - readonly attribute unsigned short code; -}; diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 60b5815fea5b..8310fb50ca04 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -307,10 +307,7 @@ nsGenericDOMDataNode::SetTextInternal(PRUint32 aOffset, PRUint32 aCount, // Make sure the text fragment can hold the new data. if (aLength > aCount && !mText.CanGrowBy(aLength - aCount)) { - // This exception isn't per spec, but the spec doesn't actually - // say what to do here. - - return NS_ERROR_DOM_DOMSTRING_SIZE_ERR; + return NS_ERROR_OUT_OF_MEMORY; } nsIDocument *document = GetCurrentDoc(); diff --git a/dom/base/domerr.msg b/dom/base/domerr.msg index 10727e913200..966d500707a6 100644 --- a/dom/base/domerr.msg +++ b/dom/base/domerr.msg @@ -38,33 +38,33 @@ /* Error Message definitions. */ -/* DOM error codes 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 */ -DOM_MSG_DEF_(INDEX_SIZE_ERR, "IndexSizeError", "Index or size is negative or greater than the allowed amount") -DOM_MSG_DEF_(DOMSTRING_SIZE_ERR, "DOMStringSizeError", "The specified range of text does not fit in a DOM string") -DOM_MSG_DEF_(HIERARCHY_REQUEST_ERR, "HierarchyRequestError", "Node cannot be inserted at the specified point in the hierarchy") -DOM_MSG_DEF_(WRONG_DOCUMENT_ERR, "WrongDocumentError", "Node cannot be used in a document other than the one in which it was created") -DOM_MSG_DEF_(INVALID_CHARACTER_ERR, "InvalidCharacterError", "String contains an invalid character") -DOM_MSG_DEF_(NO_DATA_ALLOWED_ERR, "NoDataAllowedError", "Node does not contain data") -DOM_MSG_DEF_(NO_MODIFICATION_ALLOWED_ERR, "NoModificationAllowedError", "Modifications are not allowed for this document") -DOM_MSG_DEF_(NOT_FOUND_ERR, "NotFoundError", "Node was not found") -DOM_MSG_DEF_(NOT_SUPPORTED_ERR, "NotSupportedError", "Operation is not supported") -DOM_MSG_DEF_(INUSE_ATTRIBUTE_ERR, "InUseAttributeError", "Attribute already in use") -DOM_MSG_DEF_(INVALID_STATE_ERR, "InvalidStateError", "An attempt was made to use an object that is not, or is no longer, usable") -DOM_MSG_DEF_(SYNTAX_ERR, "SyntaxError", "An invalid or illegal string was specified") -DOM_MSG_DEF_(INVALID_MODIFICATION_ERR, "InvalidModificationError", "An attempt was made to modify the type of the underlying objec") -DOM_MSG_DEF_(NAMESPACE_ERR, "NamespaceError", "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces") -DOM_MSG_DEF_(INVALID_ACCESS_ERR, "InvalidAccessError", "A parameter or an operation is not supported by the underlying object") -DOM_MSG_DEF_(VALIDATION_ERR, "ValidationError", "A call to a method would make the Node invalid with respect to \"partial validity\", so the operation was not done") -DOM_MSG_DEF_(TYPE_MISMATCH_ERR, "TypeMismatchError", "The type of an object is incompatible with the expected type of the parameter associated to the object") -DOM_MSG_DEF_(SECURITY_ERR, "SecurityError", "The operation is insecure.") -DOM_MSG_DEF_(NETWORK_ERR, "NetworkError", "A network error occurred.") -DOM_MSG_DEF_(ABORT_ERR, "AbortError", "The operation was aborted. ") -DOM_MSG_DEF_(URL_MISMATCH_ERR, "URLMismatchError", "The given URL does not match another URL.") -DOM_MSG_DEF_(QUOTA_EXCEEDED_ERR, "QuotaExceededError", "The quota has been exceeded.") -DOM_MSG_DEF_(TIMEOUT_ERR, "TimeoutError", "The operation timed out.") -DOM_MSG_DEF_(INVALID_NODE_TYPE_ERR, "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation.") -DOM_MSG_DEF_(DATA_CLONE_ERR, "DataCloneError", "The object could not be cloned.") +DOM4_MSG_DEF(IndexSizeError, "Index or size is negative or greater than the allowed amount", NS_ERROR_DOM_INDEX_SIZE_ERR) +DOM4_MSG_DEF(HierarchyRequestError, "Node cannot be inserted at the specified point in the hierarchy", NS_ERROR_DOM_HIERARCHY_REQUEST_ERR) +DOM4_MSG_DEF(WrongDocumentError, "Node cannot be used in a document other than the one in which it was created", NS_ERROR_DOM_WRONG_DOCUMENT_ERR) +DOM4_MSG_DEF(InvalidCharacterError, "String contains an invalid character", NS_ERROR_DOM_INVALID_CHARACTER_ERR) +DOM4_MSG_DEF(NoModificationAllowedError, "Modifications are not allowed for this document", NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR) +DOM4_MSG_DEF(NotFoundError, "Node was not found", NS_ERROR_DOM_NOT_FOUND_ERR) +DOM4_MSG_DEF(NotSupportedError, "Operation is not supported", NS_ERROR_DOM_NOT_SUPPORTED_ERR) +DOM4_MSG_DEF(InUseAttributeError, "Attribute already in use", NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR) +DOM4_MSG_DEF(InvalidStateError, "An attempt was made to use an object that is not, or is no longer, usable", NS_ERROR_DOM_INVALID_STATE_ERR) +DOM4_MSG_DEF(SyntaxError, "An invalid or illegal string was specified", NS_ERROR_DOM_SYNTAX_ERR) +DOM4_MSG_DEF(InvalidModificationError, "An attempt was made to modify the type of the underlying objec", NS_ERROR_DOM_INVALID_MODIFICATION_ERR) +DOM4_MSG_DEF(NamespaceError, "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces", NS_ERROR_DOM_NAMESPACE_ERR) +DOM4_MSG_DEF(InvalidAccessError, "A parameter or an operation is not supported by the underlying object", NS_ERROR_DOM_INVALID_ACCESS_ERR) +DOM4_MSG_DEF(TypeMismatchError, "The type of an object is incompatible with the expected type of the parameter associated to the object", NS_ERROR_DOM_TYPE_MISMATCH_ERR) +DOM4_MSG_DEF(SecurityError, "The operation is insecure.", NS_ERROR_DOM_SECURITY_ERR) +DOM4_MSG_DEF(NetworkError, "A network error occurred.", NS_ERROR_DOM_NETWORK_ERR) +DOM4_MSG_DEF(AbortError, "The operation was aborted. ", NS_ERROR_DOM_ABORT_ERR) +DOM4_MSG_DEF(URLMismatchError, "The given URL does not match another URL.", NS_ERROR_DOM_URL_MISMATCH_ERR) +DOM4_MSG_DEF(QuotaExceededError, "The quota has been exceeded.", NS_ERROR_DOM_QUOTA_EXCEEDED_ERR) +DOM4_MSG_DEF(TimeoutError, "The operation timed out.", NS_ERROR_DOM_TIMEOUT_ERR) +DOM4_MSG_DEF(InvalidNodeTypeError, "The supplied node is incorrect or has an incorrect ancestor for this operation.", NS_ERROR_DOM_INVALID_NODE_TYPE_ERR) +DOM4_MSG_DEF(DataCloneError, "The object could not be cloned.", NS_ERROR_DOM_DATA_CLONE_ERR) + +/* XXX Should be JavaScript native TypeError */ +DOM4_MSG_DEF(TypeError, "The method parameter is missing or invalid.", NS_ERROR_TYPE_ERR) /* SVG DOM error codes from http://www.w3.org/TR/SVG11/svgdom.html */ @@ -77,23 +77,24 @@ DOM_MSG_DEF(NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE, "The matrix could not be com 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.") -/* IndexedDB error codes http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html */ +/* IndexedDB errors http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#exceptions */ -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, "The operation failed for reasons unrelated to the database itself and not covered by any other error code.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR, "This error occurred because an operation was not allowed on an object. A retry of the same operation would fail unless the cause of the error is corrected.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR, "The operation failed because the requested database object could not be found. For example, an object store did not exist but was being opened.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR, "A mutation operation in the transaction failed because a constraint was not satisfied. For example, an object such as an object store or index already exists and a new one was being attempted to be created.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_DATA_ERR, "Data provided to an operation does not meet requirements.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR, "A mutation operation was attempted on a database that did not allow mutations.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR, "A request was placed against a transaction which is currently not active, or which is finished.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_ABORT_ERR, "A request was aborted, for example through a call to IDBTransaction.abort.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR, "A mutation operation was attempted in a READ_ONLY transaction.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_TIMEOUT_ERR, "A lock for the transaction could not be obtained in a reasonable time.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR, "The current transaction exceeded its quota limitations.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_VERSION_ERR, "The operation failed because the stored database is a higher version than the version requested.") +DOM4_MSG_DEF(UnknownError, "The operation failed for reasons unrelated to the database itself and not covered by any other error code.", NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR) +DOM4_MSG_DEF(ConstraintError, "A mutation operation in the transaction failed because a constraint was not satisfied. For example, an object such as an object store or index already exists and a new one was being attempted to be created.", NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR) +DOM4_MSG_DEF(DataError, "Data provided to an operation does not meet requirements.", NS_ERROR_DOM_INDEXEDDB_DATA_ERR) +DOM4_MSG_DEF(TransactionInactiveError, "A request was placed against a transaction which is currently not active, or which is finished.", NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR) +DOM4_MSG_DEF(ReadOnlyError, "A mutation operation was attempted in a READ_ONLY transaction.", NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR) +DOM4_MSG_DEF(VersionError, "The operation failed because the stored database is a higher version than the version requested.", NS_ERROR_DOM_INDEXEDDB_VERSION_ERR) + +DOM4_MSG_DEF(NotFoundError, "The operation failed because the requested database object could not be found. For example, an object store did not exist but was being opened.", NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR) +DOM4_MSG_DEF(InvalidStateError, "A mutation operation was attempted on a database that did not allow mutations.", NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR) +DOM4_MSG_DEF(AbortError, "A request was aborted, for example through a call to IDBTransaction.abort.", NS_ERROR_DOM_INDEXEDDB_ABORT_ERR) +DOM4_MSG_DEF(TimeoutError, "A lock for the transaction could not be obtained in a reasonable time.", NS_ERROR_DOM_INDEXEDDB_TIMEOUT_ERR) +DOM4_MSG_DEF(QuotaExceededError, "The current transaction exceeded its quota limitations.", NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR) + +/* A Non-standard IndexedDB error */ DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_RECOVERABLE_ERR, "The operation failed because the database was prevented from taking an action. The operation might be able to succeed if the application performs some recovery steps and retries the entire transaction. For example, there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database.") -DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_DEADLOCK_ERR, "The current transaction was automatically rolled back by the database because of deadlock or other transaction serialization failures.") /* DOM error codes defined by us */ @@ -113,8 +114,8 @@ DOM_MSG_DEF(NS_ERROR_DOM_BAD_URI, "Access to restricted URI denied") DOM_MSG_DEF(NS_ERROR_DOM_RETVAL_UNDEFINED, "Return value is undefined") DOM_MSG_DEF(NS_ERROR_DOM_QUOTA_REACHED, "Persistent storage maximum size reached") -DOM_MSG_DEF(NS_ERROR_DOM_FILE_NOT_FOUND_ERR, "File was not found") -DOM_MSG_DEF(NS_ERROR_DOM_FILE_NOT_READABLE_ERR, "File could not be read") +DOM4_MSG_DEF(NotFoundError, "File was not found", NS_ERROR_DOM_FILE_NOT_FOUND_ERR) +DOM4_MSG_DEF(NotReadableError, "File could not be read", NS_ERROR_DOM_FILE_NOT_READABLE_ERR) /* common global codes (from nsError.h) */ diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 1f18cbf6d82e..3472c751fa58 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -455,7 +455,6 @@ #include "nsDOMFile.h" #include "nsDOMFileReader.h" -#include "nsIDOMFileException.h" #include "nsIDOMFormData.h" #include "nsIDOMDOMStringMap.h" @@ -495,7 +494,6 @@ #include "mozilla/dom/indexedDB/IDBCursor.h" #include "mozilla/dom/indexedDB/IDBKeyRange.h" #include "mozilla/dom/indexedDB/IDBIndex.h" -#include "nsIIDBDatabaseException.h" using mozilla::dom::indexedDB::IDBWrapperCache; @@ -1398,8 +1396,6 @@ static nsDOMClassInfoData sClassInfoData[] = { DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(File, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(FileException, nsDOMGenericSH, - DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(FileReader, nsEventTargetSH, EVENTTARGET_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(MozURLProperty, nsDOMGenericSH, @@ -1597,8 +1593,6 @@ static nsDOMClassInfoData sClassInfoData[] = { DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(IDBOpenDBRequest, IDBEventTargetSH, IDBEVENTTARGET_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(IDBDatabaseException, nsDOMGenericSH, - DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(Touch, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) @@ -3997,11 +3991,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMFile) DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(FileException, nsIDOMFileException) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMFileException) - DOM_CLASSINFO_MAP_ENTRY(nsIException) - DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(FileReader, nsIDOMFileReader) DOM_CLASSINFO_MAP_ENTRY(nsIDOMFileReader) DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) @@ -4337,11 +4326,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(IDBDatabaseException, nsIIDBDatabaseException) - DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabaseException) - DOM_CLASSINFO_MAP_ENTRY(nsIException) - DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(Touch, nsIDOMTouch, !nsDOMTouchEvent::PrefEnabled()) DOM_CLASSINFO_MAP_ENTRY(nsIDOMTouch) diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index dac5385a5002..ceac27ae5bcf 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -401,7 +401,6 @@ DOMCI_CLASS(OfflineResourceList) DOMCI_CLASS(FileList) DOMCI_CLASS(Blob) DOMCI_CLASS(File) -DOMCI_CLASS(FileException) DOMCI_CLASS(FileReader) DOMCI_CLASS(MozURLProperty) DOMCI_CLASS(MozBlobBuilder) @@ -520,7 +519,6 @@ DOMCI_CLASS(IDBKeyRange) DOMCI_CLASS(IDBIndex) DOMCI_CLASS(IDBVersionChangeEvent) DOMCI_CLASS(IDBOpenDBRequest) -DOMCI_CLASS(IDBDatabaseException) DOMCI_CLASS(Touch) DOMCI_CLASS(TouchList) diff --git a/dom/base/nsDOMError.h b/dom/base/nsDOMError.h index c2018359a303..8443f4aef839 100644 --- a/dom/base/nsDOMError.h +++ b/dom/base/nsDOMError.h @@ -46,11 +46,9 @@ /* Standard DOM error codes: http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html */ #define NS_ERROR_DOM_INDEX_SIZE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,1) -#define NS_ERROR_DOM_DOMSTRING_SIZE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,2) #define NS_ERROR_DOM_HIERARCHY_REQUEST_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,3) #define NS_ERROR_DOM_WRONG_DOCUMENT_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,4) #define NS_ERROR_DOM_INVALID_CHARACTER_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,5) -#define NS_ERROR_DOM_NO_DATA_ALLOWED_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,6) #define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,7) #define NS_ERROR_DOM_NOT_FOUND_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,8) #define NS_ERROR_DOM_NOT_SUPPORTED_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,9) @@ -60,7 +58,6 @@ #define NS_ERROR_DOM_INVALID_MODIFICATION_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,13) #define NS_ERROR_DOM_NAMESPACE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,14) #define NS_ERROR_DOM_INVALID_ACCESS_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,15) -#define NS_ERROR_DOM_VALIDATION_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,16) #define NS_ERROR_DOM_TYPE_MISMATCH_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,17) #define NS_ERROR_DOM_SECURITY_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,18) #define NS_ERROR_DOM_NETWORK_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,19) @@ -71,6 +68,10 @@ #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) +/* XXX Should be JavaScript native TypeError */ + +#define NS_ERROR_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,26) + /* 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) @@ -85,7 +86,6 @@ /* IndexedDB error codes http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html */ #define NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,1) -#define NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,2) #define NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,3) #define NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,4) #define NS_ERROR_DOM_INDEXEDDB_DATA_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,5) @@ -99,7 +99,6 @@ #define NS_ERROR_DOM_INDEXEDDB_VERSION_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,12) #define NS_ERROR_DOM_INDEXEDDB_RECOVERABLE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,1001) -#define NS_ERROR_DOM_INDEXEDDB_DEADLOCK_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_INDEXEDDB,1002) /* DOM error codes defined by us */ diff --git a/dom/base/nsDOMException.cpp b/dom/base/nsDOMException.cpp index 742f5200c39f..4f1f44b22d22 100644 --- a/dom/base/nsDOMException.cpp +++ b/dom/base/nsDOMException.cpp @@ -42,87 +42,126 @@ #include "nsDOMError.h" #include "nsDOMException.h" #include "nsIDOMDOMException.h" -#include "nsIDOMFileException.h" #include "nsIDOMSVGException.h" #include "nsIDOMXPathException.h" -#include "nsIIDBDatabaseException.h" #include "nsString.h" #include "prprf.h" -#define DOM_MSG_DEF(val, message) {(val), #val, message}, -#define DOM_MSG_DEF_(val, name, message) {(NS_ERROR_DOM_##val), name, message}, - -#define IMPL_INTERNAL_DOM_EXCEPTION_HEAD(classname, ifname) \ -class classname : public nsBaseDOMException, \ - public ifname \ +#define IMPL_INTERNAL_DOM_EXCEPTION_HEAD(domname) \ +class ns##domname : public nsBaseDOMException, \ + public nsIDOM##domname \ { \ public: \ - classname(); \ - virtual ~classname(); \ + ns##domname(); \ + virtual ~ns##domname(); \ \ NS_DECL_ISUPPORTS_INHERITED -#define IMPL_INTERNAL_DOM_EXCEPTION_TAIL(classname, ifname, domname, module, \ - mapping_function) \ +#define IMPL_INTERNAL_DOM_EXCEPTION_TAIL(domname) \ }; \ \ -classname::classname() {} \ -classname::~classname() {} \ +ns##domname::ns##domname() {} \ +ns##domname::~ns##domname() {} \ \ -DOMCI_DATA(domname, classname) \ +DOMCI_DATA(domname, ns##domname) \ \ -NS_IMPL_ADDREF_INHERITED(classname, nsBaseDOMException) \ -NS_IMPL_RELEASE_INHERITED(classname, nsBaseDOMException) \ -NS_INTERFACE_MAP_BEGIN(classname) \ - NS_INTERFACE_MAP_ENTRY(ifname) \ +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) \ + 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); \ - classname* inst = new classname(); \ + 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, aDefaultException); \ + inst->Init(aNSResult, name, message, code, aDefaultException); \ *aException = inst; \ NS_ADDREF(*aException); \ return NS_OK; \ } +enum DOM4ErrorTypeCodeMap { + /* DOM4 errors from http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#domexception */ + IndexSizeError = nsIDOMDOMException::INDEX_SIZE_ERR, + HierarchyRequestError = nsIDOMDOMException::HIERARCHY_REQUEST_ERR, + WrongDocumentError = nsIDOMDOMException::WRONG_DOCUMENT_ERR, + InvalidCharacterError = nsIDOMDOMException::INVALID_CHARACTER_ERR, + NoModificationAllowedError = nsIDOMDOMException::NO_MODIFICATION_ALLOWED_ERR, + NotFoundError = nsIDOMDOMException::NOT_FOUND_ERR, + NotSupportedError = nsIDOMDOMException::NOT_SUPPORTED_ERR, + // Can't remove until setNamedItem is removed + InUseAttributeError = nsIDOMDOMException::INUSE_ATTRIBUTE_ERR, + InvalidStateError = nsIDOMDOMException::INVALID_STATE_ERR, + SyntaxError = nsIDOMDOMException::SYNTAX_ERR, + InvalidModificationError = nsIDOMDOMException::INVALID_MODIFICATION_ERR, + NamespaceError = nsIDOMDOMException::NAMESPACE_ERR, + InvalidAccessError = nsIDOMDOMException::INVALID_ACCESS_ERR, + TypeMismatchError = nsIDOMDOMException::TYPE_MISMATCH_ERR, + SecurityError = nsIDOMDOMException::SECURITY_ERR, + NetworkError = nsIDOMDOMException::NETWORK_ERR, + AbortError = nsIDOMDOMException::ABORT_ERR, + URLMismatchError = nsIDOMDOMException::URL_MISMATCH_ERR, + QuotaExceededError = nsIDOMDOMException::QUOTA_EXCEEDED_ERR, + TimeoutError = nsIDOMDOMException::TIMEOUT_ERR, + InvalidNodeTypeError = nsIDOMDOMException::INVALID_NODE_TYPE_ERR, + DataCloneError = nsIDOMDOMException::DATA_CLONE_ERR, + + /* XXX Should be JavaScript native TypeError */ + TypeError = 0, + + /* IndexedDB errors http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#exceptions */ + UnknownError = 0, + ConstraintError = 0, + DataError = 0, + TransactionInactiveError = 0, + ReadOnlyError = 0, + VersionError = 0, + + /* File API errors http://dev.w3.org/2006/webapi/FileAPI/#ErrorAndException */ + NotReadableError = 0, +}; + +#define DOM4_MSG_DEF(name, message, nsresult) {(nsresult), name, #name, message}, +#define DOM_MSG_DEF(val, message) {(val), NS_ERROR_GET_CODE(val), #val, message}, + static struct ResultStruct { nsresult mNSResult; + PRUint16 mCode; const char* mName; const char* mMessage; } gDOMErrorMsgMap[] = { #include "domerr.msg" - {0, nsnull, nsnull} // sentinel to mark end of array + {0, 0, nsnull, nsnull} // sentinel to mark end of array }; +#undef DOM4_MSG_DEF #undef DOM_MSG_DEF -#undef DOM_MSG_DEF_ static void NSResultToNameAndMessage(nsresult aNSResult, const char** aName, - const char** aMessage) + const char** aMessage, + PRUint16* aCode) { *aName = nsnull; *aMessage = nsnull; + *aCode = 0; ResultStruct* result_struct = gDOMErrorMsgMap; while (result_struct->mName) { if (aNSResult == result_struct->mNSResult) { *aName = result_struct->mName; *aMessage = result_struct->mMessage; + *aCode = result_struct->mCode; return; } @@ -140,7 +179,8 @@ NS_GetNameAndMessageForDOMNSResult(nsresult aNSResult, const char** aName, { const char* name = nsnull; const char* message = nsnull; - NSResultToNameAndMessage(aNSResult, &name, &message); + PRUint16 code = 0; + NSResultToNameAndMessage(aNSResult, &name, &message, &code); if (name && message) { *aName = name; @@ -151,93 +191,45 @@ NS_GetNameAndMessageForDOMNSResult(nsresult aNSResult, const char** aName, return NS_ERROR_NOT_AVAILABLE; } -IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsDOMException, nsIDOMDOMException) +IMPL_INTERNAL_DOM_EXCEPTION_HEAD(DOMException) NS_DECL_NSIDOMDOMEXCEPTION -IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsDOMException, nsIDOMDOMException, - DOMException, NS_ERROR_MODULE_DOM, - NSResultToNameAndMessage) +IMPL_INTERNAL_DOM_EXCEPTION_TAIL(DOMException) NS_IMETHODIMP nsDOMException::GetCode(PRUint16* aCode) { NS_ENSURE_ARG_POINTER(aCode); - nsresult result; - GetResult(&result); - *aCode = NS_ERROR_GET_CODE(result); + *aCode = mCode; return NS_OK; } -IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsSVGException, nsIDOMSVGException) +IMPL_INTERNAL_DOM_EXCEPTION_HEAD(SVGException) NS_DECL_NSIDOMSVGEXCEPTION -IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsSVGException, nsIDOMSVGException, - SVGException, NS_ERROR_MODULE_SVG, - NSResultToNameAndMessage) +IMPL_INTERNAL_DOM_EXCEPTION_TAIL(SVGException) NS_IMETHODIMP nsSVGException::GetCode(PRUint16* aCode) { NS_ENSURE_ARG_POINTER(aCode); - nsresult result; - GetResult(&result); - *aCode = NS_ERROR_GET_CODE(result); + *aCode = mCode; return NS_OK; } -IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsXPathException, nsIDOMXPathException) +IMPL_INTERNAL_DOM_EXCEPTION_HEAD(XPathException) NS_DECL_NSIDOMXPATHEXCEPTION -IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsXPathException, nsIDOMXPathException, - XPathException, NS_ERROR_MODULE_DOM_XPATH, - NSResultToNameAndMessage) +IMPL_INTERNAL_DOM_EXCEPTION_TAIL(XPathException) NS_IMETHODIMP nsXPathException::GetCode(PRUint16* aCode) { NS_ENSURE_ARG_POINTER(aCode); - nsresult result; - GetResult(&result); - *aCode = NS_ERROR_GET_CODE(result); + *aCode = mCode; return NS_OK; } -IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsDOMFileException, nsIDOMFileException) - NS_DECL_NSIDOMFILEEXCEPTION -IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsDOMFileException, nsIDOMFileException, - FileException, NS_ERROR_MODULE_DOM_FILE, - NSResultToNameAndMessage) - -NS_IMETHODIMP -nsDOMFileException::GetCode(PRUint16* aCode) -{ - NS_ENSURE_ARG_POINTER(aCode); - nsresult result; - GetResult(&result); - *aCode = NS_ERROR_GET_CODE(result); - - return NS_OK; -} - -IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsIDBDatabaseException, - nsIIDBDatabaseException) - NS_DECL_NSIIDBDATABASEEXCEPTION -IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsIDBDatabaseException, - nsIIDBDatabaseException, - IDBDatabaseException, - NS_ERROR_MODULE_DOM_INDEXEDDB, - NSResultToNameAndMessage) - -NS_IMETHODIMP -nsIDBDatabaseException::GetCode(PRUint16* aCode) -{ - NS_ASSERTION(aCode, "Null pointer!"); - nsresult result; - GetResult(&result); - *aCode = NS_ERROR_GET_CODE(result); - return NS_OK; -} - nsBaseDOMException::nsBaseDOMException() { } @@ -401,9 +393,8 @@ nsBaseDOMException::ToString(char **aReturn) const char* msg = mMessage ? mMessage : defaultMsg; const char* resultName = mName ? mName : defaultName; - PRUint32 code = NS_ERROR_GET_CODE(mResult); - *aReturn = PR_smprintf(format, msg, code, mResult, resultName, + *aReturn = PR_smprintf(format, msg, mCode, mResult, resultName, location.get()); return *aReturn ? NS_OK : NS_ERROR_OUT_OF_MEMORY; @@ -411,12 +402,13 @@ nsBaseDOMException::ToString(char **aReturn) NS_IMETHODIMP nsBaseDOMException::Init(nsresult aNSResult, const char* aName, - const char* aMessage, + const char* aMessage, PRUint16 aCode, nsIException* aDefaultException) { mResult = aNSResult; mName = aName; mMessage = aMessage; + mCode = aCode; mInner = aDefaultException; return NS_OK; } diff --git a/dom/base/nsDOMException.h b/dom/base/nsDOMException.h index a1d376b3c415..677925d254ef 100644 --- a/dom/base/nsDOMException.h +++ b/dom/base/nsDOMException.h @@ -51,13 +51,14 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIEXCEPTION NS_IMETHOD Init(nsresult aNSResult, const char* aName, - const char* aMessage, + const char* aMessage, PRUint16 aCode, nsIException* aDefaultException); protected: nsresult mResult; const char* mName; const char* mMessage; + PRUint16 mCode; \ nsCOMPtr mInner; }; @@ -74,5 +75,3 @@ NS_New##domname(nsresult aNSResult, nsIException* aDefaultException, \ DECL_INTERNAL_DOM_EXCEPTION(DOMException) DECL_INTERNAL_DOM_EXCEPTION(SVGException) DECL_INTERNAL_DOM_EXCEPTION(XPathException) -DECL_INTERNAL_DOM_EXCEPTION(FileException) -DECL_INTERNAL_DOM_EXCEPTION(IDBDatabaseException) diff --git a/dom/base/nsDOMScriptObjectFactory.cpp b/dom/base/nsDOMScriptObjectFactory.cpp index a14af6b3160e..e48575a18dc9 100644 --- a/dom/base/nsDOMScriptObjectFactory.cpp +++ b/dom/base/nsDOMScriptObjectFactory.cpp @@ -388,11 +388,11 @@ nsDOMExceptionProvider::GetException(nsresult result, return NS_NewXPathException(result, aDefaultException, _retval); case NS_ERROR_MODULE_XPCONNECT: return CreateXPConnectException(result, aDefaultException, _retval); - case NS_ERROR_MODULE_DOM_FILE: - return NS_NewFileException(result, aDefaultException, _retval); - case NS_ERROR_MODULE_DOM_INDEXEDDB: - return NS_NewIDBDatabaseException(result, aDefaultException, _retval); 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, + "Trying to create an exception for the wrong error module."); return NS_NewDOMException(result, aDefaultException, _retval); } NS_NOTREACHED("Not reached"); diff --git a/dom/base/nsIBaseDOMException.h b/dom/base/nsIBaseDOMException.h index 99b87a6110f6..9db6ddf7d74a 100644 --- a/dom/base/nsIBaseDOMException.h +++ b/dom/base/nsIBaseDOMException.h @@ -49,15 +49,15 @@ // {731d9701-39f8-11d6-a7f2-b39073384c9c} #define NS_IBASEDOMEXCEPTION_IID \ -{ 0x731d9701, 0x39f8, 0x11d6, \ -{ 0xa7, 0xf2, 0xb3, 0x90, 0x73, 0x38, 0x4c, 0x9c } } +{ 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, + const char* aMessage, PRUint16 aCode, nsIException* aDefaultException) = 0; }; diff --git a/dom/contacts/fallback/ContactDB.jsm b/dom/contacts/fallback/ContactDB.jsm index c38afd1192c2..5652e9c68f93 100644 --- a/dom/contacts/fallback/ContactDB.jsm +++ b/dom/contacts/fallback/ContactDB.jsm @@ -153,24 +153,24 @@ ContactDB.prototype = { }; txn.onabort = function (event) { - debug("Caught error on transaction" + event.target.errorCode); - switch(event.target.errorCode) { - case Ci.nsIIDBDatabaseException.ABORT_ERR: - case Ci.nsIIDBDatabaseException.CONSTRAINT_ERR: - case Ci.nsIIDBDatabaseException.DATA_ERR: - case Ci.nsIIDBDatabaseException.TRANSIENT_ERR: - case Ci.nsIIDBDatabaseException.NOT_ALLOWED_ERR: - case Ci.nsIIDBDatabaseException.NOT_FOUND_ERR: - case Ci.nsIIDBDatabaseException.QUOTA_ERR: - case Ci.nsIIDBDatabaseException.READ_ONLY_ERR: - case Ci.nsIIDBDatabaseException.TIMEOUT_ERR: - case Ci.nsIIDBDatabaseException.TRANSACTION_INACTIVE_ERR: - case Ci.nsIIDBDatabaseException.VERSION_ERR: - case Ci.nsIIDBDatabaseException.UNKNOWN_ERR: + debug("Caught error on transaction" + event.target.error.name); + switch(event.target.error.name) { + case "AbortError": + case "ConstraintError": + case "DataError": + case "SyntaxError": + case "InvalidStateError": + case "NotFoundError": + case "QuotaExceededError": + case "ReadOnlyError": + case "TimeoutError": + case "TransactionInactiveError": + case "VersionError": + case "UnknownError": failureCb("UnknownError"); break; default: - debug("Unknown errorCode", event.target.errorCode); + debug("Unknown error", event.target.error.name); failureCb("UnknownError"); break; } diff --git a/dom/indexedDB/IDBCursor.cpp b/dom/indexedDB/IDBCursor.cpp index 56865fa8cf7a..678f379bdf2a 100644 --- a/dom/indexedDB/IDBCursor.cpp +++ b/dom/indexedDB/IDBCursor.cpp @@ -259,7 +259,7 @@ IDBCursor::ParseDirection(const nsAString& aDirection, Direction* aResult) *aResult = PREV_UNIQUE; } else { - return NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR; + return NS_ERROR_TYPE_ERR; } return NS_OK; @@ -720,7 +720,7 @@ IDBCursor::Advance(PRInt32 aCount) NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); if (aCount < 1) { - return NS_ERROR_DOM_TYPE_ERR; + return NS_ERROR_TYPE_ERR; } Key key; diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index ffd0b5109a6f..3dbcb9816345 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -553,7 +553,7 @@ IDBDatabase::Transaction(const jsval& aStoreNames, transactionMode = IDBTransaction::READ_WRITE; } else if (!aMode.EqualsLiteral("readonly")) { - return NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR; + return NS_ERROR_TYPE_ERR; } } diff --git a/dom/indexedDB/IDBEvents.cpp b/dom/indexedDB/IDBEvents.cpp index 26a458e84628..665f79e4bd2b 100644 --- a/dom/indexedDB/IDBEvents.cpp +++ b/dom/indexedDB/IDBEvents.cpp @@ -39,7 +39,6 @@ #include "IDBEvents.h" -#include "nsIIDBDatabaseException.h" #include "nsIPrivateDOMEvent.h" #include "nsContentUtils.h" diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 46b2458d95c6..f1436d6a7a2f 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -512,7 +512,7 @@ IDBFactory::Open(const nsAString& aName, nsIIDBOpenDBRequest** _retval) { if (aVersion < 1 && aArgc) { - return NS_ERROR_DOM_INDEXEDDB_NON_TRANSIENT_ERR; + return NS_ERROR_TYPE_ERR; } return OpenCommon(aName, aVersion, false, _retval); diff --git a/dom/indexedDB/Makefile.in b/dom/indexedDB/Makefile.in index 3cc2117aaceb..a62f85235fdb 100644 --- a/dom/indexedDB/Makefile.in +++ b/dom/indexedDB/Makefile.in @@ -109,7 +109,6 @@ XPIDLSRCS = \ nsIIDBCursor.idl \ nsIIDBCursorWithValue.idl \ nsIIDBDatabase.idl \ - nsIIDBDatabaseException.idl \ nsIIDBFactory.idl \ nsIIDBIndex.idl \ nsIIDBKeyRange.idl \ diff --git a/dom/indexedDB/nsIIDBDatabaseException.idl b/dom/indexedDB/nsIIDBDatabaseException.idl deleted file mode 100644 index 5e633fad8d8b..000000000000 --- a/dom/indexedDB/nsIIDBDatabaseException.idl +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* ***** 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 Indexed Database. - * - * The Initial Developer of the Original Code is - * The Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Ben Turner - * - * 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 "nsISupports.idl" - -[scriptable, builtinclass, uuid(7aad2542-a5cb-4a57-b20c-c7d16b8582ab)] -interface nsIIDBDatabaseException : nsISupports -{ - // const unsigned short NO_ERR = 0; - const unsigned short UNKNOWN_ERR = 1; - const unsigned short NON_TRANSIENT_ERR = 2; - const unsigned short NOT_FOUND_ERR = 3; - const unsigned short CONSTRAINT_ERR = 4; - const unsigned short DATA_ERR = 5; - const unsigned short NOT_ALLOWED_ERR = 6; - const unsigned short TRANSACTION_INACTIVE_ERR = 7; - const unsigned short ABORT_ERR = 8; - const unsigned short READ_ONLY_ERR = 9; - const unsigned short TIMEOUT_ERR = 10; - const unsigned short QUOTA_ERR = 11; - const unsigned short VERSION_ERR = 12; - - readonly attribute unsigned short code; -}; diff --git a/js/xpconnect/src/dom_quickstubs.qsconf b/js/xpconnect/src/dom_quickstubs.qsconf index 6b68691986e0..deb079df57e1 100644 --- a/js/xpconnect/src/dom_quickstubs.qsconf +++ b/js/xpconnect/src/dom_quickstubs.qsconf @@ -457,7 +457,6 @@ members = [ 'nsIIDBCursor.*', 'nsIIDBCursorWithValue.*', 'nsIIDBDatabase.*', - 'nsIIDBDatabaseException.*', 'nsIIDBIndex.*', 'nsIIDBKeyRange.*', 'nsIIDBObjectStore.*',