Bug 933483 - Add nsPIDOMWindow::IsCurrentInnerWindow. r=smaug, a=koi+
authorPeter Van der Beken <peterv@propagandism.org>
Fri, 06 Dec 2013 08:42:20 -0500
changeset 156904 f9f4be5e803694031f1d23ebf8a3b41173f5e0c1
parent 156903 377fafeead5c83600e1d8e63741d15848a70bec1
child 156905 c5eda4db2804e412a69888d20d7078043abf0bce
push id377
push userryanvm@gmail.com
push dateWed, 18 Dec 2013 15:38:18 +0000
reviewerssmaug, koi
bugs933483
milestone26.0
Bug 933483 - Add nsPIDOMWindow::IsCurrentInnerWindow. r=smaug, a=koi+
dom/base/nsPIDOMWindow.h
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -313,16 +313,25 @@ public:
     return GetCurrentInnerWindow();
   }
 
   bool IsInnerWindow() const
   {
     return mIsInnerWindow;
   }
 
+  // Returns true if this object has an outer window and it is the current inner
+  // window of that outer. Only call this on inner windows.
+  bool IsCurrentInnerWindow() const
+  {
+    MOZ_ASSERT(IsInnerWindow(),
+               "It doesn't make sense to call this on outer windows.");
+    return mOuterWindow && mOuterWindow->GetCurrentInnerWindow() == this;
+  }
+
   bool IsOuterWindow() const
   {
     return !IsInnerWindow();
   }
 
   virtual bool WouldReuseInnerWindow(nsIDocument *aNewDocument) = 0;
 
   /**