Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1343799 - lable runnables in texttracklist.cpp. r=jwwang
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 39MmwAMaDdk
  • Loading branch information
bechen committed Mar 21, 2017
1 parent 6146202 commit 11a9deb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dom/media/TextTrackList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "mozilla/dom/TextTrackListBinding.h"
#include "mozilla/dom/TrackEvent.h"
#include "nsThreadUtils.h"
#include "nsGlobalWindow.h"
#include "mozilla/dom/TextTrackCue.h"
#include "mozilla/dom/TextTrackManager.h"

Expand Down Expand Up @@ -174,14 +175,21 @@ TextTrackList::CreateAndDispatchChangeEvent()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mPendingTextTrackChange) {
nsPIDOMWindowInner* win = GetOwner();
if (!win) {
return;
}

mPendingTextTrackChange = true;
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);

event->InitEvent(NS_LITERAL_STRING("change"), false, false);
event->SetTrusted(true);

nsCOMPtr<nsIRunnable> eventRunner = new ChangeEventRunner(this, event);
NS_DispatchToMainThread(eventRunner);
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackList::CreateAndDispatchChangeEvent", TaskCategory::Other,
eventRunner.forget());
}
}

Expand Down

0 comments on commit 11a9deb

Please sign in to comment.