mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #9755 - jdm:handlerreturn, r=jdm
use return value of invoking event handlers to cancel the event Rebased from #8707. Fixes #8490. We can modify the code and test as necessary whenever we make a decision about https://github.com/whatwg/html/issues/423 in the future. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9755) <!-- Reviewable:end -->
This commit is contained in:
commit
8bdffa25f9
9 changed files with 141 additions and 58 deletions
|
@ -34512,7 +34512,16 @@
|
|||
},
|
||||
"local_changes": {
|
||||
"deleted": [],
|
||||
"items": {},
|
||||
"items": {
|
||||
"testharness": {
|
||||
"html/webappapis/scripting/events/event-handler-processing-algorithm.html": [
|
||||
{
|
||||
"path": "html/webappapis/scripting/events/event-handler-processing-algorithm.html",
|
||||
"url": "/html/webappapis/scripting/events/event-handler-processing-algorithm.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"reftest_nodes": {}
|
||||
},
|
||||
"reftest_nodes": {
|
||||
|
|
|
@ -75,9 +75,6 @@
|
|||
[Document interface: attribute onautocompleteerror]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute onblur]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute oncancel]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -96,9 +93,6 @@
|
|||
[Document interface: attribute oncuechange]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute ondblclick]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute ondrag]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -162,9 +156,6 @@
|
|||
[Document interface: attribute onmouseout]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute onmouseover]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: attribute onmouseup]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1611,9 +1602,6 @@
|
|||
[HTMLElement interface: attribute onautocompleteerror]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: attribute onblur]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: attribute oncancel]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1632,9 +1620,6 @@
|
|||
[HTMLElement interface: attribute oncuechange]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: attribute ondblclick]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: attribute ondrag]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1698,9 +1683,6 @@
|
|||
[HTMLElement interface: attribute onmouseout]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: attribute onmouseover]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: attribute onmouseup]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1839,9 +1821,6 @@
|
|||
[HTMLElement interface: document.createElement("noscript") must inherit property "onautocompleteerror" with the proper type (34)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: document.createElement("noscript") must inherit property "onblur" with the proper type (35)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: document.createElement("noscript") must inherit property "oncancel" with the proper type (36)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1860,9 +1839,6 @@
|
|||
[HTMLElement interface: document.createElement("noscript") must inherit property "oncuechange" with the proper type (43)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: document.createElement("noscript") must inherit property "ondblclick" with the proper type (44)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: document.createElement("noscript") must inherit property "ondrag" with the proper type (45)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1926,9 +1902,6 @@
|
|||
[HTMLElement interface: document.createElement("noscript") must inherit property "onmouseout" with the proper type (71)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: document.createElement("noscript") must inherit property "onmouseover" with the proper type (72)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement interface: document.createElement("noscript") must inherit property "onmouseup" with the proper type (73)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8610,9 +8583,6 @@
|
|||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onautocompleteerror" with the proper type (96)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onblur" with the proper type (97)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncancel" with the proper type (98)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8631,9 +8601,6 @@
|
|||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncuechange" with the proper type (105)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondblclick" with the proper type (106)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondrag" with the proper type (107)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8697,9 +8664,6 @@
|
|||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseout" with the proper type (133)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseover" with the proper type (134)]
|
||||
expected: FAIL
|
||||
|
||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseup" with the proper type (135)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
[event-handler-attributes-body-window.html]
|
||||
type: testharness
|
||||
[blur]
|
||||
expected: FAIL
|
||||
|
||||
[error]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[event-handler-processing-algorithm.html]
|
||||
type: testharness
|
||||
[beforeunload listener returning null cancels event]
|
||||
expected: FAIL
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Event handlers processing algorithm</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script
|
||||
<body>
|
||||
<div id="foo" style="width: 100px; height: 100px; background-color: black"></div>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var ev = new Event('mouseover', {cancelable: true});
|
||||
document.getElementById("foo").onmouseover = t.step_func(function() { return true });
|
||||
document.getElementById("foo").dispatchEvent(ev);
|
||||
assert_equals(ev.defaultPrevented, true)
|
||||
t.done();
|
||||
}, "mouseover listener returning true cancels event");
|
||||
|
||||
async_test(function(t) {
|
||||
var ev = new Event('mouseover', {cancelable: true});
|
||||
document.getElementById("foo").onmouseover = t.step_func(function() { return false; });
|
||||
document.getElementById("foo").dispatchEvent(ev);
|
||||
assert_equals(ev.defaultPrevented, false);
|
||||
t.done();
|
||||
}, "mouseover listener returning false doesn't cancel event");
|
||||
|
||||
async_test(function(t) {
|
||||
var ev = new Event('beforeunload', {cancelable: true});
|
||||
window.onbeforeunload = t.step_func(function() {return null});
|
||||
window.dispatchEvent(ev);
|
||||
assert_equals(ev.defaultPrevented, true);
|
||||
t.done();
|
||||
}, "beforeunload listener returning null cancels event");
|
||||
|
||||
async_test(function(t) {
|
||||
var ev = new Event('beforeunload', {cancelable: true});
|
||||
window.onbeforeunload = t.step_func(function() {return true});
|
||||
window.dispatchEvent(ev);
|
||||
assert_equals(ev.defaultPrevented, false);
|
||||
t.done();
|
||||
}, "beforeunload listener returning non-null doesn't cancel event");
|
||||
|
||||
async_test(function(t) {
|
||||
var ev = new Event("click", {cancelable: true});
|
||||
document.getElementById("foo").onclick = t.step_func(function() { return false; });
|
||||
document.getElementById("foo").dispatchEvent(ev);
|
||||
assert_equals(ev.defaultPrevented, true);
|
||||
t.done();
|
||||
}, "click listener returning false cancels event");
|
||||
|
||||
async_test(function(t) {
|
||||
var ev = new Event("blur", {cancelable: true});
|
||||
document.getElementById("foo").onblur = t.step_func(function() { return false; });
|
||||
document.getElementById("foo").dispatchEvent(ev);
|
||||
assert_equals(ev.defaultPrevented, true);
|
||||
t.done();
|
||||
}, "blur listener returning false cancels event");
|
||||
|
||||
async_test(function(t) {
|
||||
var ev = new Event("dblclick", {cancelable: true});
|
||||
document.getElementById("foo").ondblclick = t.step_func(function() { return false; });
|
||||
document.getElementById("foo").dispatchEvent(ev);
|
||||
assert_equals(ev.defaultPrevented, true);
|
||||
t.done();
|
||||
}, "dblclick listener returning false cancels event");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue