Bug 775041 - Make nsIWidget::IsEnabled return bool, r=roc, f=ms2ger
authorMark Capella <markcapella@twcny.rr.com>
Mon, 23 Jul 2012 01:19:08 -0400
changeset 105575 3bc4b4396d75f6ef4564be60189a82dc78c8a53f
parent 105572 058d3e6887cd5901ca62c423be49248950d6f472
child 105576 afd216efe5225955ac678b45771ef1284622c5bb
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs775041
milestone17.0a1
Bug 775041 - Make nsIWidget::IsEnabled return bool, r=roc, f=ms2ger
content/events/src/nsEventStateManager.cpp
dom/plugins/base/nsPluginHost.cpp
embedding/browser/webBrowser/nsWebBrowser.cpp
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
widget/gonk/nsWindow.cpp
widget/gonk/nsWindow.h
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
widget/nsIWidget.h
widget/os2/nsWindow.cpp
widget/os2/nsWindow.h
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/windows/nsNativeDragTarget.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/xpwidgets/PuppetWidget.h
xpfe/appshell/src/nsXULWindow.cpp
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -4489,22 +4489,18 @@ nsEventStateManager::CheckForAndDispatch
   nsresult ret = NS_OK;
   PRInt32 flags = NS_EVENT_FLAG_NONE;
 
   //If mouse is still over same element, clickcount will be > 1.
   //If it has moved it will be zero, so no click.
   if (0 != aEvent->clickCount) {
     //Check that the window isn't disabled before firing a click
     //(see bug 366544).
-    if (aEvent->widget) {
-      bool enabled;
-      aEvent->widget->IsEnabled(&enabled);
-      if (!enabled) {
-        return ret;
-      }
+    if (aEvent->widget && !aEvent->widget->IsEnabled()) {
+      return ret;
     }
     //fire click
     if (aEvent->button == nsMouseEvent::eMiddleButton ||
         aEvent->button == nsMouseEvent::eRightButton) {
       flags |=
         sLeftClickOnly ? NS_EVENT_FLAG_NO_CONTENT_DISPATCH : NS_EVENT_FLAG_NONE;
     }
 
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -3864,23 +3864,22 @@ CheckForDisabledWindows()
     windowList->HasMoreElements(&haveWindows);
     if (!haveWindows)
       return;
 
     nsCOMPtr<nsISupports> supportsWindow;
     windowList->GetNext(getter_AddRefs(supportsWindow));
     nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(supportsWindow));
     if (baseWin) {
-      bool aFlag;
       nsCOMPtr<nsIWidget> widget;
       baseWin->GetMainWidget(getter_AddRefs(widget));
       if (widget && !widget->GetParent() &&
           widget->IsVisible() &&
-          NS_SUCCEEDED(widget->IsEnabled(&aFlag)) && aFlag == false) {
-        nsIWidget * child = widget->GetFirstChild();
+          !widget->IsEnabled()) {
+        nsIWidget* child = widget->GetFirstChild();
         bool enable = true;
         while (child)  {
           nsWindowType aType;
           if (NS_SUCCEEDED(child->GetWindowType(aType)) &&
               aType == eWindowType_dialog) {
             enable = false;
             break;
           }
--- a/embedding/browser/webBrowser/nsWebBrowser.cpp
+++ b/embedding/browser/webBrowser/nsWebBrowser.cpp
@@ -1399,20 +1399,23 @@ NS_IMETHODIMP nsWebBrowser::SetVisibilit
       NS_ENSURE_SUCCESS(mDocShellAsWin->SetVisibility(aVisibility), NS_ERROR_FAILURE);
       if(mInternalWidget)
          mInternalWidget->Show(aVisibility);
       }
 
    return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetEnabled(bool *aEnabled)
+NS_IMETHODIMP nsWebBrowser::GetEnabled(bool* aEnabled)
 {
-  if (mInternalWidget)
-    return mInternalWidget->IsEnabled(aEnabled);
+  if (mInternalWidget) {
+    *aEnabled = mInternalWidget->IsEnabled();
+    return NS_OK;
+  }
+
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsWebBrowser::SetEnabled(bool aEnabled)
 {
   if (mInternalWidget)
     return mInternalWidget->Enable(aEnabled);
   return NS_ERROR_FAILURE;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -490,21 +490,20 @@ nsWindow::SetSizeMode(PRInt32 aMode)
 
 NS_IMETHODIMP
 nsWindow::Enable(bool aState)
 {
     ALOG("nsWindow[%p]::Enable %d ignored", (void*)this, aState);
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsWindow::IsEnabled(bool *aState)
+bool
+nsWindow::IsEnabled() const
 {
-    *aState = true;
-    return NS_OK;
+    return true;
 }
 
 NS_IMETHODIMP
 nsWindow::Invalidate(const nsIntRect &aRect)
 {
     AndroidGeckoEvent *event = new AndroidGeckoEvent(AndroidGeckoEvent::DRAW, aRect);
     nsAppShell::gAppShell->PostEvent(event);
     return NS_OK;
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -91,17 +91,17 @@ public:
                       PRInt32 aHeight,
                       bool aRepaint);
     NS_IMETHOD SetZIndex(PRInt32 aZIndex);
     NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
                            nsIWidget *aWidget,
                            bool aActivate);
     NS_IMETHOD SetSizeMode(PRInt32 aMode);
     NS_IMETHOD Enable(bool aState);
-    NS_IMETHOD IsEnabled(bool *aState);
+    virtual bool IsEnabled() const;
     NS_IMETHOD Invalidate(const nsIntRect &aRect);
     NS_IMETHOD SetFocus(bool aRaise = false);
     NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
     virtual nsIntPoint WidgetToScreenOffset();
     NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &aStatus);
     nsEventStatus DispatchEvent(nsGUIEvent *aEvent);
     NS_IMETHOD MakeFullScreen(bool aFullScreen);
     NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -403,17 +403,17 @@ public:
 
   NS_IMETHOD              ConstrainPosition(bool aAllowSlop,
                                             PRInt32 *aX, PRInt32 *aY);
   NS_IMETHOD              Move(PRInt32 aX, PRInt32 aY);
   NS_IMETHOD              Resize(PRInt32 aWidth,PRInt32 aHeight, bool aRepaint);
   NS_IMETHOD              Resize(PRInt32 aX, PRInt32 aY,PRInt32 aWidth,PRInt32 aHeight, bool aRepaint);
 
   NS_IMETHOD              Enable(bool aState);
-  NS_IMETHOD              IsEnabled(bool *aState);
+  virtual bool            IsEnabled() const;
   NS_IMETHOD              SetFocus(bool aRaise);
   NS_IMETHOD              GetBounds(nsIntRect &aRect);
 
   NS_IMETHOD              Invalidate(const nsIntRect &aRect);
 
   virtual void*           GetNativeData(PRUint32 aDataType);
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
   virtual nsIntPoint      WidgetToScreenOffset();
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -743,22 +743,19 @@ nsChildView::GetDPI()
   return 96.0;
 }
 
 NS_IMETHODIMP nsChildView::Enable(bool aState)
 {
   return NS_OK;
 }
 
-NS_IMETHODIMP nsChildView::IsEnabled(bool *aState)
-{
-  // unimplemented
-  if (aState)
-   *aState = true;
-  return NS_OK;
+bool nsChildView::IsEnabled() const
+{
+  return true;
 }
 
 NS_IMETHODIMP nsChildView::SetFocus(bool aRaise)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   NSWindow* window = [mView window];
   if (window)
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -207,17 +207,17 @@ public:
                                    nsDeviceContext *aContext,
                                    nsWidgetInitData *aInitData = nsnull);
 
     NS_IMETHOD              Destroy();
 
     NS_IMETHOD              Show(bool aState);
     virtual nsIWidget*      GetSheetWindowParent(void);
     NS_IMETHOD              Enable(bool aState);
-    NS_IMETHOD              IsEnabled(bool *aState);
+    virtual bool            IsEnabled() const;
     NS_IMETHOD              SetModal(bool aState);
     virtual bool            IsVisible() const;
     NS_IMETHOD              SetFocus(bool aState=false);
     virtual nsIntPoint WidgetToScreenOffset();
     virtual nsIntPoint GetClientOffset();
     virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize);
 
     virtual void* GetNativeData(PRUint32 aDataType) ;
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -1006,21 +1006,19 @@ void nsCocoaWindow::SetTransparencyMode(
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 NS_IMETHODIMP nsCocoaWindow::Enable(bool aState)
 {
   return NS_OK;
 }
 
-NS_IMETHODIMP nsCocoaWindow::IsEnabled(bool *aState)
+bool nsCocoaWindow::IsEnabled() const
 {
-  if (aState)
-    *aState = true;
-  return NS_OK;
+  return true;
 }
 
 #define kWindowPositionSlop 20
 
 NS_IMETHODIMP nsCocoaWindow::ConstrainPosition(bool aAllowSlop,
                                                PRInt32 *aX, PRInt32 *aY)
 {
   if (!mWindow || ![mWindow screen]) {
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -384,21 +384,20 @@ nsWindow::Resize(PRInt32 aX,
 }
 
 NS_IMETHODIMP
 nsWindow::Enable(bool aState)
 {
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsWindow::IsEnabled(bool *aState)
+bool
+nsWindow::IsEnabled() const
 {
-    *aState = true;
-    return NS_OK;
+    return true;
 }
 
 NS_IMETHODIMP
 nsWindow::SetFocus(bool aRaise)
 {
     if (aRaise)
         BringToTop();
 
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -67,17 +67,17 @@ public:
                       PRInt32 aHeight,
                       bool  aRepaint);
     NS_IMETHOD Resize(PRInt32 aX,
                       PRInt32 aY,
                       PRInt32 aWidth,
                       PRInt32 aHeight,
                       bool aRepaint);
     NS_IMETHOD Enable(bool aState);
-    NS_IMETHOD IsEnabled(bool *aState);
+    virtual bool IsEnabled() const;
     NS_IMETHOD SetFocus(bool aRaise = false);
     NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
     NS_IMETHOD Invalidate(const nsIntRect &aRect);
     virtual void* GetNativeData(PRUint32 aDataType);
     NS_IMETHOD SetTitle(const nsAString& aTitle)
     {
         return NS_OK;
     }
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -1143,22 +1143,20 @@ nsWindow::Resize(PRInt32 aX, PRInt32 aY,
 NS_IMETHODIMP
 nsWindow::Enable(bool aState)
 {
     mEnabled = aState;
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsWindow::IsEnabled(bool *aState)
-{
-    *aState = mEnabled;
-
-    return NS_OK;
+bool
+nsWindow::IsEnabled() const
+{
+    return mEnabled;
 }
 
 
 
 NS_IMETHODIMP
 nsWindow::Move(PRInt32 aX, PRInt32 aY)
 {
     LOG(("nsWindow::Move [%p] %d %d\n", (void *)this,
--- a/widget/gtk2/nsWindow.h
+++ b/widget/gtk2/nsWindow.h
@@ -117,17 +117,17 @@ public:
     NS_IMETHOD         Resize           (PRInt32 aWidth,
                                          PRInt32 aHeight,
                                          bool    aRepaint);
     NS_IMETHOD         Resize           (PRInt32 aX,
                                          PRInt32 aY,
                                          PRInt32 aWidth,
                                          PRInt32 aHeight,
                                          bool     aRepaint);
-    NS_IMETHOD         IsEnabled        (bool *aState);
+    virtual bool       IsEnabled() const;
 
 
     NS_IMETHOD         PlaceBehind(nsTopLevelWidgetZPlacement  aPlacement,
                                    nsIWidget                  *aWidget,
                                    bool                        aActivate);
     NS_IMETHOD         SetZIndex(PRInt32 aZIndex);
     NS_IMETHOD         SetSizeMode(PRInt32 aMode);
     NS_IMETHOD         Enable(bool aState);
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -82,18 +82,18 @@ typedef nsEventStatus (* EVENT_CALLBACK)
 #endif
 #ifdef XP_WIN
 #define NS_NATIVE_TSF_THREAD_MGR       100
 #define NS_NATIVE_TSF_CATEGORY_MGR     101
 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
 #endif
 
 #define NS_IWIDGET_IID \
-  { 0x7c7ff2ff, 0x61f9, 0x4240, \
-    { 0xaa, 0x58, 0x74, 0xb0, 0xcd, 0xa9, 0xe3, 0x05 } }
+  { 0x97afe930, 0x72d7, 0x4d95, \
+    { 0x88, 0x5f, 0x37, 0x09, 0x14, 0x2a, 0xf4, 0xe2 } }
 
 /*
  * Window shadow styles
  * Also used for the -moz-window-shadow CSS property
  */
 
 #define NS_STYLE_WINDOW_SHADOW_NONE             0
 #define NS_STYLE_WINDOW_SHADOW_DEFAULT          1
@@ -761,19 +761,18 @@ class nsIWidget : public nsISupports {
      *
      * @param aState true to enable the Widget, false to disable it.
      *
      */
     NS_IMETHOD Enable(bool aState) = 0;
 
     /**
      * Ask whether the widget is enabled
-     * @param aState returns true if the widget is enabled
      */
-    NS_IMETHOD IsEnabled(bool *aState) = 0;
+    virtual bool IsEnabled() const = 0;
 
     /**
      * Request activation of this window or give focus to this widget.
      *
      * @param aRaise If true, this function requests activation of this
      *               widget's toplevel window.
      *               If false, the appropriate toplevel window (which in
      *               the case of popups may not be this widget's toplevel
--- a/widget/os2/nsWindow.cpp
+++ b/widget/os2/nsWindow.cpp
@@ -560,22 +560,20 @@ NS_METHOD nsWindow::Enable(bool aState)
   if (hMain) {
     WinEnableWindow(hMain, aState);
   }
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
-NS_METHOD nsWindow::IsEnabled(bool* aState)
+bool nsWindow::IsEnabled() const
 {
-  NS_ENSURE_ARG_POINTER(aState);
   HWND hMain = GetMainWindow();
-  *aState = !hMain || WinIsWindowEnabled(hMain);
-  return NS_OK;
+  return !hMain || WinIsWindowEnabled(hMain);
 }
 
 //-----------------------------------------------------------------------------
 
 NS_METHOD nsWindow::Show(bool aState)
 {
   if (mFrame) {
     return mFrame->Show(aState);
--- a/widget/os2/nsWindow.h
+++ b/widget/os2/nsWindow.h
@@ -133,17 +133,17 @@ public:
                                const nsIntRect& aRect,
                                EVENT_CALLBACK aHandleEventFunction,
                                nsDeviceContext* aContext,
                                nsWidgetInitData* aInitData = nsnull);
   NS_IMETHOD            Destroy();
   virtual nsIWidget*    GetParent();
   virtual float         GetDPI();
   NS_IMETHOD            Enable(bool aState);
-  NS_IMETHOD            IsEnabled(bool* aState);
+  virtual bool          IsEnabled() const;
   NS_IMETHOD            Show(bool aState);
   virtual bool          IsVisible() const;
   NS_IMETHOD            SetFocus(bool aRaise);
   NS_IMETHOD            Invalidate(const nsIntRect& aRect);
   gfxASurface*          GetThebesSurface();
   virtual void*         GetNativeData(PRUint32 aDataType);
   virtual void          FreeNativeData(void* aDatum, PRUint32 aDataType);
   NS_IMETHOD            CaptureMouse(bool aCapture);
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -3081,22 +3081,20 @@ nsWindow::Resize(PRInt32 aX, PRInt32 aY,
 NS_IMETHODIMP
 nsWindow::Enable(bool aState)
 {
     mEnabled = aState;
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsWindow::IsEnabled(bool *aState)
+bool
+nsWindow::IsEnabled() const
 {
-    *aState = mEnabled;
-
-    return NS_OK;
+    return mEnabled;
 }
 
 void
 nsWindow::OnDestroy(void)
 {
     if (mOnDestroyCalled)
         return;
 
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -183,17 +183,17 @@ public:
 
     nsEventStatus DispatchEvent(nsGUIEvent *aEvent) {
         nsEventStatus status;
         DispatchEvent(aEvent, status);
         return status;
     }
 
     // Some of the nsIWidget methods
-    NS_IMETHOD         IsEnabled        (bool *aState);
+    virtual bool IsEnabled() const;
 
     // called when we are destroyed
     void OnDestroy(void);
 
     // called to check and see if a widget's dimensions are sane
     bool AreBoundsSane(void);
 
     NS_IMETHOD         ReparentNativeWidget(nsIWidget* aNewParent);
--- a/widget/windows/nsNativeDragTarget.cpp
+++ b/widget/windows/nsNativeDragTarget.cpp
@@ -92,18 +92,17 @@ STDMETHODIMP_(ULONG) nsNativeDragTarget:
 }
 
 void
 nsNativeDragTarget::GetGeckoDragAction(DWORD grfKeyState, LPDWORD pdwEffect,
                                        PRUint32 * aGeckoAction)
 {
   // If a window is disabled or a modal window is on top of it
   // (which implies it is disabled), then we should not allow dropping.
-  bool isEnabled;
-  if (NS_SUCCEEDED(mWindow->IsEnabled(&isEnabled)) && !isEnabled) {
+  if (!mWindow->IsEnabled()) {
     *pdwEffect = DROPEFFECT_NONE;
     *aGeckoAction = nsIDragService::DRAGDROP_ACTION_NONE;
     return;
   }
 
   // If the user explicitly uses a modifier key, they want the associated action
   // Shift + Control -> LINK, Shift -> MOVE, Ctrl -> COPY
   DWORD desiredEffect = DROPEFFECT_NONE;
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1680,21 +1680,21 @@ NS_METHOD nsWindow::Enable(bool bState)
 {
   if (mWnd) {
     ::EnableWindow(mWnd, bState);
   }
   return NS_OK;
 }
 
 // Return the current enable state
-NS_METHOD nsWindow::IsEnabled(bool *aState)
-{
-  NS_ENSURE_ARG_POINTER(aState);
-  *aState = !mWnd || (::IsWindowEnabled(mWnd) && ::IsWindowEnabled(::GetAncestor(mWnd, GA_ROOT)));
-  return NS_OK;
+bool nsWindow::IsEnabled() const
+{
+  return !mWnd ||
+         (::IsWindowEnabled(mWnd) &&
+          ::IsWindowEnabled(::GetAncestor(mWnd, GA_ROOT)));
 }
 
 
 /**************************************************************
  *
  * SECTION: nsIWidget::SetFocus
  *
  * Give the focus to this widget.
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -96,17 +96,17 @@ public:
   NS_IMETHOD              ConstrainPosition(bool aAllowSlop, PRInt32 *aX, PRInt32 *aY);
   NS_IMETHOD              Move(PRInt32 aX, PRInt32 aY);
   NS_IMETHOD              Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
   NS_IMETHOD              Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint);
   NS_IMETHOD              BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
   NS_IMETHOD              PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
   NS_IMETHOD              SetSizeMode(PRInt32 aMode);
   NS_IMETHOD              Enable(bool aState);
-  NS_IMETHOD              IsEnabled(bool *aState);
+  virtual bool            IsEnabled() const;
   NS_IMETHOD              SetFocus(bool aRaise);
   NS_IMETHOD              GetBounds(nsIntRect &aRect);
   NS_IMETHOD              GetScreenBounds(nsIntRect &aRect);
   NS_IMETHOD              GetClientBounds(nsIntRect &aRect);
   virtual nsIntPoint      GetClientOffset();
   NS_IMETHOD              SetBackgroundColor(const nscolor &aColor);
   NS_IMETHOD              SetCursor(imgIContainer* aCursor,
                                     PRUint32 aHotspotX, PRUint32 aHotspotY);
--- a/widget/xpwidgets/PuppetWidget.h
+++ b/widget/xpwidgets/PuppetWidget.h
@@ -87,18 +87,18 @@ public:
                     bool    aRepaint)
   // (we're always at <0, 0>)
   { return Resize(aWidth, aHeight, aRepaint); }
 
   // XXX/cjones: copying gtk behavior here; unclear what disabling a
   // widget is supposed to entail
   NS_IMETHOD Enable(bool aState)
   { mEnabled = aState;  return NS_OK; }
-  NS_IMETHOD IsEnabled(bool *aState)
-  { *aState = mEnabled;  return NS_OK; }
+  virtual bool IsEnabled() const
+  { return mEnabled; }
 
   NS_IMETHOD SetFocus(bool aRaise = false);
 
   // PuppetWidgets don't care about children.
   virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
   { return NS_OK; }
 
   NS_IMETHOD Invalidate(const nsIntRect& aRect);
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -787,18 +787,21 @@ NS_IMETHODIMP nsXULWindow::SetVisibility
 
   mDebuting = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::GetEnabled(bool *aEnabled)
 {
   NS_ENSURE_ARG_POINTER(aEnabled);
-  if (mWindow)
-    return mWindow->IsEnabled(aEnabled);
+
+  if (mWindow) {
+    *aEnabled = mWindow->IsEnabled();
+    return NS_OK;
+  }
 
   *aEnabled = true; // better guess than most
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsXULWindow::SetEnabled(bool aEnable)
 {
   if (mWindow) {