Bug 743574 - Deprecate DOMException.code. r=sicking
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Wed, 11 Apr 2012 17:55:23 -0400
changeset 91472 4b667b134bc7c48d4e6e51618215045b72c5aa96
parent 91471 9dbeef29e1cf3a87c0a42585465f9fe5fc879c4d
child 91473 4058f038e97f22c04cae6e0546d9ff1fc704079c
push id22445
push usereakhgari@mozilla.com
push dateThu, 12 Apr 2012 16:19:55 +0000
treeherdermozilla-central@901dfde60183 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs743574
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 743574 - Deprecate DOMException.code. r=sicking
content/base/public/nsDeprecatedOperationList.h
dom/base/nsDOMException.cpp
dom/locales/en-US/chrome/dom/dom.properties
--- a/content/base/public/nsDeprecatedOperationList.h
+++ b/content/base/public/nsDeprecatedOperationList.h
@@ -71,8 +71,9 @@ DEPRECATED_OPERATION(IsSupported)
 DEPRECATED_OPERATION(IsEqualNode)
 DEPRECATED_OPERATION(TextContent)
 DEPRECATED_OPERATION(EnablePrivilege)
 DEPRECATED_OPERATION(Position)
 DEPRECATED_OPERATION(TotalSize)
 DEPRECATED_OPERATION(InputEncoding)
 DEPRECATED_OPERATION(MozBeforePaint)
 DEPRECATED_OPERATION(MozBlobBuilder)
+DEPRECATED_OPERATION(DOMExceptionCode)
--- a/dom/base/nsDOMException.cpp
+++ b/dom/base/nsDOMException.cpp
@@ -33,22 +33,24 @@
  * 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 "nsCOMPtr.h"
 #include "nsCRTGlue.h"
+#include "nsContentUtils.h"
 #include "nsDOMClassInfoID.h"
 #include "nsDOMError.h"
 #include "nsDOMException.h"
 #include "nsIDOMDOMException.h"
 #include "nsIDOMSVGException.h"
 #include "nsIDOMXPathException.h"
+#include "nsIDocument.h"
 #include "nsString.h"
 #include "prprf.h"
 
 #define IMPL_INTERNAL_DOM_EXCEPTION_HEAD(domname)                            \
 class ns##domname : public nsBaseDOMException,                               \
                     public nsIDOM##domname                                   \
 {                                                                            \
 public:                                                                      \
@@ -196,16 +198,28 @@ IMPL_INTERNAL_DOM_EXCEPTION_HEAD(DOMExce
 IMPL_INTERNAL_DOM_EXCEPTION_TAIL(DOMException)
 
 NS_IMETHODIMP
 nsDOMException::GetCode(PRUint16* aCode)
 {
   NS_ENSURE_ARG_POINTER(aCode);
   *aCode = mCode;
 
+  // Warn only when the code was changed (IndexedDB or File API)
+  // or the code is useless (zero)
+  if (NS_ERROR_GET_MODULE(mResult) == NS_ERROR_MODULE_DOM_INDEXEDDB ||
+      NS_ERROR_GET_MODULE(mResult) == NS_ERROR_MODULE_DOM_FILE ||
+      !mCode) {
+    nsCOMPtr<nsIDocument> doc =
+      do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
+    if (doc) {
+      doc->WarnOnceAbout(nsIDocument::eDOMExceptionCode);
+    }
+  }
+
   return NS_OK;
 }
 
 IMPL_INTERNAL_DOM_EXCEPTION_HEAD(SVGException)
   NS_DECL_NSIDOMSVGEXCEPTION
 IMPL_INTERNAL_DOM_EXCEPTION_TAIL(SVGException)
 
 NS_IMETHODIMP
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -145,8 +145,10 @@ MediaLoadInvalidURI=Invalid URI. Load of
 # LOCALIZATION NOTE: %1$S is the media resource's format/codec type (basically equivalent to the file type, e.g. MP4,AVI,WMV,MOV etc), %2$S is the URL of the media resource which failed to load.
 MediaLoadUnsupportedType=Specified "type" of "%1$S" is not supported. Load of media resource %2$S failed.
 # LOCALIZATION NOTE: %1$S is the MIME type HTTP header being sent by the web server, %2$S is the URL of the media resource which failed to load.
 MediaLoadUnsupportedMimeType=HTTP "Content-Type" of "%1$S" is not supported. Load of media resource %2$S failed.
 # LOCALIZATION NOTE: %S is the URL of the media resource which failed to load because of error in decoding.
 MediaLoadDecodeError=Media resource %S could not be decoded.
 # LOCALIZATION NOTE: Do not translate "MozBlobBuilder" and "Blob"
 MozBlobBuilderWarning=Use of MozBlobBuilder is deprecated. Use Blob constructor instead.
+# LOCALIZATION NOTE: Do not translate "DOMException", "code" and "name"
+DOMExceptionCodeWarning=Use of DOMException's code attribute is deprecated. Use name instead.