diff --git a/mozilla/browser/components/feeds/src/FeedWriter.js b/mozilla/browser/components/feeds/src/FeedWriter.js index f8be34b0a59..b1f9e7b4e9c 100755 --- a/mozilla/browser/components/feeds/src/FeedWriter.js +++ b/mozilla/browser/components/feeds/src/FeedWriter.js @@ -566,13 +566,13 @@ FeedWriter.prototype = { * selected). If we don't show the filepicker here, it will be shown * when clicking "Subscribe Now". */ - if (this._document.getElementById("handlersMenuList") - .getAttribute("open") == "true") { - if (!this._chooseClientApp()) { - // Select the (per-prefs) selected handler if no application was - // selected - this._setSelectedHandler(); - } + var popupbox = this._document.getElementById("handlersMenuList") + .firstChild.boxObject; + popupbox.QueryInterface(Components.interfaces.nsIPopupBoxObject); + if (popupbox.popupState == "hiding" && !this._chooseClientApp()) { + // Select the (per-prefs) selected handler if no application was + // selected + this._setSelectedHandler(); } break; default: diff --git a/mozilla/layout/xul/base/public/nsIPopupBoxObject.idl b/mozilla/layout/xul/base/public/nsIPopupBoxObject.idl index 8bf70f961d1..7effd112cfc 100644 --- a/mozilla/layout/xul/base/public/nsIPopupBoxObject.idl +++ b/mozilla/layout/xul/base/public/nsIPopupBoxObject.idl @@ -41,7 +41,7 @@ interface nsIDOMElement; -[scriptable, uuid(8714441F-0E24-4EB5-BE58-905F2854B4EB)] +[scriptable, uuid(A41AF368-9F73-4D73-A058-49DD7E41F9EA)] interface nsIPopupBoxObject : nsISupports { /** @@ -154,6 +154,15 @@ interface nsIPopupBoxObject : nsISupports * @param y vertical screen position */ void openPopupAtScreen(in long x, in long y, in boolean isContextMenu); + + /** + * Returns the state of the popup: + * closed - the popup is closed + * open - the popup is open + * showing - the popup is in the process of being shown + * hiding - the popup is in the process of being hidden + */ + readonly attribute AString popupState; }; %{C++ diff --git a/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp b/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp index 7ffb809ac4f..d27d62e85b7 100644 --- a/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp @@ -223,6 +223,32 @@ nsPopupBoxObject::EnableKeyboardNavigator(PRBool aEnableKeyboardNavigator) return NS_OK; } +NS_IMETHODIMP +nsPopupBoxObject::GetPopupState(nsAString& aState) +{ + aState.AssignLiteral("closed"); + + nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame(); + if (menuPopupFrame) { + switch (menuPopupFrame->PopupState()) { + case ePopupShowing: + case ePopupOpen: + aState.AssignLiteral("showing"); + break; + case ePopupOpenAndVisible: + aState.AssignLiteral("open"); + break; + case ePopupHiding: + case ePopupInvisible: + aState.AssignLiteral("hiding"); + break; + } + } + + return NS_OK; +} + + // Creation Routine /////////////////////////////////////////////////////////////////////// nsresult diff --git a/mozilla/toolkit/content/tests/widgets/popup_shared.js b/mozilla/toolkit/content/tests/widgets/popup_shared.js index 299367bd11e..77cc0a8c6f9 100644 --- a/mozilla/toolkit/content/tests/widgets/popup_shared.js +++ b/mozilla/toolkit/content/tests/widgets/popup_shared.js @@ -99,6 +99,18 @@ function eventOccured(event) (eventitem[0] == event.type && eventitem[1] == event.target.id); ok(matches, test.testname + " " + event.type + " fired"); + var expectedState; + switch (event.type) { + case "popupshowing": expectedState = "showing"; break; + case "popupshown": expectedState = "open"; break; + case "popuphiding": expectedState = "hiding"; break; + case "popuphidden": expectedState = "closed"; break; + } + + if (expectedState) + is(event.originalTarget.state, expectedState, + test.testname + " " + event.type + " state"); + if (matches) { gTestEventIndex++ if (events.length <= gTestEventIndex) diff --git a/mozilla/toolkit/content/widgets/popup.xml b/mozilla/toolkit/content/widgets/popup.xml index 0ad0d86d74a..4fe877f1562 100644 --- a/mozilla/toolkit/content/widgets/popup.xml +++ b/mozilla/toolkit/content/widgets/popup.xml @@ -31,6 +31,9 @@ + +