Skip to content

Commit

Permalink
Switch PermissionName to DOMString
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Feb 10, 2022
1 parent 5f8af1f commit 8df1069
Showing 1 changed file with 31 additions and 139 deletions.
170 changes: 31 additions & 139 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@
mdn: true,
// See https://respec.org/docs/#xref for usage.
xref: "web-platform",
localBiblio: {
"powerful-feature-registry": {
title: "Registry of Powerful Features",
href: "https://w3c.github.io/powerful-features-registry/",
status: "unofficial",
}
}
};
</script>
</head>
Expand All @@ -76,10 +69,6 @@ <h2 id="subtitle">
<p>
This is a work in progress.
</p>
<p>
Some features in this specification are supported by only one user agent, and as such, are
marked as <dfn>at risk</dfn>.
</p>
</section>
<section class="informative">
<h2 id="examples">
Expand Down Expand Up @@ -295,12 +284,11 @@ <h3>
|descriptorA|'s <a>permission state</a> must also be {{PermissionState/"denied"}}.
</p>
<p class="example" id="example-stronger-than">
<code>{name: {{PermissionName/"midi"}}, sysex: true}</code> ("midi-with-sysex") is
[=PermissionDescriptor/stronger than=] <code>{name: {{PermissionName/"midi"}},
sysex: false}</code> ("midi-without-sysex"), so if the user denies access to
midi-without-sysex, the UA must also deny access to midi-with-sysex, and similarly
if the user grants access to midi-with-sysex, the UA must also grant access to
midi-without-sysex.
`{name: "midi", sysex: true}` ("midi-with-sysex") is
[=PermissionDescriptor/stronger than=] `{name: "midi"}}, sysex: false}`
("midi-without-sysex"), so if the user denies access to midi-without-sysex, the UA
must also deny access to midi-with-sysex, and similarly if the user grants access
to midi-with-sysex, the UA must also grant access to midi-without-sysex.
</p>
</dd>
<dt>
Expand All @@ -322,10 +310,10 @@ <h3>
determine <em>which</em> cameras the user has granted the <a data-cite=
"ECMASCRIPT#current-realm">current realm</a> permission to access. Each of these
features defines an [=powerful feature/extra permission data type=]. If a
{{PermissionName}} |name| names one of these features, then |name|'s
<dfn data-dfn-for="powerful feature" class="export">extra permission data</dfn> for
an optional <a>environment settings object</a> |settings| is the result of the
following algorithm:
{{DOMString}} |name| names one of these features, then |name|'s <dfn data-dfn-for=
"powerful feature" class="export">extra permission data</dfn> for an optional
<a>environment settings object</a> |settings| is the result of the following
algorithm:
</p>
<ol class="algorithm">
<li>If |settings| wasn't passed, set it to the [=current settings object=].
Expand All @@ -350,7 +338,7 @@ <h3>
constraints</dfn>:
</dt>
<dd>
Constraints on the values that the UA can return as a {{PermissionName}}'s [=powerful
Constraints on the values that the UA can return as a {{DOMString}}'s [=powerful
feature/extra permission data=]. Defaults to no constraints beyond the user's intent.
</dd>
<dt>
Expand Down Expand Up @@ -579,9 +567,9 @@ <h3 id="reading-current-states">
<aside class="issue" id="issue-current-entry-incumbent-or-relevant" data-number="278">
</aside>
<p>
As a shorthand, a {{PermissionName}} |name|'s <a>permission state</a> is the
<a>permission state</a> of a {{PermissionDescriptor}} with its
{{PermissionDescriptor/name}} member set to |name|.
As a shorthand, a {{DOMString}} |name|'s <a>permission state</a> is the <a>permission
state</a> of a {{PermissionDescriptor}} with its {{PermissionDescriptor/name}} member set
to |name|.
</p>
</section>
<section>
Expand Down Expand Up @@ -618,8 +606,8 @@ <h3 id="requesting-more-permission">
</li>
</ol>
<p>
As a shorthand, <a>requesting permission to use</a> a {{PermissionName}} |name|, is the
same as <a>requesting permission to use</a> a {{PermissionDescriptor}} with its
As a shorthand, <a>requesting permission to use</a> a {{DOMString}} |name|, is the same
as <a>requesting permission to use</a> a {{PermissionDescriptor}} with its
{{PermissionDescriptor/name}} member set to |name|.
</p>
</section>
Expand Down Expand Up @@ -659,7 +647,7 @@ <h3>
</ol>
<p>
As a shorthand, <a>prompting the user to choose</a> from options associated with a
{{PermissionName}} |name|, is the same as <a>prompting the user to choose</a> from those
{{DOMString}} |name|, is the same as <a>prompting the user to choose</a> from those
options associated with a {{PermissionDescriptor}} with its {{PermissionDescriptor/name}}
member set to |name|.
</p>
Expand Down Expand Up @@ -713,7 +701,7 @@ <h3 id="permissions-interface">
};

dictionary PermissionDescriptor {
required PermissionName name;
required DOMString name;
};
</pre>
<section>
Expand All @@ -726,6 +714,19 @@ <h4 id="query-method">
<var>permissionDesc</var>:
</p>
<ol class="algorithm">
<li>If |permissionDesc|'s {{PermissionDescriptor/name}} member is not supported, return
[=a promise rejected with=] a {{TypeError}}.
<aside class="note" title="Why is this not an enum?">
<p>
This is deliberately design to work the same a WebIDL [=enumeration=] (`enum`)
and implementers are encouraged to use their own custom `enum` here. The reason
this is not an enum in the specification vary greatly in the powerful features
they support. Using a {{DOMString}} to identify a powerful feature gives
implementers the freedom to pick and choose which of the power features from the
[[[powerful-feature-registry]]] they wish to support.
</p>
</aside>
</li>
<li>Let |rootDesc| be the object |permissionDesc| refers to, <a>converted to an IDL
value</a> of type {{PermissionDescriptor}}.
</li>
Expand Down Expand Up @@ -765,7 +766,7 @@ <h3 id="permissionstatus-interface">
[Exposed=(Window,Worker)]
interface PermissionStatus : EventTarget {
readonly attribute PermissionState state;
readonly attribute PermissionName name;
readonly attribute DOMString name;
attribute EventHandler onchange;
};

Expand Down Expand Up @@ -864,115 +865,6 @@ <h4 id="permissionstatus-gc">
</section>
</section>
</section>
<section data-dfn-for="PermissionName">
<h2>
Powerful features registry
</h2>
<pre class="idl">
enum PermissionName {
"accelerometer",
"ambient-light-sensor",
"background-fetch",
"background-sync",
"bluetooth",
"camera",
"display-capture",
"geolocation",
"gyroscope",
"magnetometer",
"microphone",
"midi",
"nfc",
"notifications",
"persistent-storage",
"push",
"screen-wake-lock",
"speaker-selection",
"xr-spatial-tracking",
};
</pre>
<p>
Each enumeration value in the {{PermissionName}} enum identifies a <a>powerful feature</a>.
</p>
<p>
The <dfn>accelerometer</dfn> enum value identifies the [[[?accelerometer]]] API [=powerful
feature=].
</p>
<p>
The <dfn>ambient-light-sensor</dfn> enum value identifies the [[[?ambient-light]]]
[=powerful feature=].
</p>
<p>
The <dfn>background-fetch</dfn> enum value identifies the [[[?background-fetch]]]
[=powerful feature=].
</p>
<p>
The <dfn>background-sync</dfn> enum value identifies the [[[?web-background-sync]]]
[=powerful feature=].
</p>
<p>
The <dfn>bluetooth</dfn> enum value identifies the [[[?web-bluetooth]]] [=powerful
feature=].
</p>
<p>
The <dfn>camera</dfn> and <dfn>microphone</dfn> enum values identify the
[[[?mediacapture-streams]]] [=powerful features=].
</p>
<p>
The <dfn>display-capture</dfn> enum value identifies the [[[?screen-capture]]] [=powerful
feature=].
</p>
<p>
The <dfn>geolocation</dfn> enum value identifies the [[[?Geolocation]]] [=powerful
feature=].
</p>
<p>
The <dfn>gyroscope</dfn> enum value identifies the [[[?gyroscope]]] API [=powerful
feature=].
</p>
<p>
The <dfn>magnetometer</dfn> enum value identifies the [[[?magnetometer]]] API [=powerful
feature=].
</p>
<p>
The <dfn>midi</dfn> enum value identifies the [[[?webmidi]]] [=powerful feature=].
</p>
<p>
The <dfn>nfc</dfn> enum value identifies the [[[?web-nfc]]] [=powerful feature=].
</p>
<p>
The <dfn>notifications</dfn> enum value identifies the [[[?notifications]]] [=powerful
feature=].
</p>
<p>
The <dfn>persistent-storage</dfn> enum value identifies the [[[?storage]]] [=powerful
feature=].
</p>
<p>
The <dfn>push</dfn> enum value identifies the [[[?push-api]]] [=powerful feature=].
</p>
<p>
The <dfn>speaker-selection</dfn> enum value identifies the [[[?audio-output]]] [=powerful
feature=].
</p>
<p>
The <dfn>xr-spatial-tracking</dfn> enum value identifies the [[[?webxr]]] Device API
[=powerful feature=].
</p>
<section>
<h3 id="screen-wake-lock">
Screen wake lock
</h3>
<p>
The <dfn>screen-wake-lock</dfn> enum value identifies the [[[screen-wake-lock]]]
[=powerful feature=]. It is a [=default powerful feature=].
</p>
<p class="issue">
This [=powerful feature=] only has a single implementation, and therefore, as per the W3C
Process, it is [=at risk=].
</p>
</section>
</section>
<section id="conformance"></section>
<section class="informative appendix">
<h2 id="relationship-to-permissions-policy">
Expand Down

0 comments on commit 8df1069

Please sign in to comment.