remove moz_gamepad
authorDaosheng Mu <daoshengmu@gmail.com>
Wed, 07 Dec 2016 13:01:34 -1000
changeset 909810 f5b98238a0113f9ce9db3908ff8ca0c8cfc18ec2
parent 908977 8103c612b79c2587ea4ca1b0a9f9f82db4b185b8
child 909811 7b5bf7eb62aab54b7a4d2154fc4a3d9154911d8c
push id158344
push userdmu@mozilla.com
push dateWed, 07 Dec 2016 23:03:34 +0000
treeherdertry@7b5bf7eb62aa [default view] [failures only]
milestone53.0a1
remove moz_gamepad MozReview-Commit-ID: 2JrYM9PsXdO
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/base/nsGkAtomList.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/events/EventListenerManager.cpp
dom/events/EventNameList.h
dom/gamepad/GamepadPlatformService.cpp
dom/gamepad/GamepadServiceTest.cpp
dom/gamepad/GamepadServiceTest.h
dom/gamepad/ipc/GamepadEventTypes.ipdlh
dom/gamepad/ipc/GamepadMessageUtils.h
dom/gamepad/moz.build
dom/webidl/GamepadServiceTest.webidl
dom/webidl/Navigator.webidl
dom/webidl/moz.build
gfx/vr/gfxVR.cpp
gfx/vr/gfxVR.h
gfx/vr/gfxVROpenVR.cpp
gfx/vr/ipc/VRManagerChild.cpp
ipc/glue/BackgroundChildImpl.cpp
ipc/glue/BackgroundParentImpl.cpp
old-configure.in
widget/EventMessageList.h
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -27,19 +27,19 @@
 #include "nsIScriptSecurityManager.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsContentUtils.h"
 #include "nsUnicharUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "BatteryManager.h"
 #include "mozilla/dom/DeviceStorageAreaListener.h"
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/GamepadServiceTest.h"
-#endif
+// #endif
 #include "mozilla/dom/PowerManager.h"
 #include "mozilla/dom/WakeLock.h"
 #include "mozilla/dom/power/PowerManagerService.h"
 #include "mozilla/dom/FlyWebPublishedServer.h"
 #include "mozilla/dom/FlyWebService.h"
 #include "mozilla/dom/Permissions.h"
 #include "mozilla/dom/Presentation.h"
 #include "mozilla/dom/ServiceWorkerContainer.h"
@@ -212,19 +212,19 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaDevices)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTimeManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDeviceStorageAreaListener)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresentation)
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest)
-#endif
+// #endif
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVRGetDisplaysPromises)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Navigator)
 
 void
 Navigator::Invalidate()
@@ -302,22 +302,22 @@ Navigator::Invalidate()
     mMediaKeySystemAccessManager->Shutdown();
     mMediaKeySystemAccessManager = nullptr;
   }
 
   if (mDeviceStorageAreaListener) {
     mDeviceStorageAreaListener = nullptr;
   }
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   if (mGamepadServiceTest) {
     mGamepadServiceTest->Shutdown();
     mGamepadServiceTest = nullptr;
   }
-#endif
+// #endif
 
   mVRGetDisplaysPromises.Clear();
 }
 
 //*****************************************************************************
 //    Navigator::nsIDOMNavigator
 //*****************************************************************************
 
@@ -1600,17 +1600,17 @@ Navigator::RequestWakeLock(const nsAStri
 
 already_AddRefed<LegacyMozTCPSocket>
 Navigator::MozTCPSocket()
 {
   RefPtr<LegacyMozTCPSocket> socket = new LegacyMozTCPSocket(GetWindow());
   return socket.forget();
 }
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 void
 Navigator::GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads,
                        ErrorResult& aRv)
 {
   if (!mWindow) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return;
   }
@@ -1623,17 +1623,17 @@ Navigator::GetGamepads(nsTArray<RefPtr<G
 GamepadServiceTest*
 Navigator::RequestGamepadServiceTest()
 {
   if (!mGamepadServiceTest) {
     mGamepadServiceTest = GamepadServiceTest::CreateTestService(mWindow);
   }
   return mGamepadServiceTest;
 }
-#endif
+// #endif
 
 already_AddRefed<Promise>
 Navigator::GetVRDisplays(ErrorResult& aRv)
 {
   if (!mWindow || !mWindow->GetDocShell()) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -56,20 +56,20 @@ class Permissions;
 namespace battery {
 class BatteryManager;
 } // namespace battery
 
 class Promise;
 
 class DesktopNotificationCenter;
 class MozIdleObserver;
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 class Gamepad;
 class GamepadServiceTest;
-#endif // MOZ_GAMEPAD
+// #endif // MOZ_GAMEPAD
 class NavigatorUserMediaSuccessCallback;
 class NavigatorUserMediaErrorCallback;
 class MozGetUserMediaDevicesSuccessCallback;
 
 namespace network {
 class Connection;
 } // namespace network
 
@@ -207,20 +207,20 @@ public:
   GetDeviceStorageByNameAndType(const nsAString& aName, const nsAString& aType,
                                 ErrorResult& aRv);
 
   DesktopNotificationCenter* GetMozNotification(ErrorResult& aRv);
   already_AddRefed<LegacyMozTCPSocket> MozTCPSocket();
   network::Connection* GetConnection(ErrorResult& aRv);
   MediaDevices* GetMediaDevices(ErrorResult& aRv);
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   void GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads, ErrorResult& aRv);
   GamepadServiceTest* RequestGamepadServiceTest();
-#endif // MOZ_GAMEPAD
+// #endif // MOZ_GAMEPAD
   already_AddRefed<Promise> GetVRDisplays(ErrorResult& aRv);
   void GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const;
 #ifdef MOZ_TIME_MANAGER
   time::TimeManager* GetMozTime(ErrorResult& aRv);
 #endif // MOZ_TIME_MANAGER
 #ifdef MOZ_AUDIO_CHANNEL_MANAGER
   system::AudioChannelManager* GetMozAudioChannelManager(ErrorResult& aRv);
 #endif // MOZ_AUDIO_CHANNEL_MANAGER
@@ -306,19 +306,19 @@ private:
 #endif
   RefPtr<MediaDevices> mMediaDevices;
   nsTArray<nsWeakPtr> mDeviceStorageStores;
   RefPtr<time::TimeManager> mTimeManager;
   RefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
   RefPtr<DeviceStorageAreaListener> mDeviceStorageAreaListener;
   RefPtr<Presentation> mPresentation;
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   RefPtr<GamepadServiceTest> mGamepadServiceTest;
-#endif
+// #endif
   nsTArray<RefPtr<Promise> > mVRGetDisplaysPromises;
   nsTArray<uint32_t> mRequestedVibrationPattern;
   RefPtr<StorageManager> mStorageManager;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -2122,23 +2122,23 @@ GK_ATOM(ratechange, "ratechange")
 GK_ATOM(durationchange, "durationchange")
 GK_ATOM(volumechange, "volumechange")
 GK_ATOM(ondataavailable, "ondataavailable")
 GK_ATOM(onwarning, "onwarning")
 GK_ATOM(onstart, "onstart")
 GK_ATOM(onstop, "onstop")
 GK_ATOM(onphoto, "onphoto")
 GK_ATOM(onactivestatechanged, "onactivestatechanged")
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 GK_ATOM(ongamepadbuttondown, "ongamepadbuttondown")
 GK_ATOM(ongamepadbuttonup, "ongamepadbuttonup")
 GK_ATOM(ongamepadaxismove, "ongamepadaxismove")
 GK_ATOM(ongamepadconnected, "ongamepadconnected")
 GK_ATOM(ongamepaddisconnected, "ongamepaddisconnected")
-#endif
+// #endif
 
 // Content property names
 GK_ATOM(animationsProperty, "AnimationsProperty")        // FrameAnimations*
 GK_ATOM(animationsOfBeforeProperty, "AnimationsOfBeforeProperty") // FrameAnimations*
 GK_ATOM(animationsOfAfterProperty, "AnimationsOfAfterProperty") // FrameAnimations*
 GK_ATOM(animationEffectsProperty, "AnimationEffectsProperty") // EffectSet*
 GK_ATOM(animationEffectsForBeforeProperty, "AnimationsEffectsForBeforeProperty") // EffectSet*
 GK_ATOM(animationEffectsForAfterProperty, "AnimationsEffectsForAfterProperty") // EffectSet*
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -191,20 +191,20 @@
 #include "mozilla/Logging.h"
 #include "prenv.h"
 #include "prprf.h"
 
 #include "mozilla/dom/IDBFactory.h"
 #include "mozilla/dom/MessageChannel.h"
 #include "mozilla/dom/Promise.h"
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/Gamepad.h"
 #include "mozilla/dom/GamepadManager.h"
-#endif
+// #endif
 
 #include "mozilla/dom/VRDisplay.h"
 #include "mozilla/dom/VREventObserver.h"
 
 #include "nsRefreshDriver.h"
 #include "Layers.h"
 
 #include "mozilla/AddonPathService.h"
@@ -1252,19 +1252,19 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalW
     mIsChrome(false),
     mCleanMessageManager(false),
     mNeedsFocus(true),
     mHasFocus(false),
     mShowFocusRingForContent(false),
     mFocusByKeyOccurred(false),
     mHasGamepad(false),
     mHasVREvents(false),
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
     mHasSeenGamepadInput(false),
-#endif
+// #endif
     mNotifiedIDDestroyed(false),
     mAllowScriptsToClose(false),
     mTimeoutInsertionPoint(nullptr),
     mTimeoutIdCounter(1),
     mTimeoutFiringDepth(0),
     mSuspendDepth(0),
     mFreezeDepth(0),
     mBackPressureDelayMS(0),
@@ -1828,21 +1828,21 @@ nsGlobalWindow::FreeInnerObjects()
 
   CleanupCachedXBLHandlers(this);
 
   for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
     mAudioContexts[i]->Shutdown();
   }
   mAudioContexts.Clear();
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   DisableGamepadUpdates();
   mHasGamepad = false;
   mGamepads.Clear();
-#endif
+// #endif
   DisableVRUpdates();
   mHasVREvents = false;
   mVRDisplays.Clear();
 }
 
 //*****************************************************************************
 // nsGlobalWindow::nsISupports
 //*****************************************************************************
@@ -1988,19 +1988,19 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
   }
 
   for (IdleRequest* request : tmp->mThrottledIdleRequestCallbacks) {
     cb.NoteNativeChild(request, NS_CYCLE_COLLECTION_PARTICIPANT(IdleRequest));
   }
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIdleObservers)
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepads)
-#endif
+// #endif
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCacheStorage)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVRDisplays)
 
   // Traverse stuff from nsPIDOMWindow
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeEventHandler)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentTarget)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameElement)
@@ -2065,19 +2065,19 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mIndexedDB)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentPrincipal)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDoc)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mIdleService)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mWakeLock)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mPendingStorageEvents)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mIdleObservers)
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mGamepads)
-#endif
+// #endif
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCacheStorage)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mVRDisplays)
 
   // Unlink stuff from nsPIDOMWindow
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeEventHandler)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mParentTarget)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameElement)
@@ -10149,24 +10149,24 @@ void nsGlobalWindow::SetIsBackground(boo
   }
 
   if (!aIsBackground) {
     nsGlobalWindow* inner = GetCurrentInnerWindowInternal();
     if (inner) {
       inner->UnthrottleIdleCallbackRequests();
     }
   }
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   if (!aIsBackground) {
     nsGlobalWindow* inner = GetCurrentInnerWindowInternal();
     if (inner) {
       inner->SyncGamepadState();
     }
   }
-#endif
+// #endif
 }
 
 void nsGlobalWindow::MaybeUpdateTouchState()
 {
   FORWARD_TO_INNER_VOID(MaybeUpdateTouchState, ());
 
   if (mMayHaveTouchEventListener) {
     nsCOMPtr<nsIObserverService> observerService =
@@ -10181,37 +10181,37 @@ void nsGlobalWindow::MaybeUpdateTouchSta
 }
 
 void
 nsGlobalWindow::EnableGamepadUpdates()
 {
   MOZ_ASSERT(IsInnerWindow());
 
   if (mHasGamepad) {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
     RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
     if (gamepadManager) {
       gamepadManager->AddListener(this);
     }
-#endif
+// #endif
   }
 }
 
 void
 nsGlobalWindow::DisableGamepadUpdates()
 {
   MOZ_ASSERT(IsInnerWindow());
 
   if (mHasGamepad) {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
     RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
     if (gamepadManager) {
       gamepadManager->RemoveListener(this);
     }
-#endif
+// #endif
   }
 }
 
 void
 nsGlobalWindow::EnableVRUpdates()
 {
   MOZ_ASSERT(IsInnerWindow());
 
@@ -13803,18 +13803,17 @@ nsGlobalWindow::AddSizeOfIncludingThis(n
     }
     if (EventListenerManager* elm = et->GetExistingListenerManager()) {
       aWindowSizes->mDOMEventListenersCount += elm->ListenerCount();
     }
     ++aWindowSizes->mDOMEventTargetsCount;
   }
 }
 
-
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 void
 nsGlobalWindow::AddGamepad(uint32_t aIndex, Gamepad* aGamepad)
 {
   MOZ_ASSERT(IsInnerWindow());
   // Create the index we will present to content based on which indices are
   // already taken, as required by the spec.
   // https://w3c.github.io/gamepad/gamepad.html#widl-Gamepad-index
   int index = 0;
@@ -13886,17 +13885,17 @@ nsGlobalWindow::SyncGamepadState()
   MOZ_ASSERT(IsInnerWindow());
   if (mHasSeenGamepadInput) {
     RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
     for (auto iter = mGamepads.Iter(); !iter.Done(); iter.Next()) {
       gamepadManager->SyncGamepadState(iter.Key(), iter.UserData());
     }
   }
 }
-#endif // MOZ_GAMEPAD
+// #endif // MOZ_GAMEPAD
 
 bool
 nsGlobalWindow::UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDevices)
 {
   FORWARD_TO_INNER(UpdateVRDisplays, (aDevices), false);
 
   VRDisplay::UpdateVRDisplays(mVRDisplays, AsInner());
   aDevices = mVRDisplays;
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -727,26 +727,26 @@ public:
   enum SlowScriptResponse {
     ContinueSlowScript = 0,
     ContinueSlowScriptAndKeepNotifying,
     AlwaysContinueSlowScript,
     KillSlowScript
   };
   SlowScriptResponse ShowSlowScriptDialog();
 
-#ifdef MOZ_GAMEPAD
+//#ifdef MOZ_GAMEPAD
   // Inner windows only.
   void AddGamepad(uint32_t aIndex, mozilla::dom::Gamepad* aGamepad);
   void RemoveGamepad(uint32_t aIndex);
   void GetGamepads(nsTArray<RefPtr<mozilla::dom::Gamepad> >& aGamepads);
   already_AddRefed<mozilla::dom::Gamepad> GetGamepad(uint32_t aIndex);
   void SetHasSeenGamepadInput(bool aHasSeen);
   bool HasSeenGamepadInput();
   void SyncGamepadState();
-#endif
+// #endif
 
   // Inner windows only.
   // Enable/disable updates for gamepad input.
   void EnableGamepadUpdates();
   void DisableGamepadUpdates();
 
   // Inner windows only.
   // Enable/disable updates for VR
@@ -1790,21 +1790,21 @@ protected:
 
   // Inner windows only.
   // Indicates whether this window wants gamepad input events
   bool                   mHasGamepad : 1;
 
   // Inner windows only.
   // Indicates whether this window wants VR events
   bool                   mHasVREvents : 1;
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   nsCheapSet<nsUint32HashKey> mGamepadIndexSet;
   nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads;
   bool mHasSeenGamepadInput;
-#endif
+// #endif
 
   // whether we've sent the destroy notification for our window id
   bool                   mNotifiedIDDestroyed : 1;
   // whether scripts may close the window,
   // even if "dom.allow_scripts_to_close_windows" is false.
   bool                   mAllowScriptsToClose : 1;
 
   nsCOMPtr<nsIScriptContext>    mContext;
--- a/dom/events/EventListenerManager.cpp
+++ b/dom/events/EventListenerManager.cpp
@@ -403,23 +403,23 @@ EventListenerManager::AddEventListenerIn
       nsCOMPtr<nsIDocument> d = window->GetExtantDoc();
       NS_WARNING_ASSERTION(
         !nsContentUtils::IsChromeDoc(d),
         "Please do not use mouseenter/leave events in chrome. "
         "They are slower than mouseover/out!");
 #endif
       window->SetHasMouseEnterLeaveEventListeners();
     }
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   } else if (aEventMessage >= eGamepadEventFirst &&
              aEventMessage <= eGamepadEventLast) {
     if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
       window->SetHasGamepadEventListener();
     }
-#endif
+// #endif
   } else if (aTypeAtom == nsGkAtoms::onkeydown ||
              aTypeAtom == nsGkAtoms::onkeypress ||
              aTypeAtom == nsGkAtoms::onkeyup) {
     if (!aFlags.mInSystemGroup) {
       mMayHaveKeyEventListener = true;
     }
   } else if (aTypeAtom == nsGkAtoms::oncompositionend ||
              aTypeAtom == nsGkAtoms::oncompositionstart ||
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -887,17 +887,17 @@ NON_IDL_EVENT(MozAfterPaint,
               EventNameType_None,
               eBasicEventClass)
 
 NON_IDL_EVENT(MozScrolledAreaChanged,
               eScrolledAreaChanged,
               EventNameType_None,
               eScrollAreaEventClass)
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 NON_IDL_EVENT(gamepadbuttondown,
               eGamepadButtonDown,
               EventNameType_None,
               eBasicEventClass)
 NON_IDL_EVENT(gamepadbuttonup,
               eGamepadButtonUp,
               EventNameType_None,
               eBasicEventClass)
@@ -908,17 +908,17 @@ NON_IDL_EVENT(gamepadaxismove,
 NON_IDL_EVENT(gamepadconnected,
               eGamepadConnected,
               EventNameType_None,
               eBasicEventClass)
 NON_IDL_EVENT(gamepaddisconnected,
               eGamepadDisconnected,
               EventNameType_None,
               eBasicEventClass)
-#endif
+// #endif
 
 // Simple gesture events
 NON_IDL_EVENT(MozSwipeGestureMayStart,
               eSwipeGestureMayStart,
               EventNameType_None,
               eSimpleGestureEventClass)
 NON_IDL_EVENT(MozSwipeGestureStart,
               eSwipeGestureStart,
--- a/dom/gamepad/GamepadPlatformService.cpp
+++ b/dom/gamepad/GamepadPlatformService.cpp
@@ -90,17 +90,17 @@ GamepadPlatformService::AddGamepad(const
 {
   // This method is called by monitor thread populated in
   // platform-dependent backends
   MOZ_ASSERT(XRE_IsParentProcess());
   MOZ_ASSERT(!NS_IsMainThread());
 
   uint32_t index = ++mGamepadIndex;
   GamepadAdded a(NS_ConvertUTF8toUTF16(nsDependentCString(aID)), index,
-                 static_cast<uint32_t>(aMapping), GamepadServiceType::Standard, aNumButtons, aNumAxes);
+                 aMapping, GamepadServiceType::Standard, aNumButtons, aNumAxes);
   NotifyGamepadChange<GamepadAdded>(a);
   return index;
 }
 
 void
 GamepadPlatformService::RemoveGamepad(uint32_t aIndex)
 {
   // This method is called by monitor thread populated in
--- a/dom/gamepad/GamepadServiceTest.cpp
+++ b/dom/gamepad/GamepadServiceTest.cpp
@@ -108,17 +108,17 @@ GamepadServiceTest::DestroyPBackgroundAc
     // want to destroy it now, just cancel all pending
     // operations.
     mPendingOperations.Clear();
   }
 }
 
 already_AddRefed<Promise>
 GamepadServiceTest::AddGamepad(const nsAString& aID,
-                               uint32_t aMapping,
+                               GamepadMappingType aMapping,
                                uint32_t aNumButtons,
                                uint32_t aNumAxes,
                                ErrorResult& aRv)
 {
   if (mShuttingDown) {
     return nullptr;
   }
 
--- a/dom/gamepad/GamepadServiceTest.h
+++ b/dom/gamepad/GamepadServiceTest.h
@@ -28,17 +28,17 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(GamepadServiceTest,
                                            DOMEventTargetHelper)
 
   uint32_t NoMapping() const { return 0; }
   uint32_t StandardMapping() const { return 1; }
 
   already_AddRefed<Promise> AddGamepad(const nsAString& aID,
-                                       uint32_t aMapping,
+                                       GamepadMappingType aMapping,
                                        uint32_t aNumButtons,
                                        uint32_t aNumAxes,
                                        ErrorResult& aRv);
   void RemoveGamepad(uint32_t aIndex);
   void NewButtonEvent(uint32_t aIndex, uint32_t aButton, bool aPressed);
   void NewButtonValueEvent(uint32_t aIndex, uint32_t aButton, bool aPressed, double aValue);
   void NewAxisMoveEvent(uint32_t aIndex, uint32_t aAxis, double aValue);
   void Shutdown();
--- a/dom/gamepad/ipc/GamepadEventTypes.ipdlh
+++ b/dom/gamepad/ipc/GamepadEventTypes.ipdlh
@@ -1,26 +1,24 @@
 /* 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/. */
 
 using mozilla::dom::GamepadServiceType from "mozilla/dom/GamepadMessageUtils.h";
 using mozilla::dom::GamepadPoseState from "mozilla/dom/GamepadMessageUtils.h";
+using mozilla::dom::GamepadMappingType from "mozilla/dom/GamepadMessageUtils.h";
 
 
 namespace mozilla {
 namespace dom {
 
 struct GamepadAdded {
   nsString id;
   uint32_t index;
-  // Ideally, mapping should be a GamepadMappingType
-  // But, we have dependency problems in non MOZ_GAMEPAD
-  // platforms. Therefore, we make it as an uint32_t here.
-  uint32_t mapping;
+  GamepadMappingType mapping;
   GamepadServiceType service_type;
   uint32_t num_buttons;
   uint32_t num_axes;
 };
 
 struct GamepadRemoved {
   uint32_t index;
   GamepadServiceType service_type;
--- a/dom/gamepad/ipc/GamepadMessageUtils.h
+++ b/dom/gamepad/ipc/GamepadMessageUtils.h
@@ -1,19 +1,27 @@
 
 #ifndef mozilla_dom_gamepad_GamepadMessageUtils_h
 #define mozilla_dom_gamepad_GamepadMessageUtils_h
 
 #include "ipc/IPCMessageUtils.h"
+#include "mozilla/dom/GamepadBinding.h"
+#include "mozilla/dom/GamepadPoseState.h"
 #include "mozilla/dom/GamepadServiceType.h"
-#include "mozilla/dom/GamepadPoseState.h"
 
 namespace IPC {
 
 template<>
+struct ParamTraits<mozilla::dom::GamepadMappingType> :
+  public ContiguousEnumSerializer<mozilla::dom::GamepadMappingType,
+                                  mozilla::dom::GamepadMappingType(0),
+                                  mozilla::dom::GamepadMappingType(
+                                  mozilla::dom::GamepadMappingType::EndGuard_)> {};
+
+template<>
 struct ParamTraits<mozilla::dom::GamepadServiceType> :
   public ContiguousEnumSerializer<mozilla::dom::GamepadServiceType,
                                   mozilla::dom::GamepadServiceType(0),
                                   mozilla::dom::GamepadServiceType(
                                   mozilla::dom::GamepadServiceType::NumGamepadServiceType)> {};
 
 template<>
 struct ParamTraits<mozilla::dom::GamepadCapabilityFlags> :
--- a/dom/gamepad/moz.build
+++ b/dom/gamepad/moz.build
@@ -6,78 +6,78 @@
 
 IPDL_SOURCES += [
     'ipc/GamepadEventTypes.ipdlh',
     'ipc/PGamepadEventChannel.ipdl',
     'ipc/PGamepadTestChannel.ipdl'
 ]
 
 EXPORTS.mozilla.dom += [
+    'GamepadManager.h',
     'GamepadPoseState.h',
     'ipc/GamepadMessageUtils.h',
     'ipc/GamepadServiceType.h'
 ]
 
-if CONFIG['MOZ_GAMEPAD']:
-    EXPORTS.mozilla.dom += [
-        'Gamepad.h',
-        'GamepadButton.h',
-        'GamepadManager.h',
-        'GamepadMonitoring.h',
-        'GamepadPlatformService.h',
-        'GamepadPose.h',
-        'GamepadServiceTest.h',
-        'ipc/GamepadEventChannelChild.h',
-        'ipc/GamepadEventChannelParent.h',
-        'ipc/GamepadTestChannelChild.h',
-        'ipc/GamepadTestChannelParent.h'
-        ]
+# if CONFIG['MOZ_GAMEPAD']:
+EXPORTS.mozilla.dom += [
+    'Gamepad.h',
+    'GamepadButton.h',
+    'GamepadMonitoring.h',
+    'GamepadPlatformService.h',
+    'GamepadPose.h',
+    'GamepadServiceTest.h',
+    'ipc/GamepadEventChannelChild.h',
+    'ipc/GamepadEventChannelParent.h',
+    'ipc/GamepadTestChannelChild.h',
+    'ipc/GamepadTestChannelParent.h'
+    ]
 
-    UNIFIED_SOURCES = [
-        'Gamepad.cpp',
-        'GamepadButton.cpp',
-        'GamepadManager.cpp',
-        'GamepadMonitoring.cpp',
-        'GamepadPlatformService.cpp',
-        'GamepadPose.cpp',
-        'GamepadServiceTest.cpp',
-        'ipc/GamepadEventChannelChild.cpp',
-        'ipc/GamepadEventChannelParent.cpp',
-        'ipc/GamepadTestChannelChild.cpp',
-        'ipc/GamepadTestChannelParent.cpp'
-        ]
-
-    if CONFIG['MOZ_GAMEPAD_BACKEND'] == 'stub':
-        UNIFIED_SOURCES += [
-            'fallback/FallbackGamepad.cpp'
-        ]
-    elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'cocoa':
-        UNIFIED_SOURCES += [
-            'cocoa/CocoaGamepad.cpp'
-        ]
-    elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'windows':
-        UNIFIED_SOURCES += [
-            'windows/WindowsGamepad.cpp'
-        ]
-    elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'linux':
-        UNIFIED_SOURCES += [
-            'linux/LinuxGamepad.cpp'
-        ]
-    elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android':
-        UNIFIED_SOURCES += [
-            'android/AndroidGamepad.cpp'
-        ]
-
-    LOCAL_INCLUDES += [
-        'ipc',
+UNIFIED_SOURCES = [
+    'Gamepad.cpp',
+    'GamepadButton.cpp',
+    'GamepadManager.cpp',
+    'GamepadMonitoring.cpp',
+    'GamepadPlatformService.cpp',
+    'GamepadPose.cpp',
+    'GamepadServiceTest.cpp',
+    'ipc/GamepadEventChannelChild.cpp',
+    'ipc/GamepadEventChannelParent.cpp',
+    'ipc/GamepadTestChannelChild.cpp',
+    'ipc/GamepadTestChannelParent.cpp'
     ]
 
-    include('/ipc/chromium/chromium-config.mozbuild')
-
-    FINAL_LIBRARY = 'xul'
-    LOCAL_INCLUDES += [
-        '/dom/base',
+if CONFIG['MOZ_GAMEPAD_BACKEND'] == 'stub':
+    UNIFIED_SOURCES += [
+        'fallback/FallbackGamepad.cpp'
+    ]
+elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'cocoa':
+    UNIFIED_SOURCES += [
+        'cocoa/CocoaGamepad.cpp'
+    ]
+elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'windows':
+    UNIFIED_SOURCES += [
+        'windows/WindowsGamepad.cpp'
+    ]
+elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'linux':
+    UNIFIED_SOURCES += [
+        'linux/LinuxGamepad.cpp'
+    ]
+elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android':
+    UNIFIED_SOURCES += [
+        'android/AndroidGamepad.cpp'
     ]
 
-    CFLAGS += CONFIG['GLIB_CFLAGS']
-    CFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
-    CXXFLAGS += CONFIG['GLIB_CFLAGS']
-    CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
+LOCAL_INCLUDES += [
+    'ipc',
+]
+
+include('/ipc/chromium/chromium-config.mozbuild')
+
+FINAL_LIBRARY = 'xul'
+LOCAL_INCLUDES += [
+    '/dom/base',
+]
+
+CFLAGS += CONFIG['GLIB_CFLAGS']
+CFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
+CXXFLAGS += CONFIG['GLIB_CFLAGS']
+CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
--- a/dom/webidl/GamepadServiceTest.webidl
+++ b/dom/webidl/GamepadServiceTest.webidl
@@ -5,17 +5,17 @@
 [Pref="dom.gamepad.test.enabled"]
 interface GamepadServiceTest
 {
   readonly attribute unsigned long noMapping;
   readonly attribute unsigned long standardMapping;
 
   [Throws]
   Promise<unsigned long> addGamepad(DOMString id,
-                                    unsigned long mapping,
+                                    GamepadMappingType mapping,
                                     unsigned long numButtons,
                                     unsigned long numAxes);
 
   void removeGamepad(unsigned long index);
 
   void newButtonEvent(unsigned long index,
                       unsigned long button,
                       boolean pressed);
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -266,27 +266,27 @@ partial interface Navigator {
 };
 
 // NetworkInformation
 partial interface Navigator {
   [Throws, Pref="dom.netinfo.enabled"]
   readonly attribute NetworkInformation connection;
 };
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
 partial interface Navigator {
   [Throws, Pref="dom.gamepad.enabled"]
   sequence<Gamepad?> getGamepads();
 };
 partial interface Navigator {
   [Pref="dom.gamepad.test.enabled"]
   GamepadServiceTest requestGamepadServiceTest();
 };
-#endif // MOZ_GAMEPAD
+// #endif // MOZ_GAMEPAD
 
 partial interface Navigator {
   [Throws, Pref="dom.vr.enabled"]
   Promise<sequence<VRDisplay>> getVRDisplays();
   // TODO: Use FrozenArray once available. (Bug 1236777)
   [Frozen, Cached, Pure, Pref="dom.vr.enabled"]
   readonly attribute sequence<VRDisplay> activeVRDisplays;
 };
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -630,22 +630,22 @@ if CONFIG['MOZ_WEBSPEECH']:
         'SpeechRecognitionResultList.webidl',
         'SpeechSynthesis.webidl',
         'SpeechSynthesisErrorEvent.webidl',
         'SpeechSynthesisEvent.webidl',
         'SpeechSynthesisUtterance.webidl',
         'SpeechSynthesisVoice.webidl',
     ]
 
-if CONFIG['MOZ_GAMEPAD']:
-    WEBIDL_FILES += [
-        'Gamepad.webidl',
-        'GamepadPose.webidl',
-        'GamepadServiceTest.webidl'
-    ]
+#if CONFIG['MOZ_GAMEPAD']:
+WEBIDL_FILES += [
+    'Gamepad.webidl',
+    'GamepadPose.webidl',
+    'GamepadServiceTest.webidl'
+]
 
 WEBIDL_FILES += [
     'CloseEvent.webidl',
     'CustomEvent.webidl',
     'DeviceOrientationEvent.webidl',
     'DeviceStorageChangeEvent.webidl',
     'HashChangeEvent.webidl',
     'MozSettingsEvent.webidl',
@@ -734,22 +734,22 @@ if CONFIG['MOZ_WEBRTC']:
 
 if CONFIG['MOZ_WEBSPEECH']:
     GENERATED_EVENTS_WEBIDL_FILES += [
         'SpeechRecognitionEvent.webidl',
         'SpeechSynthesisErrorEvent.webidl',
         'SpeechSynthesisEvent.webidl',
     ]
 
-if CONFIG['MOZ_GAMEPAD']:
-    GENERATED_EVENTS_WEBIDL_FILES += [
-        'GamepadAxisMoveEvent.webidl',
-        'GamepadButtonEvent.webidl',
-        'GamepadEvent.webidl',
-    ]
+#if CONFIG['MOZ_GAMEPAD']:
+GENERATED_EVENTS_WEBIDL_FILES += [
+    'GamepadAxisMoveEvent.webidl',
+    'GamepadButtonEvent.webidl',
+    'GamepadEvent.webidl',
+]
 
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner'] or CONFIG['MOZ_SUITE']:
     WEBIDL_FILES += [
         'BrowserFeedWriter.webidl',
     ]
 
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
     WEBIDL_FILES += [
--- a/gfx/vr/gfxVR.cpp
+++ b/gfx/vr/gfxVR.cpp
@@ -1,20 +1,20 @@
 /* -*- Mode: C++; tab-width: 20; 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 <math.h>
 
 #include "gfxVR.h"
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/GamepadEventTypes.h"
 #include "mozilla/dom/GamepadBinding.h"
-#endif
+// #endif
 
 #ifndef M_PI
 # define M_PI 3.14159265358979323846
 #endif
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
@@ -63,17 +63,17 @@ VRFieldOfView::ConstructProjectionMatrix
 
 /* static */ uint32_t
 VRControllerManager::AllocateControllerID()
 {
   return ++sControllerBase;
 }
 
 void
-VRControllerManager::AddGamepad(const char* aID, uint32_t aMapping,
+VRControllerManager::AddGamepad(const char* aID, dom::GamepadMappingType aMapping,
                                 uint32_t aNumButtons, uint32_t aNumAxes)
 {
   dom::GamepadAdded a(NS_ConvertUTF8toUTF16(nsDependentCString(aID)), mControllerCount,
                      aMapping, dom::GamepadServiceType::VR, aNumButtons,
                      aNumAxes);
 
   VRManager* vm = VRManager::Get();
   MOZ_ASSERT(vm);
--- a/gfx/vr/gfxVR.h
+++ b/gfx/vr/gfxVR.h
@@ -253,17 +253,17 @@ public:
   virtual void Destroy() = 0;
   virtual void HandleInput() = 0;
   virtual void GetControllers(nsTArray<RefPtr<VRControllerHost>>& aControllerResult) = 0;
   virtual void ScanForDevices() = 0;
   virtual void RemoveDevices() = 0;
   void NewButtonEvent(uint32_t aIndex, uint32_t aButton, bool aPressed);
   void NewAxisMove(uint32_t aIndex, uint32_t aAxis, double aValue);
   void NewPoseState(uint32_t aIndex, const dom::GamepadPoseState& aPose);
-  void AddGamepad(const char* aID, uint32_t aMapping,
+  void AddGamepad(const char* aID, dom::GamepadMappingType aMapping,
                   uint32_t aNumButtons, uint32_t aNumAxes);
   void RemoveGamepad(uint32_t aIndex);
 
 protected:
   VRControllerManager() : mInstalled(false), mControllerCount(0) {}
   virtual ~VRControllerManager() {}
 
   bool mInstalled;
--- a/gfx/vr/gfxVROpenVR.cpp
+++ b/gfx/vr/gfxVROpenVR.cpp
@@ -20,20 +20,20 @@
 #endif // XP_WIN
 
 #include "gfxVROpenVR.h"
 
 #include "nsServiceManagerUtils.h"
 #include "nsIScreenManager.h"
 #include "openvr/openvr.h"
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/GamepadEventTypes.h"
 #include "mozilla/dom/GamepadBinding.h"
-#endif
+// #endif
 
 #ifndef M_PI
 # define M_PI 3.14159265358979323846
 #endif
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::gfx::impl;
@@ -485,21 +485,21 @@ VRDisplayManagerOpenVR::GetHMDs(nsTArray
   }
 }
 
 VRControllerOpenVR::VRControllerOpenVR()
   : VRControllerHost(VRDeviceType::OpenVR)
 {
   MOZ_COUNT_CTOR_INHERITED(VRControllerOpenVR, VRControllerHost);
   mControllerInfo.mControllerName.AssignLiteral("OpenVR HMD");
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   mControllerInfo.mMappingType = static_cast<uint32_t>(GamepadMappingType::_empty);
-#else
-  mControllerInfo.mMappingType = 0;
-#endif
+// #else
+//   mControllerInfo.mMappingType = 0;
+// #endif
   mControllerInfo.mNumButtons = gNumOpenVRButtonMask;
   mControllerInfo.mNumAxes = gNumOpenVRAxis;
 }
 
 VRControllerOpenVR::~VRControllerOpenVR()
 {
   MOZ_COUNT_DTOR_INHERITED(VRControllerOpenVR, VRControllerHost);
 }
@@ -747,22 +747,22 @@ VRControllerManagerOpenVR::ScanForDevice
     for (vr::TrackedDeviceIndex_t i = 0; i < newControllerCount; ++i) {
       vr::TrackedDeviceIndex_t trackedDevice = trackedIndexArray[i];
       RefPtr<VRControllerOpenVR> openVRController = new VRControllerOpenVR();
       openVRController->SetIndex(mControllerCount);
       openVRController->SetTrackedIndex(trackedDevice);
       mOpenVRController.AppendElement(openVRController);
 
   // Only in MOZ_GAMEPAD platform, We add gamepads.
-  #ifdef MOZ_GAMEPAD
+  // #ifdef MOZ_GAMEPAD
       // Not already present, add it.
-      AddGamepad("OpenVR Gamepad", static_cast<uint32_t>(GamepadMappingType::_empty),
+      AddGamepad("OpenVR Gamepad", GamepadMappingType::_empty,
                  gNumOpenVRButtonMask, gNumOpenVRAxis);
       ++mControllerCount;
-  #endif
+  // #endif
     }
   }
 }
 
 void
 VRControllerManagerOpenVR::RemoveDevices()
 {
   mOpenVRController.Clear();
--- a/gfx/vr/ipc/VRManagerChild.cpp
+++ b/gfx/vr/ipc/VRManagerChild.cpp
@@ -13,19 +13,19 @@
 #include "mozilla/layers/CompositorThread.h" // for CompositorThread
 #include "mozilla/dom/Navigator.h"
 #include "mozilla/dom/VREventObserver.h"
 #include "mozilla/dom/WindowBinding.h" // for FrameRequestCallback
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/layers/TextureClient.h"
 #include "nsContentUtils.h"
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/GamepadManager.h"
-#endif
+// #endif
 
 using layers::TextureClient;
 
 namespace {
 const nsTArray<RefPtr<dom::VREventObserver>>::index_type kNoIndex =
   nsTArray<RefPtr<dom::VREventObserver> >::NoIndex;
 } // namespace
 
@@ -476,27 +476,27 @@ VRManagerChild::RecvNotifyVRVSync(const 
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 VRManagerChild::RecvGamepadUpdate(const GamepadChangeEvent& aGamepadEvent)
 {
-#ifdef MOZ_GAMEPAD
+//#ifdef MOZ_GAMEPAD
   // VRManagerChild could be at other processes, but GamepadManager
   // only exists at the content process or the same process
   // in non-e10s mode.
   MOZ_ASSERT(XRE_IsContentProcess() || IsSameProcess());
 
   RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
   if (gamepadManager) {
     gamepadManager->Update(aGamepadEvent);
   }
-#endif
+//#endif
 
   return IPC_OK();
 }
 
 void
 VRManagerChild::RunFrameRequestCallbacks()
 {
   TimeStamp nowTime = TimeStamp::Now();
--- a/ipc/glue/BackgroundChildImpl.cpp
+++ b/ipc/glue/BackgroundChildImpl.cpp
@@ -19,20 +19,20 @@
 #include "mozilla/dom/PFileSystemRequestChild.h"
 #include "mozilla/dom/FileSystemTaskBase.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/ActorUtils.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
 #include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsChild.h"
 #include "mozilla/dom/ipc/BlobChild.h"
 #include "mozilla/dom/quota/PQuotaChild.h"
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/GamepadEventChannelChild.h"
 #include "mozilla/dom/GamepadTestChannelChild.h"
-#endif
+// #endif
 #include "mozilla/dom/MessagePortChild.h"
 #include "mozilla/ipc/PBackgroundTestChild.h"
 #include "mozilla/ipc/PSendStreamChild.h"
 #include "mozilla/layout/VsyncChild.h"
 #include "mozilla/net/PUDPSocketChild.h"
 #include "mozilla/dom/network/UDPSocketChild.h"
 #include "nsID.h"
 #include "nsTraceRefcnt.h"
@@ -476,39 +476,39 @@ BackgroundChildImpl::AllocPGamepadEventC
 {
   MOZ_CRASH("PGamepadEventChannelChild actor should be manually constructed!");
   return nullptr;
 }
 
 bool
 BackgroundChildImpl::DeallocPGamepadEventChannelChild(PGamepadEventChannelChild* aActor)
 {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   MOZ_ASSERT(aActor);
   delete static_cast<dom::GamepadEventChannelChild*>(aActor);
-#endif
+// #endif
   return true;
 }
 
 dom::PGamepadTestChannelChild*
 BackgroundChildImpl::AllocPGamepadTestChannelChild()
 {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   MOZ_CRASH("PGamepadTestChannelChild actor should be manually constructed!");
-#endif
+// #endif
   return nullptr;
 }
 
 bool
 BackgroundChildImpl::DeallocPGamepadTestChannelChild(PGamepadTestChannelChild* aActor)
 {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   MOZ_ASSERT(aActor);
   delete static_cast<dom::GamepadTestChannelChild*>(aActor);
-#endif
+// #endif
   return true;
 }
 
 } // namespace ipc
 } // namespace mozilla
 
 mozilla::ipc::IPCResult
 TestChild::Recv__delete__(const nsCString& aTestArg)
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -12,20 +12,20 @@
 #include "CamerasParent.h"
 #endif
 #include "mozilla/media/MediaParent.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/DOMTypes.h"
 #include "mozilla/dom/FileSystemBase.h"
 #include "mozilla/dom/FileSystemRequestParent.h"
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/GamepadEventChannelParent.h"
 #include "mozilla/dom/GamepadTestChannelParent.h"
-#endif
+// #endif
 #include "mozilla/dom/PBlobParent.h"
 #include "mozilla/dom/PGamepadEventChannelParent.h"
 #include "mozilla/dom/PGamepadTestChannelParent.h"
 #include "mozilla/dom/MessagePortParent.h"
 #include "mozilla/dom/ServiceWorkerRegistrar.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/ActorUtils.h"
 #include "mozilla/dom/indexedDB/ActorsParent.h"
@@ -901,58 +901,58 @@ BackgroundParentImpl::DeallocPFileSystem
     dont_AddRef(static_cast<FileSystemRequestParent*>(aDoomed));
   return true;
 }
 
 // Gamepad API Background IPC
 dom::PGamepadEventChannelParent*
 BackgroundParentImpl::AllocPGamepadEventChannelParent()
 {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   RefPtr<dom::GamepadEventChannelParent> parent =
     new dom::GamepadEventChannelParent();
 
   return parent.forget().take();
-#else
-  return nullptr;
-#endif
+// #else
+//   return nullptr;
+// #endif
 }
 
 bool
 BackgroundParentImpl::DeallocPGamepadEventChannelParent(dom::PGamepadEventChannelParent *aActor)
 {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   MOZ_ASSERT(aActor);
   RefPtr<dom::GamepadEventChannelParent> parent =
     dont_AddRef(static_cast<dom::GamepadEventChannelParent*>(aActor));
-#endif
+// #endif
   return true;
 }
 
 dom::PGamepadTestChannelParent*
 BackgroundParentImpl::AllocPGamepadTestChannelParent()
 {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   RefPtr<dom::GamepadTestChannelParent> parent =
     new dom::GamepadTestChannelParent();
 
   return parent.forget().take();
-#else
-  return nullptr;
-#endif
+// #else
+//   return nullptr;
+// #endif
 }
 
 bool
 BackgroundParentImpl::DeallocPGamepadTestChannelParent(dom::PGamepadTestChannelParent *aActor)
 {
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
   MOZ_ASSERT(aActor);
   RefPtr<dom::GamepadTestChannelParent> parent =
     dont_AddRef(static_cast<dom::GamepadTestChannelParent*>(aActor));
-#endif
+// #endif
   return true;
 }
 
 } // namespace ipc
 } // namespace mozilla
 
 void
 TestParent::ActorDestroy(ActorDestroyReason aWhy)
--- a/old-configure.in
+++ b/old-configure.in
@@ -3454,17 +3454,18 @@ dnl ====================================
 dnl Gamepad support
 dnl ========================================================
 MOZ_GAMEPAD=1
 MOZ_GAMEPAD_BACKEND=stub
 
 MOZ_ARG_DISABLE_BOOL(gamepad,
 [  --disable-gamepad   Disable gamepad support],
     MOZ_GAMEPAD=,
-    MOZ_GAMEPAD=1)
+    MOZ_GAMEPAD=1,
+    MOZ_GAMEPAD_BACKEND=stub)
 
 if test "$MOZ_GAMEPAD"; then
     case "$OS_TARGET" in
     Darwin)
         if test -z "$MOZ_IOS"; then
             MOZ_GAMEPAD_BACKEND=cocoa
         fi
         ;;
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -421,26 +421,26 @@ NS_EVENT_MESSAGE(eTimeChange)
 NS_EVENT_MESSAGE(eNetworkUpload)
 NS_EVENT_MESSAGE(eNetworkDownload)
 
 // MediaRecorder events.
 NS_EVENT_MESSAGE(eMediaRecorderDataAvailable)
 NS_EVENT_MESSAGE(eMediaRecorderWarning)
 NS_EVENT_MESSAGE(eMediaRecorderStop)
 
-#ifdef MOZ_GAMEPAD
+// #ifdef MOZ_GAMEPAD
 // Gamepad input events
 NS_EVENT_MESSAGE(eGamepadButtonDown)
 NS_EVENT_MESSAGE(eGamepadButtonUp)
 NS_EVENT_MESSAGE(eGamepadAxisMove)
 NS_EVENT_MESSAGE(eGamepadConnected)
 NS_EVENT_MESSAGE(eGamepadDisconnected)
 NS_EVENT_MESSAGE_FIRST_LAST(eGamepadEvent,
                             eGamepadButtonDown, eGamepadDisconnected)
-#endif
+// #endif
 
 // input and beforeinput events.
 NS_EVENT_MESSAGE(eEditorInput)
 
 // selection events
 NS_EVENT_MESSAGE(eSelectStart)
 NS_EVENT_MESSAGE(eSelectionChange)