Bug 968804 - Part g: Add outer window assertions to AreDialogsEnabled; r=peterv
authorMs2ger <ms2ger@gmail.com>
Tue, 20 May 2014 21:50:59 +0200
changeset 184012 c160e03f2a4fa9e45c2e61e1461c04804bfcc2c3
parent 184011 f0a563b325eb794f223a8c32a058c84587ae8a1f
child 184013 1f33b3c63929563634d86bc778c57c7a785c02a3
push id26810
push usercbook@mozilla.com
push dateWed, 21 May 2014 11:46:36 +0000
treeherdermozilla-central@50fb8c4db2fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs968804
milestone32.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 968804 - Part g: Add outer window assertions to AreDialogsEnabled; r=peterv
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3066,16 +3066,18 @@ nsGlobalWindow::ShouldPromptToBlockDialo
   }
 
   return topWindow->DialogsAreBeingAbused();
 }
 
 bool
 nsGlobalWindow::AreDialogsEnabled()
 {
+  MOZ_ASSERT(IsOuterWindow());
+
   nsGlobalWindow *topWindow = GetScriptableTop();
   if (!topWindow) {
     NS_ERROR("AreDialogsEnabled() called without a top window?");
     return false;
   }
 
   // TODO: Warn if no top window?
   topWindow = topWindow->GetCurrentInnerWindowInternal();
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -558,16 +558,17 @@ public:
   bool ShouldPromptToBlockDialogs();
   // Inner windows only.
   bool DialogsAreBeingAbused();
 
   // These functions are used for controlling and determining whether dialogs
   // (alert, prompt, confirm) are currently allowed in this window.
   void EnableDialogs();
   void DisableDialogs();
+  // Outer windows only.
   bool AreDialogsEnabled();
 
   nsIScriptContext *GetContextInternal()
   {
     if (mOuterWindow) {
       return GetOuterWindowInternal()->mContext;
     }