Bug 726933 - Add a deprecation warning to getPreventDefault. r=smaug
💩💩 backed out by f3afa7937265 💩 💩
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 25 May 2013 07:55:20 +0900
changeset 132938 db13e1fbc642
parent 132937 5d8193c572ec
child 132939 ebb7f64f278e
push id28528
push userVYV03354@nifty.ne.jp
push date2013-05-24 22:57 +0000
treeherdermozilla-inbound@db13e1fbc642 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs726933
milestone24.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 726933 - Add a deprecation warning to getPreventDefault. r=smaug
content/base/public/nsDeprecatedOperationList.h
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMEvent.h
dom/locales/en-US/chrome/dom/dom.properties
--- a/content/base/public/nsDeprecatedOperationList.h
+++ b/content/base/public/nsDeprecatedOperationList.h
@@ -25,8 +25,9 @@ DEPRECATED_OPERATION(DOMExceptionCode)
 DEPRECATED_OPERATION(NoExposedProps)
 DEPRECATED_OPERATION(MutationEvent)
 DEPRECATED_OPERATION(MozSlice)
 DEPRECATED_OPERATION(Components)
 DEPRECATED_OPERATION(PrefixedVisibilityAPI)
 DEPRECATED_OPERATION(NodeIteratorDetach)
 DEPRECATED_OPERATION(MozAudioData)
 DEPRECATED_OPERATION(LenientThis)
+DEPRECATED_OPERATION(GetPreventDefault)
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -1215,16 +1215,27 @@ const char* nsDOMEvent::GetEventName(uin
   // XXXldb We can hit this case for nsEvent objects that we didn't
   // create and that are not user defined events since this function and
   // SetEventType are incomplete.  (But fixing that requires fixing the
   // arrays in nsEventListenerManager too, since the events for which
   // this is a problem generally *are* created by nsDOMEvent.)
   return nullptr;
 }
 
+bool
+nsDOMEvent::GetPreventDefault() const
+{
+  if (mOwner) {
+    if (nsIDocument* doc = mOwner->GetExtantDoc()) {
+      doc->WarnOnceAbout(nsIDocument::eGetPreventDefault);
+    }
+  }
+  return DefaultPrevented();
+}
+
 NS_IMETHODIMP
 nsDOMEvent::GetPreventDefault(bool* aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   *aReturn = GetPreventDefault();
   return NS_OK;
 }
 
--- a/content/events/src/nsDOMEvent.h
+++ b/content/events/src/nsDOMEvent.h
@@ -184,20 +184,17 @@ public:
                  mozilla::ErrorResult& aRv)
   {
     aRv = InitEvent(aType, aBubbles, aCancelable);
   }
 
   mozilla::dom::EventTarget* GetOriginalTarget() const;
   mozilla::dom::EventTarget* GetExplicitOriginalTarget() const;
 
-  bool GetPreventDefault() const
-  {
-    return DefaultPrevented();
-  }
+  bool GetPreventDefault() const;
 
 protected:
 
   // Internal helper functions
   void SetEventType(const nsAString& aEventTypeArg);
   already_AddRefed<nsIContent> GetTargetFromFrame();
 
   nsEvent*                    mEvent;
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -125,8 +125,10 @@ PrefixedVisibilityApiWarning='mozHidden'
 # LOCALIZATION NOTE: Do not translate "NodeIterator" or "detach()".
 NodeIteratorDetachWarning=Calling detach() on a NodeIterator no longer has an effect.
 # LOCALIZATION NOTE: Do not translate "Mozilla Audio Data API" and "Web Audio API".
 MozAudioDataWarning=The Mozilla Audio Data API is deprecated.  Please use the Web Audio API instead.
 # LOCALIZATION NOTE: Do not translate "LenientThis" and "this"
 LenientThisWarning=Ignoring get or set of property that has [LenientThis] because the "this" object is incorrect.
 # LOCALIZATION NOTE: Do not translate "nsIDOMWindowUtils", "getWindowWithOuterId", or "nsIWindowMediator"
 GetWindowWithOuterIdWarning=Use of nsIDOMWindowUtils.getOuterWindowWithId() is deprecated.  Instead, use the nsIWindowMediator method of the same name.
+# LOCALIZATION NOTE: Do not translate "getPreventDefault" or "defaultPrevented".
+GetPreventDefaultWarning=Use of getPreventDefault() is deprecated.  Use defaultPrevented instead.