Bug 1504745, update the follow state before SetCaptureState as the nsMenuChainItem now stored in mPopups could be destroyed, r=tn

This commit is contained in:
Neil Deakin 2018-11-09 11:23:59 -05:00
Родитель d34d2ca3a4
Коммит 6e655bec59
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -923,6 +923,8 @@ nsXULPopupManager::ShowPopupCallback(nsIContent* aPopup,
aPopupFrame->ShowPopup(aIsContextMenu);
NS_ENSURE_TRUE_VOID(weakFrame.IsAlive());
item->UpdateFollowAnchor();
// popups normally hide when an outside click occurs. Panels may use
// the noautohide attribute to disable this behaviour. It is expected
// that the application will hide these popups manually. The tooltip
@ -936,8 +938,6 @@ nsXULPopupManager::ShowPopupCallback(nsIContent* aPopup,
SetCaptureState(oldmenu);
NS_ENSURE_TRUE_VOID(weakFrame.IsAlive());
item->UpdateFollowAnchor();
if (aSelectFirstItem) {
nsMenuFrame* next = GetNextMenuItem(aPopupFrame, nullptr, true, false);
aPopupFrame->SetCurrentMenuItem(next);