@@ -493,7 +493,7 @@ The {{HTMLPermissionElement}} [=insertion steps=] are:
493
493
[=this=]
494
494
is a [=fenced navigable=] , then [=add a permanent blocker=]
495
495
with {{PermissionElementBlockerReason/illegal_subframe}} .
496
- 1. [=Maybe trigger an onvalidstatechange event =] on [=this=] .
496
+ 1. [=Maybe dispatch onvalidstatechange=] on [=this=] .
497
497
498
498
</div>
499
499
@@ -502,7 +502,7 @@ The {{HTMLPermissionElement}} [=removing steps=] are:
502
502
503
503
1. [=list/Remove=] [=this=] from [=node navigable=] 's {{[[PermissionElements]]}} .
504
504
1. [=Recheck type permissibility=] for [=this=] 's [=node navigable=] .
505
- 1. [=Maybe trigger an onvalidstatechange event =] on [=this=] .
505
+ 1. [=Maybe dispatch onvalidstatechange=] on [=this=] .
506
506
507
507
</div>
508
508
@@ -528,14 +528,21 @@ A <{permission}> |element|'s [=EventTarget/activation behavior=] given |event| i
528
528
1. If |element|'s {{[[Types]]}} [=list/is empty=] , then return.
529
529
1. If |event|.{{Event/isTrusted}} is false, then return.
530
530
1. If |element|.{{HTMLPermissionElement/isValid}} is false, then return.
531
- 1. [=Request permission to use=] the [=powerful features=] named in
532
- |element|'s {{[[Types]]}} .
533
- 1. [=Dispatch onresolve=] on [=this=] .
531
+ 1. Let |result| be the result of [=request permission to use=] the
532
+ [=powerful features=] named in |element|'s {{[[Types]]}} .
533
+ 1. If |result| is `cancel`, [=dispatch ondismiss=] on [=this=] and return.
534
+
535
+ Issue: The [[PERMISSIONS]] spec assumes that [=request permission to use=]
536
+ will always succeed. That is, it assumed that the user will always make a
537
+ choice and that the algorithm will always deliver a `grant`/`deny`
538
+ answer corresponding to that choice. But you can't force a user to do that.
539
+ Some (or all?) [=user agents=] will allow a user to just close the dialog
540
+ box without making a choice.
541
+ Here, we will pretend this non-choice result is represented by the result
542
+ `cancel`.
534
543
535
- Issue: What about event handlers?
544
+ 1. [=Dispatch onresolve=] on [=this=] .
536
545
537
- Issue: What about dismissal? The Permission spec doesn't seem to know about
538
- dismissals.
539
546
</div>
540
547
541
548
<div algorithm="HTMLPermissionElement/IntersectionObserver callback">
@@ -562,7 +569,7 @@ The HTMLPermissionElement's <dfn for="HTMLPermissionElement">IntersectionObserve
562
569
{{PermissionElementBlockerReason/intersection_changed}} .
563
570
1. Set {{[[IntersectionRect]]}} to
564
571
|entry|.{{IntersectionObserverEntry/intersectionRect}}
565
- 1. [=Maybe trigger an onvalidstatechange event =] on [=this=] .
572
+ 1. [=Maybe dispatch onvalidstatechange=] on [=this=] .
566
573
567
574
ISSUE: Do I need to define dictionary equality?
568
575
</div>
@@ -598,18 +605,20 @@ To <dfn for="HTMLPermissionElement">recheck type permissibility</dfn> for a
598
605
## <{permission}> element event algorithms ## {#events}
599
606
600
607
<div algorithm>
601
- To <dfn for=HTMLPermissionElement>maybe trigger an onvalidstatechange
602
- event</dfn> for |element|:
608
+ To <dfn for=HTMLPermissionElement>maybe dispatch onvalidstatechange</dfn> for |element|:
603
609
604
610
1. Let |old| be {{[[LastNotifiedValidState]]}} .
605
611
1. Let |new| be whether |element|’s [=blocker=] is Nothing.
606
612
1. Set {{[[LastNotifiedValidState]]}} to |new|.
607
613
1. If |old| != |new|, then:
608
614
1. Let |event| be a new {{Event}} .
609
615
1. [=Event/Initialize=] |event| with
610
- type "{{HTMLPermissionElement/onvalidationstatuschange}} ",
611
- bubbles as true, and
612
- canceable as true.
616
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">type</a>
617
+ "{{HTMLPermissionElement/onvalidationstatuschange}} ",
618
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">bubbles</a>
619
+ true, and
620
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">cancelable</a>
621
+ true.
613
622
1. [=/Dispatch=] |event| to |element|.
614
623
615
624
</div>
@@ -618,8 +627,28 @@ event</dfn> for |element|:
618
627
To <dfn for=HTMLPermisssionElement>dispatch onresolve</dfn> for |element|:
619
628
620
629
1. Let |event| be a new {{Event}} .
621
- 1. [=Event/Initialize=] |event| with type "{{HTMLPermissionElement/onresolve}} ",
622
- bubbles as true, and canceable as true.
630
+ 1. [=Event/Initialize=] |event| with
631
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">type</a>
632
+ "{{HTMLPermissionElement/onresolve}} ",
633
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">bubbles</a>
634
+ true, and
635
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">cancelable</a>
636
+ true.
637
+ 1. [=/Dispatch=] |event| to |element|.
638
+
639
+ </div>
640
+
641
+ <div algorithm>
642
+ To <dfn for=HTMLPermisssionElement>dispatch ondismiss</dfn> for |element|:
643
+
644
+ 1. Let |event| be a new {{Event}} .
645
+ 1. [=Event/Initialize=] |event| with
646
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">type</a>
647
+ "{{HTMLPermissionElement/ondismiss}} ",
648
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">bubbles</a>
649
+ true, and
650
+ <a argument for="Event/initEvent(type, bubbles, cancelable)">cancelable</a>
651
+ true.
623
652
1. [=/Dispatch=] |event| to |element|.
624
653
625
654
</div>
0 commit comments