@@ -118,8 +118,8 @@ time providing implementations with a better signal of user intent.
118
118
<dd> {{HTMLPermissionElement/type}} — Type of permission this element applies to.</dd>
119
119
<dd> {{HTMLPermissionElement/isValid}} — query whether the element can currently be activated.</dd>
120
120
<dd> {{HTMLPermissionElement/invalidReason}} — Return a string representation of why the element currently cannot be activated.</dd>
121
- <dd> {{HTMLPermissionElement/ondismiss }} — notifies when the user has dismissed the permission prompt.</dd>
122
- <dd> {{HTMLPermissionElement/onresolve }} — notifies when a permission prompt has been answered by the user (positively or negatively).</dd>
121
+ <dd> {{HTMLPermissionElement/onpromptdismiss }} — notifies when the user has dismissed the permission prompt.</dd>
122
+ <dd> {{HTMLPermissionElement/onpromptaction }} — notifies when a permission prompt has been answered by the user (positively or negatively).</dd>
123
123
<dd> {{HTMLPermissionElement/onvalidationstatuschange}} — notifies when the validation status changes.</dd>
124
124
<dt> [=Accessibility considerations=] :</dt>
125
125
<dd></dd>
@@ -134,8 +134,8 @@ time providing implementations with a better signal of user intent.
134
134
readonly attribute boolean isValid;
135
135
readonly attribute PermissionElementBlockerReason invalidReason;
136
136
137
- attribute EventHandler onresolve ;
138
- attribute EventHandler ondismiss ;
137
+ attribute EventHandler onpromptaction ;
138
+ attribute EventHandler onpromptdismiss ;
139
139
attribute EventHandler onvalidationstatuschange;
140
140
};
141
141
</pre>
@@ -168,8 +168,8 @@ observed by the <{permission}> element to select localized text.
168
168
The following are the [=event handlers=] (and their corresponding [=event handler event types=] ) that must be supported on <{permission}> elements [=event handler IDL attributes=] :
169
169
170
170
<pre class=simpledef>
171
- onresolve : Event
172
- ondismiss : Event
171
+ onpromptaction : Event
172
+ onpromptdismiss : Event
173
173
onvalidationstatuschange: Event
174
174
</pre>
175
175
@@ -210,9 +210,15 @@ The <{permission}> element has the following internal slots:
210
210
211
211
* <dfn attribute for="HTMLPermissionElement">\[[LastNotifiedValidState]]</dfn>
212
212
is a [=boolean=] that stores the most recently notified state of
213
- {{HTMLPermissionElement/isValid}} . This is used to determine whether
214
- an {{HTMLPermissionElement/onvalidationstatuschange}} event needs to
215
- be thrown.
213
+ {{HTMLPermissionElement/isValid}} .
214
+
215
+ * <dfn attribute for="HTMLPermissionElement">\[[LastNotifiedInvalidReason]]</dfn>
216
+ is a [=string=] that stores the most recently notified state of
217
+ {{HTMLPermissionElement/invalidReason}} .
218
+ {{[[LastNotifiedValidState]]}} and {{[[LastNotifiedInvalidReason]]}} are
219
+ used to determine whether an
220
+ {{HTMLPermissionElement/onvalidationstatuschange}} event needs to be
221
+ dispatches.
216
222
217
223
## <{permission}> -supporting state at the [=/navigable=] ## {#permission-element-external-state}
218
224
@@ -471,6 +477,8 @@ The {{HTMLPermissionElement}} constructor steps are:
471
477
1. Initialize the internal {{[[Types]]}} slot to null.
472
478
1. Initialize the internal {{[[BlockerList]]}} to «[]».
473
479
1. Initialize the internal {{[[LastNotifiedValidState]]}} with false.
480
+ 1. Initialize the internal {{[[LastNotifiedInvalidReason]]}} with the empty
481
+ string.
474
482
475
483
</div>
476
484
@@ -530,20 +538,22 @@ A <{permission}> |element|'s [=EventTarget/activation behavior=] given |event| i
530
538
1. If |element|'s {{[[Types]]}} [=list/is empty=] , then return.
531
539
1. If |event|.{{Event/isTrusted}} is false, then return.
532
540
1. If |element|.{{HTMLPermissionElement/isValid}} is false, then return.
533
- 1. Let |result| be the result of [=request permission to use=] the
534
- [=powerful features=] named in |element|'s {{[[Types]]}} .
535
- 1. If |result| is `cancel`, [=dispatch ondismiss=] on [=this=] and return.
541
+ 1. [=Request permission to use=] the [=powerful features=] named in
542
+ |element|'s {{[[Types]]}} .
543
+ 1. If the previous step was cancelled or dismissed by the user, then
544
+ [=dispatch onpromptdismiss=] on [=this=] and return.
536
545
537
546
Issue: The [[PERMISSIONS]] spec assumes that [=request permission to use=]
538
- will always succeed. That is, it assumed that the user will always make a
547
+ will always succeed. That is, it assumes that the user will always make a
539
548
choice and that the algorithm will always deliver a `grant`/`deny`
540
549
answer corresponding to that choice. But you can't force a user to do that.
541
- Some (or all?) [=user agents=] will allow a user to just close the dialog
542
- box without making a choice.
543
- Here, we will pretend this non-choice result is represented by the result
544
- `cancel`.
550
+ Some [=user agents=] may have different UI affordances for an explicit
551
+ denial (e.g. a "deny" button) on one hand, and cancelling or dismissing the
552
+ request dialog (e.g. an "X" button in the top right corner). Here, we
553
+ distinguish between these two actions, despite no clear hook for this
554
+ in the underlying specification.
545
555
546
- 1. [=Dispatch onresolve =] on [=this=] .
556
+ 1. [=Dispatch onpromptaction =] on [=this=] .
547
557
548
558
</div>
549
559
@@ -609,10 +619,14 @@ To <dfn for="HTMLPermissionElement">recheck type permissibility</dfn> for a
609
619
<div algorithm>
610
620
To <dfn for=HTMLPermissionElement>maybe dispatch onvalidstatechange</dfn> for |element|:
611
621
612
- 1. Let |old| be {{[[LastNotifiedValidState]]}} .
613
- 1. Let |new| be whether |element|’s [=blocker=] is Nothing.
614
- 1. Set {{[[LastNotifiedValidState]]}} to |new|.
615
- 1. If |old| != |new|, then:
622
+ 1. Let |oldState| be {{[[LastNotifiedValidState]]}} .
623
+ 1. Let |newState| be whether |element|’s [=blocker=] is Nothing.
624
+ 1. Set {{[[LastNotifiedValidState]]}} to |newState|.
625
+ 1. Let |oldReason| be {{[[LastNotifiedInvalidReason]]}} .
626
+ 1. Let |newReason| be whether |element|’s
627
+ {{HTMLPermissionElement/invalidReason}} .
628
+ 1. Set {{[[LastNotifiedInvalidReason]]}} to |newReason|.
629
+ 1. If |oldState| != |newState| or |oldReason| != |newReason|, then:
616
630
1. Let |event| be a new {{Event}} .
617
631
1. [=Event/Initialize=] |event| with
618
632
<a argument for="Event/initEvent(type, bubbles, cancelable)">type</a>
@@ -626,12 +640,12 @@ To <dfn for=HTMLPermissionElement>maybe dispatch onvalidstatechange</dfn> for |e
626
640
</div>
627
641
628
642
<div algorithm>
629
- To <dfn for=HTMLPermisssionElement>dispatch onresolve </dfn> for |element|:
643
+ To <dfn for=HTMLPermisssionElement>dispatch onpromptaction </dfn> for |element|:
630
644
631
645
1. Let |event| be a new {{Event}} .
632
646
1. [=Event/Initialize=] |event| with
633
647
<a argument for="Event/initEvent(type, bubbles, cancelable)">type</a>
634
- "{{HTMLPermissionElement/onresolve }} ",
648
+ "{{HTMLPermissionElement/onpromptaction }} ",
635
649
<a argument for="Event/initEvent(type, bubbles, cancelable)">bubbles</a>
636
650
true, and
637
651
<a argument for="Event/initEvent(type, bubbles, cancelable)">cancelable</a>
@@ -641,12 +655,12 @@ To <dfn for=HTMLPermisssionElement>dispatch onresolve</dfn> for |element|:
641
655
</div>
642
656
643
657
<div algorithm>
644
- To <dfn for=HTMLPermisssionElement>dispatch ondismiss </dfn> for |element|:
658
+ To <dfn for=HTMLPermisssionElement>dispatch onpromptdismiss </dfn> for |element|:
645
659
646
660
1. Let |event| be a new {{Event}} .
647
661
1. [=Event/Initialize=] |event| with
648
662
<a argument for="Event/initEvent(type, bubbles, cancelable)">type</a>
649
- "{{HTMLPermissionElement/ondismiss }} ",
663
+ "{{HTMLPermissionElement/onpromptdismiss }} ",
650
664
<a argument for="Event/initEvent(type, bubbles, cancelable)">bubbles</a>
651
665
true, and
652
666
<a argument for="Event/initEvent(type, bubbles, cancelable)">cancelable</a>
0 commit comments