Skip to content

Commit

Permalink
Merge pull request #2 from w3c/master
Browse files Browse the repository at this point in the history
Catch up to W3C master
  • Loading branch information
engelke committed Jun 9, 2016
2 parents 5fd7a89 + 747525a commit 5976245
Show file tree
Hide file tree
Showing 1,676 changed files with 18,633 additions and 17,105 deletions.
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 XMLHttpRequest/xmlhttprequest-sync-block-defer-scripts.html
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>
22 changes: 22 additions & 0 deletions XMLHttpRequest/xmlhttprequest-sync-block-scripts.html
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>
10 changes: 5 additions & 5 deletions battery-status/battery-promise.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@
var originalPromise = iframe.contentWindow.navigator.getBattery();

iframe.onload = t.step_func(function() {
assert_not_equals(iframe.contentWindow.navigator,
assert_equals(iframe.contentWindow.navigator,
originalNavigator,
'navigator objects shall be changed');
assert_not_equals(iframe.contentWindow.navigator.getBattery(),
'navigator objects shall be same');
assert_equals(iframe.contentWindow.navigator.getBattery(),
originalPromise,
'battery status promises shall be different');
'battery status promises shall be same');
t.done();
});
iframe.src = 'support-iframe.html';
}, 'setting iframe\'s src makes its Navigator object vary thus getting another battery promise');
}, 'setting iframe\'s src makes same Navigator object and battery promise');

async_test(function (t) {
var win = window.open('support-window-open.html');
Expand Down
3 changes: 3 additions & 0 deletions conformance-checkers/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 2 additions & 2 deletions cors/response-headers.htm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h1>Response headers</h1>
}
if (client.readyState > 1)
{
assert_equals(client.getResponseHeader("x-custom-header"), "test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-custom-header"), "test, test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-custom-header-empty"), "", 'x-custom-header-empty')
assert_equals(client.getResponseHeader("set-cookie"), null)
assert_equals(client.getResponseHeader("set-cookie2"), null)
Expand All @@ -86,7 +86,7 @@ <h1>Response headers</h1>
var client = new XMLHttpRequest()
client.open('GET', CROSSDOMAIN + 'resources/cors-headers.asis', false)
client.send(null)
assert_equals(client.getResponseHeader("x-custom-header"), "test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-custom-header"), "test, test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-nonexposed"), null, 'x-nonexposed')
}, "getResponse: don't expose x-nonexposed")

Expand Down
113 changes: 113 additions & 0 deletions dom/events/AddEventListenerOptions-passive.html
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>
20 changes: 20 additions & 0 deletions dom/events/EventListener-incumbent-global-1.sub.html
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>
20 changes: 20 additions & 0 deletions dom/events/EventListener-incumbent-global-2.sub.html
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>
13 changes: 13 additions & 0 deletions dom/events/EventListener-incumbent-global-subframe-2.sub.html
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>
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<!DOCTYPE html>
<script>
function getTheListener() {
return postMessage.bind(this, "respond", "*", undefined)
}
document.domain = "{{host}}";
onmessage = function (e) {
if (e.data == "sendclick") {
Expand Down
20 changes: 0 additions & 20 deletions dom/events/EventListener-incumbent-global.sub.html

This file was deleted.

6 changes: 3 additions & 3 deletions dom/events/EventListenerOptions-capture.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
handlerPhase = e.eventPhase;
}
document.addEventListener('test', handler, captureValue);
document.body.dispatchEvent(new Event('test', {'bubbles': true}));
document.body.dispatchEvent(new Event('test', {bubbles: true}));
document.removeEventListener('test', handler, captureValue);
document.body.dispatchEvent(new Event('test', {'bubbles': true}));
document.body.dispatchEvent(new Event('test', {bubbles: true}));
assert_equals(handlerPhase, expectedValue, "Incorrect event phase for value: " + JSON.stringify(captureValue));
}

Expand Down Expand Up @@ -72,7 +72,7 @@
}
document.addEventListener('test', handler, addOptionValue);
document.removeEventListener('test', handler, removeOptionValue);
document.body.dispatchEvent(new Event('test', {'bubbles': true}));
document.body.dispatchEvent(new Event('test', {bubbles: true}));
assert_equals(!handlerInvoked, expectedEquality, "equivalence of options " +
JSON.stringify(addOptionValue) + " and " + JSON.stringify(removeOptionValue));
if (handlerInvoked)
Expand Down
3 changes: 2 additions & 1 deletion dom/historical.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
"isSupported",
"getFeature",
"getUserData",
"setUserData"
"setUserData",
"rootNode",
]
nodeNuked.forEach(isNukedFromNode)

Expand Down
1 change: 0 additions & 1 deletion dom/interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ <h1>DOM IDL tests</h1>

readonly attribute boolean isConnected;
readonly attribute Document? ownerDocument;
readonly attribute Node rootNode;
readonly attribute Node? parentNode;
readonly attribute Element? parentElement;
boolean hasChildNodes();
Expand Down
Loading

0 comments on commit 5976245

Please sign in to comment.