-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from w3c/master
Catch up to W3C master
- Loading branch information
Showing
1,676 changed files
with
18,633 additions
and
17,105 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
XMLHttpRequest/xmlhttprequest-sync-block-defer-scripts-subframe.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<script> | ||
var x = 0; | ||
</script> | ||
<!-- This script's URI is: | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('GET', 'data:text/plain,aaa', false); | ||
xhr.send(); | ||
x=1; | ||
--> | ||
<script defer src="data:application/javascript,var%20x%20=%200;%20var%20xhr%20=%20new%20XMLHttpRequest();%20xhr.open('GET',%20'data:text/plain,aaa',%20false);%20xhr.send();%20x=1"></script> | ||
|
||
<!-- This script's URI is: | ||
parent.postMessage(x, '*'); | ||
--> | ||
<script defer src="data:application/javascript,parent.postMessage(x, '*');"></script> | ||
|
15 changes: 15 additions & 0 deletions
15
XMLHttpRequest/xmlhttprequest-sync-block-defer-scripts.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Check that a sync XHR in a defer script blocks later defer scripts from running</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<!-- | ||
We run the test in a subframe, because something in the testharness stuff | ||
interferes with defer scripts --> | ||
<script> | ||
var t = async_test(); | ||
onmessage = t.step_func_done(function(e) { | ||
assert_equals(e.data, 1); | ||
}); | ||
</script> | ||
<iframe src="xmlhttprequest-sync-block-defer-scripts-subframe.html"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Check that while a sync XHR is in flight async script loads don't complete and run script</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<body> | ||
<script> | ||
var scriptRan = false; | ||
var onloadFired = false; | ||
test(function() { | ||
var s = document.createElement("script"); | ||
s.src = "data:application/javascript,scriptRan = true;"; | ||
s.onload = function() { onloadFired = true; } | ||
document.body.appendChild(s); | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open("GET", "data:,", false); | ||
xhr.send(); | ||
assert_false(scriptRan, "Script should not have run"); | ||
assert_false(onloadFired, "load event for <script> should not have fired"); | ||
}); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1944,9 +1944,12 @@ | |
"html/elements/source/src/userinfo-username-contains-pile-of-poo-novalid.html": "Bad value \u201chttp://\ud83d\udca9:[email protected]\u201d for attribute \u201csrc\u201d on element \u201csource\u201d: Bad URL: Illegal character in user or password: \u201c\ud83d\udca9\u201d is not allowed.", | ||
"html/elements/span/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.", | ||
"html/elements/strong/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.", | ||
"html/elements/style/scoped-as-div-child-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.", | ||
"html/elements/style/scoped-as-p-child-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cp\u201d.) Suppressing further errors from this subtree.", | ||
"html/elements/style/scoped-in-head-novalid.html": "Attribute \u201cscoped\u201d not allowed on element \u201cstyle\u201d in this context.", | ||
"html/elements/style/scoped-model-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.", | ||
"html/elements/style/scoped-multiple-adjacent-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.", | ||
"html/elements/style/scoped-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.", | ||
"html/elements/sub/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.", | ||
"html/elements/sup/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.", | ||
"html/elements/table/model-input-child-hidden-novalid.html": "Start tag \u201cinput\u201d seen in \u201ctable\u201d.", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<!DOCTYPE HTML> | ||
<meta charset="utf-8"> | ||
<title>EventListenerOptions.passive</title> | ||
<link rel="author" title="Rick Byers" href="mailto:[email protected]"> | ||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-addeventlisteneroptions-passive"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
|
||
<script> | ||
|
||
test(function() { | ||
var supportsPassive = false; | ||
var query_options = { | ||
get passive() { | ||
supportsPassive = true; | ||
return false; | ||
}, | ||
get dummy() { | ||
assert_unreached("dummy value getter invoked"); | ||
return false; | ||
} | ||
}; | ||
|
||
document.addEventListener('test_event', null, query_options); | ||
assert_true(supportsPassive, "addEventListener doesn't support the passive option"); | ||
|
||
supportsPassive = false; | ||
document.removeEventListener('test_event', null, query_options); | ||
assert_false(supportsPassive, "removeEventListener supports the passive option when it should not"); | ||
}, "Supports passive option on addEventListener only"); | ||
|
||
function testPassiveValue(optionsValue, expectedDefaultPrevented) { | ||
var defaultPrevented = undefined; | ||
var handler = function handler(e) { | ||
assert_false(e.defaultPrevented, "Event prematurely marked defaultPrevented"); | ||
e.preventDefault(); | ||
defaultPrevented = e.defaultPrevented; | ||
} | ||
document.addEventListener('test', handler, optionsValue); | ||
var uncanceled = document.body.dispatchEvent(new Event('test', {bubbles: true, cancelable: true})); | ||
|
||
assert_equals(defaultPrevented, expectedDefaultPrevented, "Incorrect defaultPrevented for options: " + JSON.stringify(optionsValue)); | ||
assert_equals(uncanceled, !expectedDefaultPrevented, "Incorrect return value from dispatchEvent"); | ||
|
||
document.removeEventListener('test', handler, optionsValue); | ||
} | ||
|
||
test(function() { | ||
testPassiveValue(undefined, true); | ||
testPassiveValue({}, true); | ||
testPassiveValue({passive: false}, true); | ||
testPassiveValue({passive: true}, false); | ||
testPassiveValue({passive: 0}, true); | ||
testPassiveValue({passive: 1}, false); | ||
}, "preventDefault should be ignored if-and-only-if the passive option is true"); | ||
|
||
function testPassiveWithOtherHandlers(optionsValue, expectedDefaultPrevented) { | ||
var handlerInvoked1 = false; | ||
var dummyHandler1 = function() { | ||
handlerInvoked1 = true; | ||
}; | ||
var handlerInvoked2 = false; | ||
var dummyHandler2 = function() { | ||
handlerInvoked2 = true; | ||
}; | ||
|
||
document.addEventListener('test', dummyHandler1, {passive:true}); | ||
document.addEventListener('test', dummyHandler2); | ||
|
||
testPassiveValue(optionsValue, expectedDefaultPrevented); | ||
|
||
assert_true(handlerInvoked1, "Extra passive handler not invoked"); | ||
assert_true(handlerInvoked2, "Extra non-passive handler not invoked"); | ||
|
||
document.removeEventListener('test', dummyHandler1); | ||
document.removeEventListener('test', dummyHandler2); | ||
} | ||
|
||
test(function() { | ||
testPassiveWithOtherHandlers({}, true); | ||
testPassiveWithOtherHandlers({passive: false}, true); | ||
testPassiveWithOtherHandlers({passive: true}, false); | ||
}, "passive behavior of one listener should be unaffeted by the presence of other listeners"); | ||
|
||
function testOptionEquivalence(optionValue1, optionValue2, expectedEquality) { | ||
var invocationCount = 0; | ||
var handler = function handler(e) { | ||
invocationCount++; | ||
} | ||
document.addEventListener('test', handler, optionValue1); | ||
document.addEventListener('test', handler, optionValue2); | ||
document.body.dispatchEvent(new Event('test', {bubbles: true})); | ||
assert_equals(invocationCount, expectedEquality ? 1 : 2, "equivalence of options " + | ||
JSON.stringify(optionValue1) + " and " + JSON.stringify(optionValue2)); | ||
document.removeEventListener('test', handler, optionValue1); | ||
document.removeEventListener('test', handler, optionValue2); | ||
} | ||
|
||
test(function() { | ||
// Sanity check options that should be treated as distinct handlers | ||
testOptionEquivalence({capture:true}, {capture:false, passive:false}, false); | ||
testOptionEquivalence({capture:true}, {passive:true}, false); | ||
|
||
// Option values that should be treated as equivalent | ||
testOptionEquivalence({}, {passive:false}, true); | ||
testOptionEquivalence({passive:true}, {passive:false}, true); | ||
testOptionEquivalence(undefined, {passive:true}, true); | ||
testOptionEquivalence({capture: true, passive: false}, {capture: true, passive: true}, true); | ||
|
||
}, "Equivalence of option values"); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title></title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<iframe src="{{location[scheme]}}://{{domains[www1]}}:{{ports[http][0]}}{{location[path]}}/../EventListener-incumbent-global-subframe-1.sub.html"></iframe> | ||
<script> | ||
|
||
var t = async_test("Check the incumbent global EventListeners are called with"); | ||
|
||
onload = t.step_func(function() { | ||
onmessage = t.step_func_done(function(e) { | ||
var d = e.data; | ||
assert_equals(d.actual, d.expected, d.reason); | ||
}); | ||
|
||
frames[0].postMessage("start", "*"); | ||
}); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title></title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<iframe src="{{location[scheme]}}://{{domains[www1]}}:{{ports[http][0]}}{{location[path]}}/../EventListener-incumbent-global-subframe-2.sub.html"></iframe> | ||
<script> | ||
|
||
var t = async_test("Check the incumbent global EventListeners are called with"); | ||
|
||
onload = t.step_func(function() { | ||
onmessage = t.step_func_done(function(e) { | ||
var d = e.data; | ||
assert_equals(d.actual, d.expected, d.reason); | ||
}); | ||
|
||
frames[0].postMessage("start", "*"); | ||
}); | ||
|
||
</script> |
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
dom/events/EventListener-incumbent-global-subframe-2.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<iframe src="{{location[scheme]}}://{{domains[www2]}}:{{ports[http][0]}}{{location[path]}}/../EventListener-incumbent-global-subsubframe.sub.html"></iframe> | ||
<script> | ||
document.domain = "{{host}}"; | ||
onmessage = function(e) { | ||
if (e.data == "start") { | ||
frames[0].document.body.addEventListener("click", frames[0].getTheListener()); | ||
frames[0].postMessage("sendclick", "*"); | ||
} else { | ||
parent.postMessage(e.data, "*"); | ||
} | ||
} | ||
</script> |
3 changes: 3 additions & 0 deletions
3
dom/events/EventListener-incumbent-global-subsubframe.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.