Bug 1727302 - Add onsecuritypolicyviolation event handler.r=smaug

`onsecuritypolicyviolation` attribute has been added to `GlobalEventHandlers` by https://github.com/whatwg/html/pull/2651

List of tests:
1. w3c/web-platform-tests/dom/idlharness.window.html
2. w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-all-global-events.html
3. w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html
4. w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html

This new spec addition is already implemented in Safari[0] recently and Chromium[1] will be working on it soon.

[0] https://bugs.webkit.org/show_bug.cgi?id=229381
[1] https://bugs.chromium.org/p/chromium/issues/detail?id=1242893

Differential Revision: https://phabricator.services.mozilla.com/D123891
This commit is contained in:
Sonia Singla 2021-08-29 18:05:01 +00:00
parent 797c9f2e3b
commit 5a362eb7d0
10 changed files with 7 additions and 80 deletions

View file

@ -233,6 +233,8 @@ EVENT(playing, ePlaying, EventNameType_HTML, eBasicEventClass)
EVENT(progress, eProgress, EventNameType_HTML, eBasicEventClass)
EVENT(ratechange, eRateChange, EventNameType_HTML, eBasicEventClass)
EVENT(reset, eFormReset, EventNameType_HTMLXUL, eBasicEventClass)
EVENT(securitypolicyviolation, eSecurityPolicyViolation, EventNameType_All,
eBasicEventClass)
EVENT(seeked, eSeeked, EventNameType_HTML, eBasicEventClass)
EVENT(seeking, eSeeking, EventNameType_HTML, eBasicEventClass)
EVENT(select, eFormSelect, EventNameType_HTMLXUL, eBasicEventClass)

View file

@ -80,6 +80,7 @@ interface mixin GlobalEventHandlers {
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onsecuritypolicyviolation;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;

View file

@ -177,9 +177,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
[VideoTrackList interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[SVGElement interface: attribute onsecuritypolicyviolation]
expected: FAIL
[OffscreenCanvasRenderingContext2D interface: operation quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double)]
expected: FAIL
@ -685,11 +682,7 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
[OffscreenCanvasRenderingContext2D interface: operation createConicGradient(double, double, double)]
expected: FAIL
[idlharness.https.html?include=(Document|Window)]
[Document interface: documentWithHandlers must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[Window interface: window must have own property "window"]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
expected:
@ -702,21 +695,12 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
if release_or_beta: PASS
FAIL
[Window interface: attribute onsecuritypolicyviolation]
expected: FAIL
[Window interface: window must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[Window interface: window must have own property "top"]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
expected:
if release_or_beta: PASS
FAIL
[Document interface: new Document() must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[Document interface: new Document() must inherit property "oncancel" with the proper type]
expected: FAIL
@ -726,18 +710,12 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
if release_or_beta: PASS
FAIL
[Document interface: attribute onsecuritypolicyviolation]
expected: FAIL
[Document interface: attribute oncancel]
expected: FAIL
[Window interface: window must inherit property "oncancel" with the proper type]
expected: FAIL
[Document interface: iframe.contentDocument must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[Document interface: documentWithHandlers must inherit property "oncancel" with the proper type]
expected: FAIL
@ -791,9 +769,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
[HTMLTextAreaElement interface: attribute dirName]
expected: FAIL
[HTMLElement interface: attribute onsecuritypolicyviolation]
expected: FAIL
[HTMLInputElement interface: createInput("time") must inherit property "dirName" with the proper type]
expected: FAIL
@ -911,9 +886,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
[HTMLMediaElement interface: document.createElement("video") must inherit property "audioTracks" with the proper type]
expected: FAIL
[HTMLElement interface: document.createElement("noscript") must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[HTMLMediaElement interface: document.createElement("audio") must inherit property "getStartDate()" with the proper type]
expected: FAIL

View file

@ -10,15 +10,3 @@
[oncancel: the content attribute must execute when an event is dispatched]
expected: FAIL
[onsecuritypolicyviolation: must be on the appropriate locations for GlobalEventHandlers]
expected: FAIL
[onsecuritypolicyviolation: the default value must be null]
expected: FAIL
[onsecuritypolicyviolation: the content attribute must be compiled into a function as the corresponding property]
expected: FAIL
[onsecuritypolicyviolation: the content attribute must execute when an event is dispatched]
expected: FAIL

View file

@ -2,9 +2,6 @@
[not shadowed cancel (document.body)]
expected: FAIL
[not shadowed securitypolicyviolation (document.body)]
expected: FAIL
[not shadowed copy (document.body)]
expected: FAIL
@ -17,9 +14,6 @@
[not shadowed cancel (document.createElement("body"))]
expected: FAIL
[not shadowed securitypolicyviolation (document.createElement("body"))]
expected: FAIL
[not shadowed copy (document.createElement("body"))]
expected: FAIL
@ -29,9 +23,6 @@
[not shadowed paste (document.createElement("body"))]
expected: FAIL
[not shadowed securitypolicyviolation (window)]
expected: FAIL
[not shadowed cancel (window)]
expected: FAIL

View file

@ -5,12 +5,6 @@
[not shadowed paste (document.createElement("frameset"))]
expected: FAIL
[not shadowed securitypolicyviolation (document.body)]
expected: FAIL
[not shadowed securitypolicyviolation (document.createElement("frameset"))]
expected: FAIL
[not shadowed cut (document.body)]
expected: FAIL
@ -29,9 +23,6 @@
[not shadowed cut (document.createElement("frameset"))]
expected: FAIL
[not shadowed securitypolicyviolation (window)]
expected: FAIL
[not shadowed cancel (window)]
expected: FAIL

View file

@ -2,12 +2,5 @@
[cancel is unaffected on a windowless body]
expected: FAIL
[securitypolicyviolation is unaffected on a windowless body]
expected: FAIL
[cancel is unaffected on a windowless frameset]
expected: FAIL
[securitypolicyviolation is unaffected on a windowless frameset]
expected: FAIL

View file

@ -1,7 +1,4 @@
[math-global-event-handlers.tentative.html]
[onsecuritypolicyviolation: dispatching an Event at a <math> element must trigger element.onsecuritypolicyviolation]
expected: FAIL
[oncancel: the default value must be null]
expected: FAIL
@ -16,15 +13,3 @@
[oncancel: dynamic changes on the attribute]
expected: FAIL
[onsecuritypolicyviolation: dynamic changes on the attribute]
expected: FAIL
[onsecuritypolicyviolation: the default value must be null]
expected: FAIL
[onsecuritypolicyviolation: must be on the appropriate locations for GlobalEventHandlers]
expected: FAIL
[onsecuritypolicyviolation: the content attribute must be compiled into a function as the corresponding property]
expected: FAIL

View file

@ -462,6 +462,9 @@ NS_EVENT_MESSAGE(eSlotChange)
// visibility change
NS_EVENT_MESSAGE(eVisibilityChange)
// security policy events
NS_EVENT_MESSAGE(eSecurityPolicyViolation)
// Details element events.
NS_EVENT_MESSAGE(eToggle)

View file

@ -889,6 +889,7 @@ STATIC_ATOMS = [
Atom("onreset", "onreset"),
Atom("onresize", "onresize"),
Atom("onscroll", "onscroll"),
Atom("onsecuritypolicyviolation", "onsecuritypolicyviolation"),
Atom("onselect", "onselect"),
Atom("onselectionchange", "onselectionchange"),
Atom("onselectend", "onselectend"),