* 仕様書

[REFS[
- [26] [CITE@en[Permissions]] ([TIME[2016-10-17 15:49:40 +09:00]]) <https://w3c.github.io/permissions/>
- [56] [CITE@en[Geolocation API Specification]], [TIME[2019-11-24 18:38:51 +09:00]] <https://w3c.github.io/geolocation-api/#security>
- [35] [CITE@en-US[Push API]], [TIME[2020-02-04 16:21:34 +09:00]] <https://w3c.github.io/push-api/#dfn-express-permission>
- [37] [CITE@en-US[Push API]], [TIME[2020-02-04 16:21:34 +09:00]] <https://w3c.github.io/push-api/#security-and-privacy-considerations>
- [38] [CITE@en-US[Push API]], [TIME[2020-02-04 16:21:34 +09:00]] <https://w3c.github.io/push-api/#dom-pushmanager-subscribe>
- [45] [CITE@en-US[Push API]], [TIME[2020-02-04 16:21:34 +09:00]] <https://w3c.github.io/push-api/#dom-pushmanager-permissionstate>
- [41] [CITE@en-US[Push API]], [TIME[2020-02-04 16:21:34 +09:00]] <https://w3c.github.io/push-api/#pushsubscriptionoptionsinit-dictionary>
- [42] [CITE@en-US[Push API]], [TIME[2020-02-04 16:21:34 +09:00]] <https://w3c.github.io/push-api/#pushpermissionstate-enumeration>
]REFS]

* Geolocation API

[60] [[利用者エージェント]]は、
[[利用者]]の[[プライバシー]]を守るための仕組みを用意しなければ[MUST[なりません]]。
[[利用者エージェント]]は、
[[利用者]]の[[許可][Permission]]の表明なくして[[位置情報]]を提供しては[MUST[なりません]]。 
[SRC[>>56]]

;; [57] 後段、なぜか[MUST[禁止]]と[SHOULD[推奨]]の2回同じような規定があります。
[MUST[禁止]]の方が強いです。


[61] [[利用者エージェント]]は、
[[利用者]]が予め設定している場合を除き、
[[利用者インターフェイス]]を通じて[[利用者]]の[[許可][Permission]]を得なければ[MUST[なりません]]。
当該[[許可][Permission]]取得[[利用者インターフェイス]]は、
[[文書]]の [F[URL][文書の番地]] の[F[ホスト][URL host]]を含まなければ[MUST[なりません]]。
[SRC[>>56]]

[62] [[利用者インターフェイス]]を通じた[[許可][Permission]]であって[[現在閲覧セッション]]を超えて保持されるものは、
[[取り消せ][revoke]]なければ[MUST[なりません]]。
[[利用者エージェント]]は[[取消][revoke]]を尊重しなければ[MUST[なりません]]。 [SRC[>>56]]

;; [58] 
例えば集中管理下にある端末で、
特定の[[起源]]による[[位置情報]]取得を管理者が一括して[[許可][Permission]]しているようなとき、
直接の[[利用者]]が個別に承認、不承認を変更できない仕組みがあり得ると思われます。

;; [59] 仕様書は、
[[利用者エージェント]]による[[利用者インターフェイス]]の違いの例として、
[[Webブラウザー]]なら[[利用者インターフェイス]]を表示するであろうところ、
[[VoIP]] [[電話]]は[[緊急通報]]時に[[利用者インターフェイス]]を提示しなくても[MAY[構わない]]のだと書いています。
[SRC[>>56]]
[[VoIP]] 電話機能の実装に [[Geolocation API]] が使われた事例が実在するのかは謎です。
そもそも [[Webブラウザー]]以外の実装まで想定して一般化する必要性が謎です。


[63] 
[CODE[getCurrentPosition]]
と
[CODE[watchPosition]]
から呼び出されます。


* Push API

[36] 
[[Push API]]
における
[DFN[express permission]]
とは、
[[利用者]]による動作であって、
例えば[[利用者インターフェイス]]や[[プラットフォーム]]機能を通じて、
[[Webアプリケーション]]が [[Push API]]
を利用することを承認するものをいいます。
[SRC[>>35]]


[39] [[利用者エージェント]]は、
[[利用者]]が
[[express permission]]
することなく [[Push API]]
の機能を [[Webアプリケーション]]に提供しては[MUST[なりません]] [SRC[>>37]]。
[CODE[subscribe]]
[[メソッド]]では、
[[利用者インターフェイス]]で [[permission]]
に同意を得るか、
以前の同意が有効でなければ[MUST[なりません]] [SRC[>>37, >>38]]。
同意済みかの判定には[VAR[オプション群]]
([CODE[PushSubscriptionOptionsInit]])
を考慮[MAY[できます]]
[SRC[>>37, >>41]]。
[[利用者インターフェイス]]を提示しなければならない場合で、
[CODE[subscribe]]
が[[サービスワーカー]]から呼び出された場合には、
拒否とみなさなければなりません [SRC[>>38]]。

[55] [[Push API]] の [[permission]]
は持続させる、つまり一旦許可されれば次の [CODE[subscribe]]
でも許可されているとみなすことができます。
[SRC[>>45]]

[40] 
現在の[[閲覧セッション]]を超えて有効な [[permission]]
は、[[失効]]可能でなければ[MUST[なりません]]。
[SRC[>>37]]
[SEE[ [[プッシュ購読]] ]]

-*-*-

[44] [CODE[PushManager]]
[[インターフェイス]]の
[DFN[[CODE[permissionState]]]]
[[メソッド]]は、
次のようにしなければなりません。
[SRC[>>45]]

[FIG(steps)[
= [46] [VAR[約束]]を、
[[新しい約束]]に設定します。
= [47] [VAR[約束]]を返します。
]FIG]

[48] [[非同期的]]に、次のようにしなければ[MUST[なりません]]。
[SRC[>>45]]

[FIG(steps)[
= [49] [VAR[状態]]を、 [[Push API]] の [[permission]] の状態に設定します。
= [50] [VAR[状態]]がエラーの場合、
== [51] [VAR[約束]]を、[[拒絶]]します。
= [52] それ以外の場合、
== [53] [VAR[約束]]を、 [VAR[状態]] ([CODE[PushPermissionState]]) で[[解決]]します。
]FIG]

;; [54] このメソッドは現在の状態をたずねるだけにも関わらず、
[[非同期的]]な処理になっており、仕様書では要求が云々という記述もあります。
[[permission]] の取得に [[fetch]] が必要な場合や、
[[プラットフォーム]]の [[permission]] の確認に時間がかかることも想定しているのでしょうか。

[43] 
[[列挙型]]
[DFN[[CODE[PushPermissionState]]]]
は、
次のいずれかの値です。
[SRC[>>42]]

- [DFN[[CODE[granted]]]]: [[permission]] を有します。
- [DFN[[CODE[denied]]]]: [[permission]] を拒否されています。
- [DFN[[CODE[prompt]]]]: [[permission]] をたずねる必要があります。




* 利用者インターフェイス

[22] [[Webサイト]]によっては、最初の表示の際に承認を要求するので、
[[Webブラウザー]]によっては大きく表示されてとても邪魔です。

[EG[
[23] いくつかの読み物系のサイトは表示したときに[[通知]]権限を要求してきます。
たまたま開いただけでどんな記事のあるサイトか知らないうちから[[通知]]の承認を求めるのは、
ほとんど [[spam]] のようなものです。
]EG]

[24] [[Chrome]] では[[承認]]のポップアップで[[許可]]ボタンに[[フォーカス]]が当たるので、
うっかり [KBD[Enter]] を連打していると意図せず承認してしまうことがあり、
問題のあるインターフェイスです。 [TIME[2016-09-28T06:26:57.500Z]]

[25] [[Webブラウザー]]は、 [[triggered by user activation]] でない限り、
承認の要求を無視するか、目立たない表示にとどめておくべきだと思われます。

[34] [[Chrome]] の確認ポップアップはちょうど[[ブックマーク]]バーに重なるので、
いちいち消さないと下が押せなくてうざい。
[TIME[2018-04-21T04:24:18.400Z]]

* 歴史

[1] [CITE@en[Proposal for a Permissions API]]
( ([[Mounir Lamouri]] 著, [TIME[2014-09-02 22:51:38 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-webapps/2014JulSep/0389.html>

[2] [CITE[Permissions API - Google ドキュメント]]
( ([TIME[2014-09-04 13:00:40 +09:00]] 版))
<https://docs.google.com/a/chromium.org/document/d/12xnZ_8P6rTpcGxBHiDPPCe7AUyCar-ndg8lh2KwMYkM/preview>

[3] [CITE@en[Re: Rechartering: Permissions API]]
( ([[Mounir Lamouri]] 著, [TIME[2014-11-13 21:16:08 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-webappsec/2014Nov/0238.html>

[4] [CITE@en[The Permissions API]]
( ([TIME[2014-11-13 03:39:41 +09:00]] 版))
<https://w3c.github.io/permissions/>

[5] [CITE@en[The Permissions API]]
( ([TIME[2015-04-07 23:47:53 +09:00]] 版))
<http://www.w3.org/TR/2015/WD-permissions-20150407/>

[6] [CITE@en[dontcallmedom/web-permissions-req]]
( ([TIME[2014-08-13 09:56:34 +09:00]] 版))
<https://github.com/dontcallmedom/web-permissions-req/>

[7] [CITE@en[Re: Permissions API vs local APIs]]
([[Jonas Sicking]] 著, [TIME[2015-05-06 06:54:43 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webappsec/2015May/0010.html>

[FIG(quote)[
[FIGCAPTION[
[8] [CITE@en[Notifications meetup outcome]]
([[Anne van Kesteren]] 著, [TIME[2012-05-01 06:03:37 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-web-notification/2012Apr/0018.html>
]FIGCAPTION]

> We discussed the remaining two issues with the specification:
> * Given that the DAP WG is no longer working on the permissions  
> specification we will go with the proposal from Apple to expose the  
> permission model as static members of the Notification object.
> 

]FIG]


[9] [CITE@en[Permissions for Device API Access]]
( ([TIME[2015-07-13 14:01:13 +09:00]] 版))
<http://www.w3.org/TR/2015/NOTE-api-perms-20150714/>

[10] [CITE[Permissions for Device API Access]]
([TIME[2010-09-30 21:08:41 +09:00]] 版)
<http://www.w3.org/TR/2010/WD-api-perms-20101005/>

[11] [CITE@en[Permissions for Device API Access]]
([TIME[2015-06-19 01:25:19 +09:00]] 版)
<http://dev.w3.org/2009/dap/api-perms/>

[12] [CITE@en[Runtime and Security Model for Web Applications]]
([TIME[2015-08-04 19:31:42 +09:00]] 版)
<http://www.w3.org/TR/2015/NOTE-runtime-20150806/#permissions>

[13] [CITE@en[The Permissions API]]
([TIME[2015-08-26 19:01:12 +09:00]] 版)
<https://w3c.github.io/permissions/>

[14] [CITE@en[Reuse PermissionState from the Permissions API · whatwg/storage@a5ca15e]]
([TIME[2016-04-01 19:35:33 +09:00]] 版)
<https://github.com/whatwg/storage/commit/a5ca15e4322a9ef97026bfdd52e77fcf3dd9ebfa>

[15] [CITE@en[Rely on the Permissions API before it is ready · whatwg/storage@ed1e326]]
([TIME[2016-04-02 14:31:12 +09:00]] 版)
<https://github.com/whatwg/storage/commit/ed1e326951ea3a012477a4fb45471186bc72839b>

[16] [CITE@en[1165263 – Use origin for nsIPermissionManager]]
( ([TIME[2016-06-10 18:05:33 +09:00]]))
<https://bugzilla.mozilla.org/show_bug.cgi?id=1165263>

[17] [CITE@en[Re: VC meeting to discuss Permissions spec]]
( ([[Anne van Kesteren]]著, [TIME[2016-06-09 18:35:56 +09:00]]))
<https://lists.w3.org/Archives/Public/public-webappsec/2016Jun/0036.html>

[18] [CITE@en[Add note about permissions]]
( ([[andrey-logvinov]]著, [TIME[2016-06-20 19:27:46 +09:00]]))
<https://github.com/w3c/wake-lock/commit/440add20cd09d2c7a519ef9f77ccf9af707eda75>

[19] [CITE@en[Acknowledge that the permission prompt or heuristic might not result …]]
([[annevk]]著, [TIME[2016-06-24 17:10:59 +09:00]])
<https://github.com/whatwg/storage/commit/16cf7db48fec4425ac8a13b10a5bba10edf925eb>

[20] [CITE@en[Explain the intent behind the persistent permission]]
([[annevk]]著, [TIME[2016-06-25 16:29:28 +09:00]])
<https://github.com/whatwg/storage/commit/e1f556d4c62b7cb619048f853f6dd45bcf11bfb2>

[21] [CITE@en[Permissions store]]
([[Anne van Kesteren]]著, [TIME[2016-08-09 18:26:49 +09:00]])
<https://lists.w3.org/Archives/Public/public-webappsec/2016Aug/0002.html>

[27] [CITE@en[Requesting Permissions]]
([TIME[2017-09-22 03:24:48 +09:00]])
<https://jyasskin.github.io/permissions-request/>

[28] [CITE@en[Permissions]]
([TIME[2017-09-26 05:20:09 +09:00]])
<https://www.w3.org/TR/2017/WD-permissions-20170925/>

[29] [CITE@en[Update permission algorithm to link into Permission spec.]]
([[garykac]]著, [TIME[2017-10-24 08:01:03 +09:00]])
<https://github.com/w3c/clipboard-apis/commit/f3cf40df596ac8d9964b723187f9d801bd818538>

[30] [CITE@en[New in Chrome 63  |  Web  |  Google Developers]]
([TIME[2017-12-08 00:12:30 +09:00]])
<https://developers.google.com/web/updates/2017/12/nic63?utm_source=feed&utm_medium=feed&utm_campaign>

[31] [CITE[ビジネスパーソンに送るニュース情報サイト ビジネスジャーナル/Business Journal]] ([TIME[2018-01-12 15:30:43 +09:00]]) <http://biz-journal.jp/>

[32] このサイト、ページ読み込み時の規制を回避する目的なのか、
[[Chrome]] の通知許可ダイアログに見せかけたものを [[viewport]]
内に表示するようです。まるで[[フィッシングサイト]]ですね。
[TIME[2018-01-12T06:32:06.100Z]]

[33] [CITE@ja[はぜさんのツイート: "物件ファンさん @bukkenfan https://t.co/Iwo9HTJeeG のWebプッシュ通知バー良い. ほとんどのWebサイトが流入と同時にいきなり通知するか聞いてくるし最悪だけど, こういうのが広がってくれるととても嬉しい… https://t.co/otljEwdmIU"]]
([TIME[2018-03-08 18:08:31 +09:00]])
<https://twitter.com/haze_it_ac/status/967385442738843648>

[64] [CITE@en[Chromium Blog: Reducing abusive notification content]]
([TIME[2020-10-23T06:06:42.000Z]], [TIME[2020-10-24T01:05:49.535Z]])
<https://blog.chromium.org/2020/10/reducing-abusive-notification-content.html>