Bug 1805582 — Add message to console when silently denying MIDI access due to no detected devices. r=gsvelto

Our test infrastructure runs with midi.testing enabled, which generates
virtual devices. This is mostly what we want, but it does prevent us
from testing the "no devices detected" path in automation. I've tested
it locally.

Differential Revision: https://phabricator.services.mozilla.com/D164722
This commit is contained in:
Bobby Holley 2022-12-14 22:04:33 +00:00
Родитель 60846d8883
Коммит fb573066c8
1 изменённых файлов: 3 добавлений и 0 удалений

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

@ -162,6 +162,9 @@ MIDIPermissionRequest::Run() {
if (aHasDevices) {
self->DoPrompt();
} else {
nsContentUtils::ReportToConsoleNonLocalized(
u"Silently denying site request for MIDI access because no devices were detected. You may need to restart your browser after connecting a new device."_ns,
nsIScriptError::infoFlag, "WebMIDI"_ns, mWindow->GetDoc());
self->CancelWithRandomizedDelay();
}
},