Bug 1507604 - Remove nsPIDOMWindowInner::IsTopLevelWindowActive. r=smaug
authorPeter Van der Beken <peterv@propagandism.org>
Fri, 23 Nov 2018 15:33:11 +0000
changeset 507077 d3b2f0ffd271be0cabd75935b96d7830ec553792
parent 507076 8546188a9614899fadf3adf8021b85547f571650
child 507078 e6e6b6137c7df9358d4c1764ee07b688a8c72de3
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1507604
milestone65.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 1507604 - Remove nsPIDOMWindowInner::IsTopLevelWindowActive. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D12141
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowInner.h
dom/base/nsPIDOMWindow.h
dom/system/nsDeviceSensors.cpp
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -4395,25 +4395,16 @@ nsGlobalWindowInner::GetLocation()
 {
   if (!mLocation) {
     mLocation = new dom::Location(this, GetDocShell());
   }
 
   return mLocation;
 }
 
-bool
-nsGlobalWindowInner::IsTopLevelWindowActive()
-{
-  if (GetOuterWindowInternal()) {
-    return GetOuterWindowInternal()->IsTopLevelWindowActive();
-  }
-  return false;
-}
-
 void
 nsGlobalWindowInner::MaybeUpdateTouchState()
 {
   if (mMayHaveTouchEventListener) {
     nsCOMPtr<nsIObserverService> observerService =
       services::GetObserverService();
 
     if (observerService) {
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -334,19 +334,16 @@ public:
   bool DispatchEvent(mozilla::dom::Event& aEvent,
                      mozilla::dom::CallerType aCallerType,
                      mozilla::ErrorResult& aRv) override;
 
   void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
 
   nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override;
 
-  // Outer windows only.
-  virtual bool IsTopLevelWindowActive() override;
-
   virtual PopupControlState GetPopupControlState() const override;
 
   void Suspend();
   void Resume();
   virtual bool IsSuspended() const override;
 
   // Calling Freeze() on a window will automatically Suspend() it.  In
   // addition, the window and its children are further treated as no longer
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -366,18 +366,16 @@ public:
     return mChromeEventHandler;
   }
 
   virtual nsresult RegisterIdleObserver(
     mozilla::dom::MozIdleObserver& aIdleObserver) = 0;
   virtual nsresult UnregisterIdleObserver(
     mozilla::dom::MozIdleObserver& aIdleObserver) = 0;
 
-  virtual bool IsTopLevelWindowActive() = 0;
-
   mozilla::dom::EventTarget* GetParentTarget()
   {
     if (!mParentTarget) {
       UpdateParentTarget();
     }
     return mParentTarget;
   }
 
--- a/dom/system/nsDeviceSensors.cpp
+++ b/dom/system/nsDeviceSensors.cpp
@@ -241,18 +241,19 @@ NS_IMETHODIMP nsDeviceSensors::RemoveWin
 static bool
 WindowCannotReceiveSensorEvent (nsPIDOMWindowInner* aWindow)
 {
   // Check to see if this window is in the background.
   if (!aWindow || !aWindow->IsCurrentInnerWindow()) {
     return true;
   }
 
-  bool disabled = aWindow->GetOuterWindow()->IsBackground() ||
-    !aWindow->IsTopLevelWindowActive();
+  nsPIDOMWindowOuter* windowOuter = aWindow->GetOuterWindow();
+  bool disabled = windowOuter->IsBackground() ||
+    !windowOuter->IsTopLevelWindowActive();
   if (disabled) {
     return true;
   }
 
   // Check to see if this window is a cross-origin iframe
   nsCOMPtr<nsPIDOMWindowOuter> top = aWindow->GetScriptableTop();
   nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
   nsCOMPtr<nsIScriptObjectPrincipal> topSop = do_QueryInterface(top);