Bug 1334572 - Dispatch WindowLowered/Raised events asynchronously in test mode (for marionette) (r=smaug)

MozReview-Commit-ID: Kwgl6sX4OoU
This commit is contained in:
Bill McCloskey 2017-01-30 15:42:02 -08:00
Родитель c8c4ea2401
Коммит ed66ab4b53
1 изменённых файлов: 12 добавлений и 4 удалений

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

@ -2204,10 +2204,18 @@ nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow)
if (sTestMode) { if (sTestMode) {
// In test mode, emulate the existing window being lowered and the new // In test mode, emulate the existing window being lowered and the new
// window being raised. // window being raised. This happens in a separate runnable to avoid
if (mActiveWindow) // touching multiple windows in the current runnable.
WindowLowered(mActiveWindow); nsCOMPtr<nsPIDOMWindowOuter> active(mActiveWindow);
WindowRaised(aWindow); nsCOMPtr<nsPIDOMWindowOuter> window(aWindow);
RefPtr<nsFocusManager> self(this);
NS_DispatchToCurrentThread(
NS_NewRunnableFunction([self, active, window] () -> void {
if (active) {
self->WindowLowered(active);
}
self->WindowRaised(window);
}));
return; return;
} }