Commit ce2a1206 authored by Takashi Toyoshima's avatar Takashi Toyoshima Committed by Commit Bot

Web MIDI: show deprecation warning on non-sysex uses

We are planning to deprecate all Web MIDI uses on insecure origins.
This patch starts showing a deprecation warning on non-sysex uses to say
we will prompt for permission from M75, and it results in disabling all
Web MIDI uses on insecure origins.

Bug: 662000, 924471
Change-Id: If8163830984f5e95f6defeb97bd769942c6e08b4
Reviewed-on: https://chromium-review.googlesource.com/c/1425058
Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626917}
parent 083b114e
......@@ -2202,6 +2202,8 @@ enum WebFeature {
kV8RTCQuicStream_WaitForWriteBufferedAmountBelow_Method = 2767,
kV8RTCQuicStream_WaitForReadable_Method = 2768,
kHTMLTemplateElement = 2769,
kNoSysexWebMIDIWithoutPermission = 2770,
kNoSysexWebMIDIOnInsecureOrigin = 2771,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -56,6 +56,8 @@ enum Milestone {
kM71,
kM72,
kM73,
kM74,
kM75,
};
// Returns estimated milestone dates as human-readable strings.
......@@ -94,6 +96,10 @@ const char* MilestoneString(Milestone milestone) {
return "M72, around January 2019";
case kM73:
return "M73, around March 2019";
case kM74:
return "M74, around April 2019";
case kM75:
return "M75, around June 2019";
}
NOTREACHED();
......@@ -137,6 +143,10 @@ double MilestoneDate(Milestone milestone) {
return 1548734400000; // January 29, 2019.
case kM73:
return 1552363200000; // March 12, 2019.
case kM74:
return 1555992000000; // April 23, 2019.
case kM75:
return 1559620800000; // June 4, 2019.
}
NOTREACHED();
......@@ -565,6 +575,25 @@ DeprecationInfo GetDeprecationInfo(WebFeature feature) {
"https://webrtc.org/web-apis/chrome/unified-plan/.",
MilestoneString(kM72))};
case WebFeature::kNoSysexWebMIDIWithoutPermission:
return {"NoSysexWebMIDIWithoutPermission", kM75,
String::Format(
"Web MIDI will ask a permission to use even if the sysex is "
"not specified in the MIDIOptions since %s. See "
"https://www.chromestatus.com/feature/5138066234671104 for "
"more details.",
MilestoneString(kM75))};
case WebFeature::kNoSysexWebMIDIOnInsecureOrigin:
return {"NoSysexWebMIDIOnInsecureOrigin", kM75,
String::Format(
"Web MIDI will be deprecated on insecure origins since %s. "
"You should consider switching your application to a secure "
"origin, such as HTTPS. See "
"https://www.chromestatus.com/feature/5138066234671104 for "
"more details.",
MilestoneString(kM75))};
// Features that aren't deprecated don't have a deprecation message.
default:
return {"NotDeprecated", kUnknown, ""};
......
......@@ -98,6 +98,15 @@ ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* script_state,
document,
WebFeature::
kRequestMIDIAccessIframeWithSysExOption_ObscuredByFootprinting);
} else {
// In the recent spec, the step 7 below allows user-agents to prompt the
// user for permission regardless of sysex option.
// https://webaudio.github.io/web-midi-api/#dom-navigator-requestmidiaccess
// https://crbug.com/662000.
Deprecation::CountDeprecation(
document, document.IsSecureContext()
? WebFeature::kNoSysexWebMIDIWithoutPermission
: WebFeature::kNoSysexWebMIDIOnInsecureOrigin);
}
UseCounter::CountCrossOriginIframe(
document, WebFeature::kRequestMIDIAccessIframe_ObscuredByFootprinting);
......
CONSOLE WARNING: line 61: Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since M75, around June 2019. See https://www.chromestatus.com/feature/5138066234671104 for more details.
Tests MIDIPort implicit open.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE WARNING: line 59: Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since M75, around June 2019. See https://www.chromestatus.com/feature/5138066234671104 for more details.
Tests MIDIPort.open and MIDIPort.close.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE WARNING: line 12: Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since M75, around June 2019. See https://www.chromestatus.com/feature/5138066234671104 for more details.
Test if requestMIDIAccess is available.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE WARNING: line 164: Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since M75, around June 2019. See https://www.chromestatus.com/feature/5138066234671104 for more details.
Tests navigator.requestMIDIAccess.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE WARNING: line 33: Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since M75, around June 2019. See https://www.chromestatus.com/feature/5138066234671104 for more details.
Tests navigator.requestMIDIAccess failure.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE WARNING: line 58: Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since M75, around June 2019. See https://www.chromestatus.com/feature/5138066234671104 for more details.
Test requestMIDIAccess with various options.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE WARNING: line 40: Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since M75, around June 2019. See https://www.chromestatus.com/feature/5138066234671104 for more details.
Test if various kinds of system messages can be validated.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
......@@ -21466,6 +21466,8 @@ Called by update_net_error_codes.py.-->
label="V8RTCQuicStream_WaitForWriteBufferedAmountBelow_Method"/>
<int value="2768" label="V8RTCQuicStream_WaitForReadable_Method"/>
<int value="2769" label="HTMLTemplateElement"/>
<int value="2770" label="NoSysexWebMIDIWithoutPermission"/>
<int value="2771" label="NoSysexWebMIDIOnInsecureOrigin"/>
</enum>
<enum name="FeaturePolicyFeature">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment