Issue #2452 - Don't use WebVTTListener, JS wrapper, MediaShutdownManager in stable state

https://bugzilla.mozilla.org/show_bug.cgi?id=1443429
https://bugzilla.mozilla.org/show_bug.cgi?id=1515021
This commit is contained in:
Martok 2024-01-14 22:41:18 +01:00 committed by roytam1
commit fbd829908e
7 changed files with 77 additions and 38 deletions

View file

@ -53,6 +53,7 @@
#include "MediaDecoder.h"
#include "MediaPrefs.h"
#include "MediaResource.h"
#include "MediaShutdownManager.h"
#include "nsICategoryManager.h"
#include "nsIContentPolicy.h"
@ -3217,6 +3218,13 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
NotifyOwnerDocumentActivityChanged();
MOZ_ASSERT(NS_IsMainThread());
// We initialize the MediaShutdownManager as the HTMLMediaElement is always
// constructed on the main thread, and not during stable state.
// (MediaShutdownManager make use of nsIAsyncShutdownClient which is written
// in JS)
MediaShutdownManager::InitStatics();
mWatchManager.Watch(mDownloadSuspendedByCache, &HTMLMediaElement::UpdateReadyStateInternal);
// Paradoxically, there is a self-edge whereby UpdateReadyStateInternal refuses
// to run until mReadyState reaches at least HAVE_METADATA by some other means.