Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dom/midi/MIDIAccessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ already_AddRefed<Promise> MIDIAccessManager::RequestMIDIAccess(
// different from a normal rejection because we don't want websites to use
// the error as a way to fingerprint users, so we throw a security error
// as if the request had been rejected by the user.
aRv.ThrowSecurityError("Access not allowed");
aRv.ThrowNotAllowedError("Access not allowed");
return nullptr;
}
#endif

if (!FeaturePolicyUtils::IsFeatureAllowed(doc, u"midi"_ns)) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
aRv.Throw(NS_ERROR_DOM_NOT_ALLOWED_ERR);
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion dom/midi/MIDIOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void MIDIOutput::Send(const Sequence<uint8_t>& aData,
if (!SysexEnabled()) {
for (auto& msg : msgArray) {
if (MIDIUtils::IsSysexMessage(msg)) {
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
aRv.Throw(NS_ERROR_DOM_NOT_ALLOWED_ERR);
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion dom/midi/MIDIPermissionRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ MIDIPermissionRequest::GetTypes(nsIArray** aTypes) {
NS_IMETHODIMP
MIDIPermissionRequest::Cancel() {
mCancelTimer = nullptr;
mPromise->MaybeRejectWithSecurityError(
mPromise->MaybeRejectWithNotAllowedError(
"WebMIDI requires a site permission add-on to activate");
return NS_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion dom/midi/MIDIPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void MIDIPort::FireStateChangeEvent() {
}
} else if (Port()->ConnectionState() == MIDIPortConnectionState::Closed) {
if (mOpeningPromise) {
mOpeningPromise->MaybeReject(NS_ERROR_DOM_INVALID_ACCESS_ERR);
mOpeningPromise->MaybeReject(NS_ERROR_DOM_NOT_ALLOWED_ERR);
mOpeningPromise = nullptr;
}
if (mClosingPromise) {
Expand Down
10 changes: 5 additions & 5 deletions dom/midi/tests/browser_midi_permission_gated.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ add_task(async function testRequestMIDIAccess() {
);
is(
rejectionMessage,
"SecurityError: WebMIDI requires a site permission add-on to activate"
"NotAllowedError: WebMIDI requires a site permission add-on to activate"
);

assertSitePermissionInstallTelemetryEvents(["site_warning", "cancelled"]);
Expand Down Expand Up @@ -185,7 +185,7 @@ add_task(async function testRequestMIDIAccess() {
);
is(
rejectionMessage,
"SecurityError: WebMIDI requires a site permission add-on to activate"
"NotAllowedError: WebMIDI requires a site permission add-on to activate"
);

assertSitePermissionInstallTelemetryEvents([
Expand Down Expand Up @@ -386,7 +386,7 @@ add_task(async function testRequestMIDIAccess() {
return errorMessage;
}
);
is(rejectionMessage, "SecurityError", "requestMIDIAccess was rejected");
is(rejectionMessage, "NotAllowedError", "requestMIDIAccess was rejected");

info("Request midi-sysex access again");
let denyIntervalStart = performance.now();
Expand All @@ -407,7 +407,7 @@ add_task(async function testRequestMIDIAccess() {
);
is(
rejectionMessage,
"SecurityError",
"NotAllowedError",
"requestMIDIAccess was rejected without user prompt"
);
let denyIntervalElapsed = performance.now() - denyIntervalStart;
Expand Down Expand Up @@ -560,7 +560,7 @@ add_task(async function testIframeRequestMIDIAccess() {

is(
rejectionMessage,
"SecurityError",
"NotAllowedError",
"requestMIDIAccess from the remote iframe was rejected"
);

Expand Down
2 changes: 1 addition & 1 deletion dom/midi/tests/test_midi_device_explicit_open_close.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
await output_opened.open();
ok(false, "Should've failed to open port!");
} catch(err) {
is(err.name, "InvalidAccessError", "error name " + err.name + " should be InvalidAccessError");
is(err.name, "NotAllowedError", "error name " + err.name + " should be NotAllowedError");
ok(output_opened.connection == "closed", "connection registered as closed");
ok(true, "Port not opened, test succeeded");
} finally {
Expand Down