Bug 1748644 - MIDI ports should stop responding to parent message once they've been disconnected from the document that owned them r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D135700
This commit is contained in:
Gabriele Svelto 2022-01-12 15:03:34 +00:00
Родитель 4ea70a7334
Коммит 250cea0582
2 изменённых файлов: 9 добавлений и 1 удалений

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

@ -37,7 +37,11 @@ JSObject* MIDIInput::WrapObject(JSContext* aCx,
}
void MIDIInput::Receive(const nsTArray<MIDIMessage>& aMsgs) {
nsCOMPtr<Document> doc = GetOwner() ? GetOwner()->GetDoc() : nullptr;
if (!GetOwner()) {
return; // Ignore messages once we've been disconnected from the owner
}
nsCOMPtr<Document> doc = GetOwner()->GetDoc();
if (!doc) {
NS_WARNING("No document available to send MIDIMessageEvent to!");
return;

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

@ -163,6 +163,10 @@ void MIDIPort::Notify(const void_t& aVoid) {
}
void MIDIPort::FireStateChangeEvent() {
if (!GetOwner()) {
return; // Ignore changes once we've been disconnected from the owner
}
StateChange();
MOZ_ASSERT(mPort);