Bug 1481629 - only dispatch UnselectedTabHover event when outer window exists. r=bzbarsky

If we can't reach the outer window from the document, then also can't reach the chrome <browser> either.
Therefore, there's no point in firing the event.

Differential Revision: https://phabricator.services.mozilla.com/D2891

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2018-08-08 19:00:03 +00:00
parent ed36e3dff8
commit 23e50af065

View File

@ -110,6 +110,11 @@ BackgroundVideoDecodingPermissionObserver::EnableEvent() const
return;
}
nsCOMPtr<nsPIDOMWindowOuter> ownerTop = GetOwnerWindow();
if (!ownerTop) {
return;
}
RefPtr<AsyncEventDispatcher> asyncDispatcher =
new AsyncEventDispatcher(doc,
NS_LITERAL_STRING("UnselectedTabHover:Enable"),
@ -126,6 +131,11 @@ BackgroundVideoDecodingPermissionObserver::DisableEvent() const
return;
}
nsCOMPtr<nsPIDOMWindowOuter> ownerTop = GetOwnerWindow();
if (!ownerTop) {
return;
}
RefPtr<AsyncEventDispatcher> asyncDispatcher =
new AsyncEventDispatcher(doc,
NS_LITERAL_STRING("UnselectedTabHover:Disable"),