From 0ec8576e68ca720bd0140ae9cfe6b472b299435e Mon Sep 17 00:00:00 2001 From: Raymes Khoury Date: Mon, 9 Oct 2017 16:04:18 +1100 Subject: [PATCH 1/2] Add Feature Policy integration for WebMidi --- index.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/index.html b/index.html index 920259f..5aaf391 100644 --- a/index.html +++ b/index.html @@ -142,6 +142,19 @@

Terminology

Obtaining Access to MIDI Devices

+
+

Feature Policy Integration

+

+ requestMIDIAccess is a policy-controlled feature, as defined by Feature Policy. +

+

+ The feature name for requestMIDIAccess is midi. +

+

+ The default allowlist for requestMIDIAccess is ["self"]. +

+
+

Extensions to the Navigator interface

@@ -182,6 +195,14 @@

Extensions to the Navigator interface

  1. Let promise be a new Promise object and resolver be its associated resolver.

  2. Return promise and run the following steps asynchronously.

  3. +
  4. Let document be the calling context's Document.

  5. +
  6. +

    + If document is not allowed to use the + policy-controlled feature named + midi, jump to the step labeled failure below. +

    +
  7. Optionally, e.g. based on a previously-established user From 66762f1e7f3d27ea23102544573f2b7f145b59f4 Mon Sep 17 00:00:00 2001 From: Raymes Khoury Date: Tue, 24 Oct 2017 17:40:25 +1100 Subject: [PATCH 2/2] Describe that a SecurityError should be returned if the request is denied by feature policy --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 5aaf391..3cda7c1 100644 --- a/index.html +++ b/index.html @@ -242,7 +242,7 @@

    Extensions to the Navigator interface

  8. failure: Let error be a new DOMException. This exception's .name should be "SecurityError" if the - user or their security settings denied the application from creating a MIDIAccess instance with the requested options, "AbortError" if the page is going to be closed for a user navigation, "InvalidStateError" if the underlying systems raise any errors, or otherwise it should be "NotSupportedError".

  9. + user or their security settings denied the application from creating a MIDIAccess instance with the requested options, or if the error is the result of document not being allowed to use the feature, "AbortError" if the page is going to be closed for a user navigation, "InvalidStateError" if the underlying systems raise any errors, or otherwise it should be "NotSupportedError".

  10. Call resolver's reject(value) method with error as value argument.