Bug 1489833 - Remove nsIWindowMediator::getZOrderDOMWindowEnumerator. r=bzbarsky
authorDão Gottwald <dao@mozilla.com>
Wed, 21 Nov 2018 16:56:10 +0000
changeset 503945 82dc18fb40a356de3fdc7832d8d1c1cb742466f4
parent 503944 bd685d374d7c190ade73eca68b4ceec521da350b
child 503946 e52cc97768090b2950a788912c62bea45505b96b
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1489833
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 1489833 - Remove nsIWindowMediator::getZOrderDOMWindowEnumerator. r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D12530
testing/marionette/modal.js
xpfe/appshell/nsAppShellWindowEnumerator.cpp
xpfe/appshell/nsAppShellWindowEnumerator.h
xpfe/appshell/nsIWindowMediator.idl
xpfe/appshell/nsWindowMediator.cpp
xpfe/appshell/nsWindowMediator.h
--- a/testing/marionette/modal.js
+++ b/testing/marionette/modal.js
@@ -58,19 +58,18 @@ modal.addHandler = function(handler) {
  * @return {modal.Dialog}
  *     Returns instance of the Dialog class, or `null` if no modal dialog
  *     is present.
  */
 modal.findModalDialogs = function(context) {
   // First check if there is a modal dialog already present for the
   // current browser window.
   for (let win of Services.wm.getEnumerator(null)) {
-    // Modal dialogs which do not have an opener set, we cannot detect
-    // as long as GetZOrderDOMWindowEnumerator doesn't work on Linux
-    // (Bug 156333).
+    // TODO: Use BrowserWindowTracker.getTopWindow for modal dialogs without
+    // an opener.
     if (win.document.documentURI === COMMON_DIALOG &&
         win.opener && win.opener === context.window) {
       return new modal.Dialog(() => context, Cu.getWeakReference(win));
     }
   }
 
   // If no modal dialog has been found, also check if there is an open
   // tab modal dialog present for the current tab.
--- a/xpfe/appshell/nsAppShellWindowEnumerator.cpp
+++ b/xpfe/appshell/nsAppShellWindowEnumerator.cpp
@@ -320,55 +320,16 @@ nsWindowInfo *nsASXULWindowEarlyToLateEn
       return info;
     info = info->mYounger;
   }
 
   return nullptr;
 }
 
 //
-// nsASDOMWindowFrontToBackEnumerator
-//
-
-nsASDOMWindowFrontToBackEnumerator::nsASDOMWindowFrontToBackEnumerator(
-    const char16_t *aTypeString,
-    nsWindowMediator &aMediator) :
-      nsASDOMWindowEnumerator(aTypeString, aMediator)
-{
-  mCurrentPosition = aMediator.mTopmostWindow;
-  AdjustInitialPosition();
-}
-
-nsASDOMWindowFrontToBackEnumerator::~nsASDOMWindowFrontToBackEnumerator()
-{
-}
-
-nsWindowInfo *nsASDOMWindowFrontToBackEnumerator::FindNext()
-{
-  nsWindowInfo *info,
-               *listEnd;
-  bool          allWindows = mType.IsEmpty();
-
-  // see nsXULWindowEarlyToLateEnumerator::FindNext
-  if (!mCurrentPosition)
-    return nullptr;
-
-  info = mCurrentPosition->mLower;
-  listEnd = mWindowMediator->mTopmostWindow;
-
-  while (info != listEnd) {
-    if (allWindows || info->TypeEquals(mType))
-      return info;
-    info = info->mLower;
-  }
-
-  return nullptr;
-}
-
-//
 // nsASXULWindowFrontToBackEnumerator
 //
 
 nsASXULWindowFrontToBackEnumerator::nsASXULWindowFrontToBackEnumerator(
     const char16_t *aTypeString,
     nsWindowMediator &aMediator) :
       nsASXULWindowEnumerator(aTypeString, aMediator)
 {
@@ -398,58 +359,16 @@ nsWindowInfo *nsASXULWindowFrontToBackEn
       return info;
     info = info->mLower;
   }
 
   return nullptr;
 }
 
 //
-// nsASDOMWindowBackToFrontEnumerator
-//
-
-nsASDOMWindowBackToFrontEnumerator::nsASDOMWindowBackToFrontEnumerator(
-    const char16_t *aTypeString,
-    nsWindowMediator &aMediator) :
-  nsASDOMWindowEnumerator(aTypeString, aMediator)
-{
-  mCurrentPosition = aMediator.mTopmostWindow ?
-                     aMediator.mTopmostWindow->mHigher : nullptr;
-  AdjustInitialPosition();
-}
-
-nsASDOMWindowBackToFrontEnumerator::~nsASDOMWindowBackToFrontEnumerator()
-{
-}
-
-nsWindowInfo *nsASDOMWindowBackToFrontEnumerator::FindNext()
-{
-  nsWindowInfo *info,
-               *listEnd;
-  bool          allWindows = mType.IsEmpty();
-
-  // see nsXULWindowEarlyToLateEnumerator::FindNext
-  if (!mCurrentPosition)
-    return nullptr;
-
-  info = mCurrentPosition->mHigher;
-  listEnd = mWindowMediator->mTopmostWindow;
-  if (listEnd)
-    listEnd = listEnd->mHigher;
-
-  while (info != listEnd) {
-    if (allWindows || info->TypeEquals(mType))
-      return info;
-    info = info->mHigher;
-  }
-
-  return nullptr;
-}
-
-//
 // nsASXULWindowBackToFrontEnumerator
 //
 
 nsASXULWindowBackToFrontEnumerator::nsASXULWindowBackToFrontEnumerator(
     const char16_t *aTypeString,
     nsWindowMediator &aMediator) :
       nsASXULWindowEnumerator(aTypeString, aMediator)
 {
--- a/xpfe/appshell/nsAppShellWindowEnumerator.h
+++ b/xpfe/appshell/nsAppShellWindowEnumerator.h
@@ -110,52 +110,28 @@ public:
                                      nsWindowMediator& inMediator);
 
   virtual ~nsASXULWindowEarlyToLateEnumerator();
 
 protected:
   virtual nsWindowInfo *FindNext() override;
 };
 
-class nsASDOMWindowFrontToBackEnumerator : public nsASDOMWindowEnumerator {
-
-public:
-  nsASDOMWindowFrontToBackEnumerator(const char16_t* aTypeString,
-                                     nsWindowMediator& inMediator);
-
-  virtual ~nsASDOMWindowFrontToBackEnumerator();
-
-protected:
-  virtual nsWindowInfo *FindNext() override;
-};
-
 class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator {
 
 public:
   nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString,
                                      nsWindowMediator& inMediator);
 
   virtual ~nsASXULWindowFrontToBackEnumerator();
 
 protected:
   virtual nsWindowInfo *FindNext() override;
 };
 
-class nsASDOMWindowBackToFrontEnumerator : public nsASDOMWindowEnumerator {
-
-public:
-  nsASDOMWindowBackToFrontEnumerator(const char16_t* aTypeString,
-                                     nsWindowMediator& inMediator);
-
-  virtual ~nsASDOMWindowBackToFrontEnumerator();
-
-protected:
-  virtual nsWindowInfo *FindNext() override;
-};
-
 class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator {
 
 public:
   nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString,
                                      nsWindowMediator& inMediator);
 
   virtual ~nsASXULWindowBackToFrontEnumerator();
 
--- a/xpfe/appshell/nsIWindowMediator.idl
+++ b/xpfe/appshell/nsIWindowMediator.idl
@@ -46,22 +46,16 @@ interface nsIWindowMediator: nsISupports
     * no requirement that a window couldn't be revisited if windows
     * are re-ordered while z-order enumerators are active.
     * @param  aWindowType the returned enumerator will enumerate only
     *                     windows of this type. ("type" is the
     *                     |windowtype| attribute of the XML <window> element.)
     *                     If null, all windows will be enumerated.
     * @param  aFrontToBack if true, the enumerator enumerates windows in order
     *                      from front to back. back to front if false.
-    * @return an enumerator of nsIDOMWindows
-    */
-  nsISimpleEnumerator getZOrderDOMWindowEnumerator(in wstring aWindowType,
-                        in boolean aFrontToBack);
-
-  /** Identical to getZOrderDOMWindowEnumerator except:
     * @return an enumerator of nsIXULWindows
     */
   nsISimpleEnumerator getZOrderXULWindowEnumerator(in wstring aWindowType,
                         in boolean aFrontToBack);
 
   /** This is a shortcut for simply fetching the first window in
     * front to back order.
     * @param  aWindowType return the topmost window of this type.
--- a/xpfe/appshell/nsWindowMediator.cpp
+++ b/xpfe/appshell/nsWindowMediator.cpp
@@ -200,35 +200,16 @@ nsWindowMediator::GetXULWindowEnumerator
   NS_ENSURE_STATE(mReady);
 
   RefPtr<nsAppShellWindowEnumerator> enumerator = new nsASXULWindowEarlyToLateEnumerator(inType, *this);
   enumerator.forget(outEnumerator);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::GetZOrderDOMWindowEnumerator(
-            const char16_t *aWindowType, bool aFrontToBack,
-            nsISimpleEnumerator **_retval)
-{
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-  NS_ENSURE_ARG_POINTER(_retval);
-  NS_ENSURE_STATE(mReady);
-
-  RefPtr<nsAppShellWindowEnumerator> enumerator;
-  if (aFrontToBack)
-    enumerator = new nsASDOMWindowFrontToBackEnumerator(aWindowType, *this);
-  else
-    enumerator = new nsASDOMWindowBackToFrontEnumerator(aWindowType, *this);
-
-  enumerator.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsWindowMediator::GetZOrderXULWindowEnumerator(
             const char16_t *aWindowType, bool aFrontToBack,
             nsISimpleEnumerator **_retval)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_ARG_POINTER(_retval);
   NS_ENSURE_STATE(mReady);
 
--- a/xpfe/appshell/nsWindowMediator.h
+++ b/xpfe/appshell/nsWindowMediator.h
@@ -12,34 +12,30 @@
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
 #include "nsTObserverArray.h"
 
 class nsAppShellWindowEnumerator;
 class nsASXULWindowEarlyToLateEnumerator;
 class nsASDOMWindowEarlyToLateEnumerator;
-class nsASDOMWindowFrontToBackEnumerator;
 class nsASXULWindowFrontToBackEnumerator;
-class nsASDOMWindowBackToFrontEnumerator;
 class nsASXULWindowBackToFrontEnumerator;
 class nsIWindowMediatorListener;
 struct nsWindowInfo;
 
 class nsWindowMediator :
   public nsIWindowMediator,
   public nsIObserver,
   public nsSupportsWeakReference
 {
 friend class nsAppShellWindowEnumerator;
 friend class nsASXULWindowEarlyToLateEnumerator;
 friend class nsASDOMWindowEarlyToLateEnumerator;
-friend class nsASDOMWindowFrontToBackEnumerator;
 friend class nsASXULWindowFrontToBackEnumerator;
-friend class nsASDOMWindowBackToFrontEnumerator;
 friend class nsASXULWindowBackToFrontEnumerator;
 
 protected:
   virtual ~nsWindowMediator();
 
 public:
   nsWindowMediator();