Bug 1435666 - Part 2: Remove nsIDOMTimeEvent. r=bz draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 05 Feb 2018 10:31:43 +0800
changeset 751957 328f48d0fb3b30704df99942d568eaa7d870ccc2
parent 751956 609c669c3db17a5167c733ced61ee678eff9344c
child 751958 07b5e02160708671cb9cf707938e97fb97c783d2
push id98105
push userbmo:cam@mcc.id.au
push dateWed, 07 Feb 2018 07:54:04 +0000
reviewersbz
bugs1435666
milestone60.0a1
Bug 1435666 - Part 2: Remove nsIDOMTimeEvent. r=bz MozReview-Commit-ID: F2fYWhUKzyp
browser/installer/package-manifest.in
dom/events/Event.h
dom/interfaces/smil/moz.build
dom/interfaces/smil/nsIDOMTimeEvent.idl
dom/moz.build
dom/smil/TimeEvent.cpp
dom/smil/TimeEvent.h
dom/smil/nsSMILTimeValueSpec.cpp
mobile/android/installer/package-manifest.in
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -698,17 +698,16 @@
 @RESPATH@/res/MainMenu.nib/
 #endif
 
 ; Content-accessible resources.
 @RESPATH@/contentaccessible/*
 
 ; svg
 @RESPATH@/res/svg.css
-@RESPATH@/components/dom_smil.xpt
 
 ; [Personal Security Manager]
 ;
 ; NSS libraries are signed in the staging directory,
 ; meaning their .chk files are created there directly.
 ;
 #ifndef MOZ_SYSTEM_NSS
 #if defined(XP_LINUX) && !defined(ANDROID)
--- a/dom/events/Event.h
+++ b/dom/events/Event.h
@@ -29,16 +29,17 @@ class nsPresContext;
 namespace mozilla {
 namespace dom {
 
 class EventTarget;
 class EventMessageAutoOverride;
 // ExtendableEvent is a ServiceWorker event that is not
 // autogenerated since it has some extra methods.
 class ExtendableEvent;
+class TimeEvent;
 class WantsPopupControlCheck;
 #define GENERATED_EVENT(EventClass_) class EventClass_;
 #include "mozilla/dom/GeneratedEventList.h"
 #undef GENERATED_EVENT
 
 // Dummy class so we can cast through it to get from nsISupports to
 // Event subclasses with only two non-ambiguous static casts.
 class EventBase : public nsIDOMEvent
@@ -104,16 +105,18 @@ public:
 
   // ExtendableEvent is a ServiceWorker event that is not
   // autogenerated since it has some extra methods.
   virtual ExtendableEvent* AsExtendableEvent()
   {
     return nullptr;
   }
 
+  virtual TimeEvent* AsTimeEvent() { return nullptr; }
+
   // nsIDOMEvent Interface
   NS_DECL_NSIDOMEVENT
 
   void InitPresContextData(nsPresContext* aPresContext);
 
   // Returns true if the event should be trusted.
   bool Init(EventTarget* aGlobal);
 
deleted file mode 100644
--- a/dom/interfaces/smil/moz.build
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-with Files("**"):
-    BUG_COMPONENT = ("Core", "SVG")
-
-XPIDL_SOURCES += [
-    'nsIDOMTimeEvent.idl',
-]
-
-XPIDL_MODULE = 'dom_smil'
-
deleted file mode 100644
--- a/dom/interfaces/smil/nsIDOMTimeEvent.idl
+++ /dev/null
@@ -1,20 +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/. */
-
-#include "nsIDOMEvent.idl"
-
-/**
- * The SMIL TimeEvent interface.
- *
- * For more information please refer to:
- * http://www.w3.org/TR/SMIL/smil-timing.html#Events-TimeEvent
- * http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent
- */
-
-[builtinclass, uuid(b5e7fbac-f572-426c-9320-0ef7630f03c1)]
-interface nsIDOMTimeEvent : nsIDOMEvent
-{
-  readonly attribute long detail;
-};
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -24,17 +24,16 @@ interfaces = [
     'xbl',
     'xpath',
     'xul',
     'security',
     'storage',
     'offline',
     'geolocation',
     'notification',
-    'smil',
     'push',
     'payments',
 ]
 
 DIRS += ['interfaces/' + i for i in interfaces]
 
 DIRS += [
     'abort',
--- a/dom/smil/TimeEvent.cpp
+++ b/dom/smil/TimeEvent.cpp
@@ -33,29 +33,17 @@ TimeEvent::TimeEvent(EventTarget* aOwner
       mView = docShell->GetWindow();
     }
   }
 }
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(TimeEvent, Event,
                                    mView)
 
-NS_IMPL_ADDREF_INHERITED(TimeEvent, Event)
-NS_IMPL_RELEASE_INHERITED(TimeEvent, Event)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TimeEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMTimeEvent)
-NS_INTERFACE_MAP_END_INHERITING(Event)
-
-NS_IMETHODIMP
-TimeEvent::GetDetail(int32_t* aDetail)
-{
-  *aDetail = mDetail;
-  return NS_OK;
-}
+NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(TimeEvent, Event)
 
 void
 TimeEvent::InitTimeEvent(const nsAString& aType, nsGlobalWindowInner* aView,
                          int32_t aDetail)
 {
   NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
 
   Event::InitEvent(aType, false /*doesn't bubble*/, false /*can't cancel*/);
--- a/dom/smil/TimeEvent.h
+++ b/dom/smil/TimeEvent.h
@@ -4,41 +4,33 @@
  * 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 mozilla_dom_TimeEvent_h_
 #define mozilla_dom_TimeEvent_h_
 
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/TimeEventBinding.h"
-#include "nsIDOMTimeEvent.h"
 
 class nsGlobalWindowInner;
 
 namespace mozilla {
 namespace dom {
 
-class TimeEvent final : public Event,
-                        public nsIDOMTimeEvent
+class TimeEvent final : public Event
 {
 public:
   TimeEvent(EventTarget* aOwner,
             nsPresContext* aPresContext,
             InternalSMILTimeEvent* aEvent);
 
   // nsISupports interface:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TimeEvent, Event)
 
-  // nsIDOMTimeEvent interface:
-  NS_DECL_NSIDOMTIMEEVENT
-
-  // Forward to base class
-  NS_FORWARD_TO_EVENT
-
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return TimeEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   void InitTimeEvent(const nsAString& aType, nsGlobalWindowInner* aView,
                      int32_t aDetail);
 
@@ -48,16 +40,18 @@ public:
     return mDetail;
   }
 
   nsPIDOMWindowOuter* GetView() const
   {
     return mView;
   }
 
+  TimeEvent* AsTimeEvent() final { return this; }
+
 private:
   ~TimeEvent() {}
 
   nsCOMPtr<nsPIDOMWindowOuter> mView;
   int32_t mDetail;
 };
 
 } // namespace dom
--- a/dom/smil/nsSMILTimeValueSpec.cpp
+++ b/dom/smil/nsSMILTimeValueSpec.cpp
@@ -1,25 +1,25 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/SVGAnimationElement.h"
+#include "mozilla/dom/TimeEvent.h"
 #include "nsSMILTimeValueSpec.h"
 #include "nsSMILInterval.h"
 #include "nsSMILTimeContainer.h"
 #include "nsSMILTimeValue.h"
 #include "nsSMILTimedElement.h"
 #include "nsSMILInstanceTime.h"
 #include "nsSMILParserUtils.h"
 #include "nsIDOMKeyEvent.h"
-#include "nsIDOMTimeEvent.h"
 #include "nsString.h"
 #include <limits>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // Nested class: EventListener
@@ -367,24 +367,23 @@ nsSMILTimeValueSpec::HandleEvent(nsIDOME
   RefPtr<nsSMILInstanceTime> newInstance =
     new nsSMILInstanceTime(newTime, nsSMILInstanceTime::SOURCE_EVENT);
   mOwner->AddInstanceTime(newInstance, mIsBegin);
 }
 
 bool
 nsSMILTimeValueSpec::CheckRepeatEventDetail(nsIDOMEvent *aEvent)
 {
-  nsCOMPtr<nsIDOMTimeEvent> timeEvent = do_QueryInterface(aEvent);
+  TimeEvent* timeEvent = aEvent->InternalDOMEvent()->AsTimeEvent();
   if (!timeEvent) {
     NS_WARNING("Received a repeat event that was not a DOMTimeEvent");
     return false;
   }
 
-  int32_t detail;
-  timeEvent->GetDetail(&detail);
+  int32_t detail = timeEvent->Detail();
   return detail > 0 && (uint32_t)detail == mParams.mRepeatIteration;
 }
 
 nsSMILTimeValue
 nsSMILTimeValueSpec::ConvertBetweenTimeContainers(
     const nsSMILTimeValue& aSrcTime,
     const nsSMILTimeContainer* aSrcContainer)
 {
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -475,17 +475,16 @@
 @BINPATH@/res/fonts/*.properties
 #endif
 
 ; Content-accessible resources.
 @BINPATH@/contentaccessible/*
 
 ; svg
 @BINPATH@/res/svg.css
-@BINPATH@/components/dom_smil.xpt
 
 ; [Personal Security Manager]
 ;
 @BINPATH@/components/pipnss.xpt
 
 ; For process sandboxing
 #if defined(MOZ_SANDBOX)
 @BINPATH@/@DLL_PREFIX@mozsandbox@DLL_SUFFIX@
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -54,17 +54,16 @@
 #include "nsIDOMParser.h"
 #include "nsIDOMProcessingInstruction.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMScreen.h"
 #include "nsIDOMScrollAreaEvent.h"
 #include "nsIDOMSerializer.h"
 #include "nsIDOMSimpleGestureEvent.h"
 #include "nsIDOMText.h"
-#include "nsIDOMTimeEvent.h"
 #include "nsIDOMTimeRanges.h"
 #include "nsIDOMTransitionEvent.h"
 #include "nsIDOMUIEvent.h"
 #include "nsIDOMValidityState.h"
 #include "nsIDOMWheelEvent.h"
 #include "nsIDOMXMLDocument.h"
 #include "nsIDOMXPathEvaluator.h"
 #include "nsIDOMXPathResult.h"
@@ -275,17 +274,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(ProcessingInstruction),
   DEFINE_SHIM(Range),
   DEFINE_SHIM(Screen),
   DEFINE_SHIM(ScrollAreaEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIScrollBoxObject, ScrollBoxObject),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
   DEFINE_SHIM(SimpleGestureEvent),
   DEFINE_SHIM(Text),
-  DEFINE_SHIM(TimeEvent),
   DEFINE_SHIM(TimeRanges),
   DEFINE_SHIM(TransitionEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject),
   DEFINE_SHIM(UIEvent),
   DEFINE_SHIM(ValidityState),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIWebBrowserPersistable, FrameLoader),
   DEFINE_SHIM(WheelEvent),
   DEFINE_SHIM(XMLDocument),