diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 561c3f975e20..4c9a7009caa2 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -80,7 +80,6 @@ class nsIObserver; class nsISupportsArray; class nsIScriptLoader; class nsString; -class nsIFocusController; class nsIContentSink; // IID for the nsIDocument interface @@ -302,14 +301,6 @@ public: */ NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader) = 0; - /** - * Get the focus controller for this document - * This can usually be gotten through the ScriptGlobalObject, but - * it is set to null during document destruction, when we still might - * need to fire focus events. - */ - NS_IMETHOD GetFocusController(nsIFocusController** aFocusController) = 0; - //---------------------------------------------------------------------- // Document notification API's diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 903bf2b8f215..83c403ccca54 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -119,7 +119,6 @@ #include "nsIDOMWindowInternal.h" #include "nsPIDOMWindow.h" -#include "nsIFocusController.h" #include "nsIDOMElement.h" #include "nsIBoxObject.h" @@ -1724,6 +1723,16 @@ nsDocument::GetScriptGlobalObject(nsIScriptGlobalObject** aScriptGlobalObject) { NS_ENSURE_ARG_POINTER(aScriptGlobalObject); + // If we're going away, we've already released the reference to our + // ScriptGlobalObject. We can, however, try to obtain it for the + // caller through our docshell. + + if (mIsGoingAway) { + nsCOMPtr requestor = do_QueryReferent(mDocumentContainer); + if (requestor) + return CallGetInterface(requestor.get(), aScriptGlobalObject); + } + *aScriptGlobalObject = mScriptGlobalObject; NS_IF_ADDREF(*aScriptGlobalObject); return NS_OK; @@ -1770,31 +1779,12 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject) #endif mContentWrapperHash.Reset(); - } else if (aScriptGlobalObject != mScriptGlobalObject) { - // Update our weak ref to the focus controller - nsCOMPtr domPrivate = do_QueryInterface(aScriptGlobalObject); - if (domPrivate) { - nsCOMPtr fc; - domPrivate->GetRootFocusController(getter_AddRefs(fc)); - mFocusController = getter_AddRefs(NS_GetWeakReference(fc)); - } } mScriptGlobalObject = aScriptGlobalObject; return NS_OK; } -NS_IMETHODIMP -nsDocument::GetFocusController(nsIFocusController** aFocusController) -{ - NS_ENSURE_ARG_POINTER(aFocusController); - - nsCOMPtr fc = do_QueryReferent(mFocusController); - *aFocusController = fc; - NS_IF_ADDREF(*aFocusController); - return NS_OK; -} - NS_IMETHODIMP nsDocument::GetNameSpaceManager(nsINameSpaceManager*& aManager) { diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index f55144b66279..e2e80ad41ad1 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -457,14 +457,6 @@ public: */ NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader); - /** - * Get the focus controller for this document - * This can usually be gotten through the ScriptGlobalObject, but - * it is set to null during document destruction, when we still might - * need to fire focus events. - */ - NS_IMETHOD GetFocusController(nsIFocusController** aFocusController); - /** * Add a new observer of document change notifications. Whenever * content is changed, appended, inserted or removed the observers are @@ -678,7 +670,6 @@ protected: nsSupportsHashtable mContentWrapperHash; nsCOMPtr mCSSLoader; - nsWeakPtr mFocusController; nsString mContentLanguage; nsString mContentType; diff --git a/content/events/public/nsIEventStateManager.h b/content/events/public/nsIEventStateManager.h index 288b302dbc65..ebf74ec9b147 100644 --- a/content/events/public/nsIEventStateManager.h +++ b/content/events/public/nsIEventStateManager.h @@ -101,9 +101,6 @@ public: NS_IMETHOD MoveFocusToCaret(PRBool aCanFocusDoc, PRBool *aIsSelectionWithFocus) = 0; NS_IMETHOD MoveCaretToFocus() = 0; - NS_IMETHOD GetNextTabbableContent(nsIContent* aRootContent, nsIFrame* aFrame, - PRBool forward, PRBool aIgnoreTabIndex, nsIContent** aResult) = 0; - // This is an experiment and may be temporary NS_IMETHOD ConsumeFocusEvents(PRBool aDoConsume) = 0; diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 48874f6a5295..a2c575abeab8 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -730,8 +730,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, // de-activation. This will cause it to remember the last // focused sub-window and sub-element for this top-level // window. - nsCOMPtr focusController; - mDocument->GetFocusController(getter_AddRefs(focusController)); + nsCOMPtr focusController = getter_AddRefs(GetFocusControllerForDocument(mDocument)); if (focusController) { // Suppress the command dispatcher. focusController->SetSuppressFocus(PR_TRUE, "Deactivate Suppression"); @@ -782,8 +781,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, // the window, but we still need to tell the focus controller // that it isn't active. - nsCOMPtr fc; - gLastFocusedDocument->GetFocusController(getter_AddRefs(fc)); + nsCOMPtr fc = getter_AddRefs(GetFocusControllerForDocument(gLastFocusedDocument)); if (fc) fc->SetActive(PR_FALSE); } @@ -2733,7 +2731,7 @@ nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsG FlushPendingEvents(aPresContext); } -NS_IMETHODIMP +nsresult nsEventStateManager::SetClickCount(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus) @@ -2799,7 +2797,7 @@ nsEventStateManager::SetClickCount(nsIPresContext* aPresContext, return ret; } -NS_IMETHODIMP +nsresult nsEventStateManager::CheckForAndDispatchClick(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus) @@ -3243,7 +3241,7 @@ void nsEventStateManager::TabIndexFrom(nsIContent *aFrom, PRInt32 *aOutIndex) } -NS_IMETHODIMP +nsresult nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent, nsIFrame* aFrame, PRBool forward, PRBool aIgnoreTabIndex, nsIContent** aResult) { @@ -3949,7 +3947,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState) return NS_OK; } -NS_IMETHODIMP +nsresult nsEventStateManager::SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent, PRBool aEnsureWindowHasFocus) { nsCOMPtr presShell; @@ -5193,3 +5191,18 @@ nsEventStateManager::ShiftFocusByDoc(PRBool aForward) } } +// Get the FocusController given an nsIDocument +nsIFocusController* +nsEventStateManager::GetFocusControllerForDocument(nsIDocument* aDocument) +{ + nsCOMPtr container; + aDocument->GetContainer(getter_AddRefs(container)); + nsCOMPtr windowPrivate = do_GetInterface(container); + nsIFocusController* fc; + if (windowPrivate) + windowPrivate->GetRootFocusController(&fc); + else + fc = nsnull; + + return fc; +} diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index 2f0818972c84..bbaba30dc32c 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -55,6 +55,7 @@ class nsIFrameSelection; class nsIDocShell; class nsIDocShellTreeNode; class nsIDocShellTreeItem; +class nsIFocusController; // mac uses click-hold context menus, a holdover from 4.x #if defined(XP_MAC) || defined(XP_MACOSX) @@ -142,18 +143,19 @@ protected: void UpdateCursor(nsIPresContext* aPresContext, nsEvent* aEvent, nsIFrame* aTargetFrame, nsEventStatus* aStatus); void GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIEvent* aEvent); void GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsGUIEvent* aEvent); - NS_IMETHOD SetClickCount(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus); - NS_IMETHOD CheckForAndDispatchClick(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus); + nsresult SetClickCount(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus); + nsresult CheckForAndDispatchClick(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus); PRBool ChangeFocus(nsIContent* aFocus, PRInt32 aFocusedWith); - NS_IMETHOD GetNextTabbableContent(nsIContent* aRootContent, nsIFrame* aFrame, PRBool forward, PRBool ignoreTabIndex, nsIContent** aResult); + nsresult GetNextTabbableContent(nsIContent* aRootContent, nsIFrame* aFrame, PRBool forward, PRBool ignoreTabIndex, nsIContent** aResult); void TabIndexFrom(nsIContent *aFrom, PRInt32 *aOutIndex); PRInt32 GetNextTabIndex(nsIContent* aParent, PRBool foward); - NS_IMETHOD SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent, PRBool aEnsureWindowHasFocus); + nsresult SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent, PRBool aEnsureWindowHasFocus); PRBool CheckDisabled(nsIContent* aContent); void EnsureDocument(nsIPresShell* aPresShell); void EnsureDocument(nsIPresContext* aPresContext); void FlushPendingEvents(nsIPresContext* aPresContext); + nsIFocusController* GetFocusControllerForDocument(nsIDocument* aDocument); typedef enum { eAccessKeyProcessingNormal = 0, diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index f30c540e0c78..ac8ca5dd8aa4 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -160,6 +160,7 @@ #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" #include "nsIPref.h" +#include "nsIFocusController.h" //---------------------------------------------------------------------- @@ -1643,31 +1644,12 @@ nsXULDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject) #endif mContentWrapperHash.Reset(); - } else if (mScriptGlobalObject != aScriptGlobalObject) { - // Update our weak ref to the focus controller - nsCOMPtr domPrivate = do_QueryInterface(aScriptGlobalObject); - if (domPrivate) { - nsCOMPtr fc; - domPrivate->GetRootFocusController(getter_AddRefs(fc)); - mFocusController = getter_AddRefs(NS_GetWeakReference(fc)); - } } mScriptGlobalObject = aScriptGlobalObject; return NS_OK; } -NS_IMETHODIMP -nsXULDocument::GetFocusController(nsIFocusController** aFocusController) -{ - NS_ENSURE_ARG_POINTER(aFocusController); - - nsCOMPtr fc = do_QueryReferent(mFocusController); - *aFocusController = fc; - NS_IF_ADDREF(*aFocusController); - return NS_OK; -} - NS_IMETHODIMP nsXULDocument::GetNameSpaceManager(nsINameSpaceManager*& aManager) { @@ -3630,8 +3612,7 @@ nsXULDocument::GetPopupNode(nsIDOMNode** aNode) // get focus controller nsCOMPtr focusController; - rv = GetFocusController(getter_AddRefs(focusController)); - NS_ENSURE_SUCCESS(rv, rv); + GetFocusController(getter_AddRefs(focusController)); NS_ENSURE_TRUE(focusController, NS_ERROR_FAILURE); // get popup node rv = focusController->GetPopupNode(aNode); // addref happens here @@ -3646,8 +3627,7 @@ nsXULDocument::SetPopupNode(nsIDOMNode* aNode) // get focus controller nsCOMPtr focusController; - rv = GetFocusController(getter_AddRefs(focusController)); - NS_ENSURE_SUCCESS(rv, rv); + GetFocusController(getter_AddRefs(focusController)); NS_ENSURE_TRUE(focusController, NS_ERROR_FAILURE); // set popup node rv = focusController->SetPopupNode(aNode); @@ -7081,6 +7061,18 @@ nsXULDocument::ParserObserver::OnStopRequest(nsIRequest *request, return rv; } +void +nsXULDocument::GetFocusController(nsIFocusController** aFocusController) +{ + nsCOMPtr ir = do_QueryReferent(mDocumentContainer); + nsCOMPtr windowPrivate = do_GetInterface(ir); + if (windowPrivate) { + windowPrivate->GetRootFocusController(aFocusController); + NS_IF_ADDREF(*aFocusController); + } else + *aFocusController = nsnull; +} + #ifdef IBMBIDI /** * Retrieve and get bidi state of the document diff --git a/content/xul/document/src/nsXULDocument.h b/content/xul/document/src/nsXULDocument.h index f839494b6234..abce94b55765 100644 --- a/content/xul/document/src/nsXULDocument.h +++ b/content/xul/document/src/nsXULDocument.h @@ -84,7 +84,6 @@ #include "nsIBindingManager.h" #include "nsINodeInfo.h" #include "nsIDOMDocumentEvent.h" -#include "nsIFocusController.h" #include "nsScriptLoader.h" #include "pldhash.h" @@ -97,6 +96,7 @@ class nsIRDFService; class nsITimer; class nsIXULContentUtils; class nsIXULPrototypeCache; +class nsIFocusController; #if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript)) class nsIObjectInputStream; class nsIObjectOutputStream; @@ -262,8 +262,6 @@ public: NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader); - NS_IMETHOD GetFocusController(nsIFocusController** aFocusController); - virtual void AddObserver(nsIDocumentObserver* aObserver); virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver); @@ -497,6 +495,8 @@ protected: nsIDOMElement* aListener, nsIAtom* aAttr); + void GetFocusController(nsIFocusController** aFocusController); + protected: // pseudo constants static PRInt32 gRefCnt; @@ -612,8 +612,6 @@ protected: nsCOMPtr mTooltipNode; // [OWNER] element triggering the tooltip nsCOMPtr mNodeInfoManager; // [OWNER] list of names in the document - nsWeakPtr mFocusController; - /** * Context stack, which maintains the state of the Builder and allows * it to be interrupted. diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 6849c89a5495..f93c5a94cb9a 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -308,6 +308,13 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink) aSink), NS_ERROR_FAILURE); return NS_OK; } + else if (aIID.Equals(NS_GET_IID(nsPIDOMWindow)) && + NS_SUCCEEDED(EnsureScriptEnvironment())) { + NS_ENSURE_SUCCESS(mScriptGlobal-> + QueryInterface(NS_GET_IID(nsPIDOMWindow), aSink), + NS_ERROR_FAILURE); + return NS_OK; + } else if (aIID.Equals(NS_GET_IID(nsIDOMWindow)) && NS_SUCCEEDED(EnsureScriptEnvironment())) { NS_ENSURE_SUCCESS(mScriptGlobal-> diff --git a/dom/src/base/nsFocusController.cpp b/dom/src/base/nsFocusController.cpp index 5ad3c7448fc9..6cbcd0545950 100644 --- a/dom/src/base/nsFocusController.cpp +++ b/dom/src/base/nsFocusController.cpp @@ -42,6 +42,11 @@ #include "nsIEventStateManager.h" #include "nsIDocShell.h" #include "nsIBaseWindow.h" +#include "nsIWindowWatcher.h" +#include "nsIDocShellTreeItem.h" +#include "nsIDocShellTreeOwner.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsIServiceManagerUtils.h" #ifdef INCLUDE_XUL #include "nsIDOMXULDocument.h" @@ -53,7 +58,8 @@ nsFocusController::nsFocusController(void) : mSuppressFocus(0), mSuppressFocusScroll(PR_FALSE), - mActive(PR_FALSE) + mActive(PR_FALSE), + mUpdateWindowWatcher(PR_FALSE) { NS_INIT_REFCNT(); } @@ -138,6 +144,14 @@ nsFocusController::SetFocusedWindow(nsIDOMWindowInternal* aWindow) else if (aWindow) mPreviousWindow = aWindow; mCurrentWindow = aWindow; + + if (mUpdateWindowWatcher) { + NS_ASSERTION(mActive, "This shouldn't happen"); + if (mCurrentWindow) + UpdateWWActiveWindow(); + mUpdateWindowWatcher = PR_FALSE; + } + return NS_OK; } @@ -467,9 +481,43 @@ NS_IMETHODIMP nsFocusController::SetActive(PRBool aActive) { mActive = aActive; + + // We may be activated before we ever have a focused window set. + // This happens on window creation, where the FocusController + // is activated just prior to setting the focused window. + // (see nsEventStateManager::PreHandleEvent/NS_ACTIVATE) + // If this is the case, we need to queue a notification of the + // WindowWatcher until SetFocusedWindow is called. + if (mCurrentWindow) + UpdateWWActiveWindow(); + else + mUpdateWindowWatcher = PR_TRUE; + return NS_OK; } +void +nsFocusController::UpdateWWActiveWindow() +{ + // Inform the window watcher of the new active window. + nsCOMPtr wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1"); + if (!wwatch) return; + + // This gets the toplevel DOMWindow + nsCOMPtr sgo = do_QueryInterface(mCurrentWindow); + nsCOMPtr docShell; + sgo->GetDocShell(getter_AddRefs(docShell)); + if (!docShell) return; + + nsCOMPtr docShellAsItem(do_QueryInterface(docShell)); + nsCOMPtr rootItem; + docShellAsItem->GetRootTreeItem(getter_AddRefs(rootItem)); + NS_ASSERTION(rootItem, "Invalid docshell tree - no root!"); + + nsCOMPtr domWin = do_GetInterface(rootItem); + wwatch->SetActiveWindow(domWin); +} + NS_IMETHODIMP nsFocusController::GetPopupNode(nsIDOMNode** aNode) { diff --git a/dom/src/base/nsFocusController.h b/dom/src/base/nsFocusController.h index 4e5fa375e751..53cfe8aaadd1 100644 --- a/dom/src/base/nsFocusController.h +++ b/dom/src/base/nsFocusController.h @@ -83,6 +83,7 @@ public: protected: NS_IMETHOD UpdateCommands(const nsAString& aEventName); + void UpdateWWActiveWindow(); public: static nsresult GetParentWindowFromDocument(nsIDOMDocument* aElement, nsIDOMWindowInternal** aWindow); @@ -96,8 +97,9 @@ protected: nsCOMPtr mPopupNode; // [OWNER] PRUint32 mSuppressFocus; - PRBool mSuppressFocusScroll; - PRBool mActive; + PRPackedBool mSuppressFocusScroll; + PRPackedBool mActive; + PRPackedBool mUpdateWindowWatcher; }; #endif // nsFocusController_h__ diff --git a/layout/xul/base/src/nsMenuBarFrame.cpp b/layout/xul/base/src/nsMenuBarFrame.cpp index 4f8ad9a50e5d..92648a97fd3b 100644 --- a/layout/xul/base/src/nsMenuBarFrame.cpp +++ b/layout/xul/base/src/nsMenuBarFrame.cpp @@ -63,6 +63,8 @@ #include "nsIFocusController.h" #include "nsIDOMWindowInternal.h" #include "nsIDOMDocument.h" +#include "nsPIDOMWindow.h" +#include "nsIInterfaceRequestorUtils.h" #ifdef XP_WIN #include "nsISound.h" #include "nsWidgetsCID.h" @@ -201,38 +203,52 @@ nsMenuBarFrame::SetActive(PRBool aActiveFlag) // We don't want the caret to blink while the menus are active // The caret distracts screen readers and other assistive technologies from the menu selection // There is 1 caret per document, we need to find the focused document and toggle its caret - nsCOMPtr document; - nsCOMPtr focusController; - nsCOMPtr presShell; - mPresContext->GetShell(getter_AddRefs(presShell)); - if (presShell) { + do { + nsCOMPtr presShell; + mPresContext->GetShell(getter_AddRefs(presShell)); + if (!presShell) + break; + + nsCOMPtr document; presShell->GetDocument(getter_AddRefs(document)); - if (document) - document->GetFocusController(getter_AddRefs(focusController)); - } - nsCOMPtr window; - if (focusController) { + if (!document) + break; + + nsCOMPtr container; + document->GetContainer(getter_AddRefs(container)); + nsCOMPtr windowPrivate = do_GetInterface(container); + if (!windowPrivate) + break; + + nsCOMPtr focusController; + windowPrivate->GetRootFocusController(getter_AddRefs(focusController)); + if (!focusController) + break; + nsCOMPtr windowInternal; focusController->GetFocusedWindow(getter_AddRefs(windowInternal)); - window = do_QueryInterface(windowInternal); - } - nsCOMPtr caret; - if (window) { + if (!windowInternal) + break; + nsCOMPtr domDoc; - window->GetDocument(getter_AddRefs(domDoc)); + windowInternal->GetDocument(getter_AddRefs(domDoc)); document = do_QueryInterface(domDoc); - if (document) { - document->GetShellAt(0, getter_AddRefs(presShell)); - if (presShell) - presShell->GetCaret(getter_AddRefs(caret)); - } - } - if (caret) { - if (mIsActive) // store whether caret was visible so that we can restore that state when menu is closed + if (!document) + break; + + document->GetShellAt(0, getter_AddRefs(presShell)); + if (!presShell) + break; + nsCOMPtr caret; + presShell->GetCaret(getter_AddRefs(caret)); + if (!caret) + break; + + if (mIsActive) // store whether caret was visible so that we can restore that state when menu is closed caret->GetCaretVisible(&mCaretWasVisible); if (mCaretWasVisible) caret->SetCaretVisible(!mIsActive); - } + } while (0); NS_NAMED_LITERAL_STRING(active, "DOMMenuBarActive"); NS_NAMED_LITERAL_STRING(inactive, "DOMMenuBarInactive"); diff --git a/xpfe/appshell/src/nsWindowMediator.cpp b/xpfe/appshell/src/nsWindowMediator.cpp index 22f532bd9e61..a0648f5afc94 100644 --- a/xpfe/appshell/src/nsWindowMediator.cpp +++ b/xpfe/appshell/src/nsWindowMediator.cpp @@ -204,18 +204,6 @@ nsWindowMediator::UnregisterWindow(nsWindowInfo *inInfo) mTopmostWindow = 0; delete inInfo; - // inform WindowWatcher - nsWindowInfo *info = MostRecentWindowInfo(0); - nsCOMPtr domWindow; - if (info && info->mWindow) { - nsCOMPtr idomWindow; - GetDOMWindow(info->mWindow, idomWindow); - domWindow = do_QueryInterface(idomWindow); - } - - // failure or no more windows sets it to 0, which is acceptable - mWatcher->SetActiveWindow(domWindow); - return NS_OK; } @@ -387,15 +375,6 @@ nsWindowMediator::UpdateWindowTimeStamp( nsIXULWindow* inWindow) if (info->mWindow.get() == inWindow) { // increment the window's time stamp info->mTimeStamp = ++mTimeStamp; - - // inform WindowWatcher - nsCOMPtr idomwindow; - GetDOMWindow(info->mWindow, idomwindow); - nsCOMPtr domwindow(do_QueryInterface(idomwindow)); - // if for some reason anything failed, it'll be set to 0, which is - // better than an invalid pointer. - mWatcher->SetActiveWindow(domwindow); - return NS_OK; } info = info->mYounger; @@ -670,10 +649,6 @@ nsWindowMediator::Init() return NS_ERROR_OUT_OF_MEMORY; } - mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - return NS_OK; } diff --git a/xpfe/appshell/src/nsWindowMediator.h b/xpfe/appshell/src/nsWindowMediator.h index 24427a6a054c..d5a6eb415e41 100644 --- a/xpfe/appshell/src/nsWindowMediator.h +++ b/xpfe/appshell/src/nsWindowMediator.h @@ -40,7 +40,6 @@ #include "nsCOMPtr.h" #include "nsIWindowMediator.h" -#include "nsIWindowWatcher.h" #include "nsISupportsArray.h" #include "nsVoidArray.h" #include "nsXPIDLString.h" @@ -90,7 +89,6 @@ private: PRInt32 mTimeStamp; PRInt32 mUpdateBatchNest; PRLock *mListLock; - nsCOMPtr mWatcher; nsCOMPtr mListeners; static PRInt32 gRefCnt;