зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1673509 - part2 : 'deactivated' should be the last event for media controller. r=chunmin
We should not dispatch any other events (except `deactivated`) after controller is deactivated. Differential Revision: https://phabricator.services.mozilla.com/D95358
This commit is contained in:
Родитель
08b35cc74e
Коммит
08c42352f1
|
@ -521,16 +521,22 @@ void MediaController::HandleMetadataChanged(
|
|||
}
|
||||
|
||||
void MediaController::DispatchAsyncEvent(const nsAString& aName) {
|
||||
LOG("Dispatch event %s", NS_ConvertUTF16toUTF8(aName).get());
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, aName, CanBubble::eYes);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
|
||||
event->InitEvent(aName, false, false);
|
||||
event->SetTrusted(true);
|
||||
DispatchAsyncEvent(event);
|
||||
}
|
||||
|
||||
void MediaController::DispatchAsyncEvent(Event* aEvent) {
|
||||
MOZ_ASSERT(aEvent);
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
if (!mIsActive && !eventType.EqualsLiteral("deactivated")) {
|
||||
LOG("Only 'deactivated' can be dispatched on a deactivated controller, not "
|
||||
"'%s'",
|
||||
NS_ConvertUTF16toUTF8(eventType).get());
|
||||
return;
|
||||
}
|
||||
LOG("Dispatch event %s", NS_ConvertUTF16toUTF8(eventType).get());
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, aEvent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче