Update web-platform-tests to revision e8bfc205e36ad699601212cd50083870bad9a75d

This commit is contained in:
Ms2ger 2016-11-14 11:07:09 +01:00
parent 65dd6d4340
commit ccdb0a3458
1428 changed files with 118036 additions and 9786 deletions

View file

@ -13,12 +13,13 @@ test(function(){
assert_equals(ev.track, null, 'ev.track after assignment');
}, document.title+', one arg');
test(function(){
var obj = {};
var ev = new TrackEvent('foo', {track:obj});
var video = document.createElement('video');
var testTrack = video.addTextTrack('subtitles', 'foo', 'foo');
var ev = new TrackEvent('foo', {track: testTrack});
assert_true(ev instanceof TrackEvent, 'ev instanceof TrackEvent');
assert_true(ev instanceof Event, 'ev instanceof Event');
assert_equals(ev.track, obj, 'ev.track');
assert_equals(ev.track, testTrack, 'ev.track');
ev.track = {};
assert_equals(ev.track, obj, 'ev.track after assignment');
assert_equals(ev.track, testTrack, 'ev.track after assignment');
}, document.title+', two args');
</script>

View file

@ -0,0 +1,15 @@
<!doctype html>
<title>Historical embed element features should not be supported</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<embed id=embed>
<script>
test(function() {
var elm = document.getElementById('embed');
assert_equals(typeof elm, 'object', 'typeof');
assert_throws(new TypeError(), function() {
elm();
});
}, 'embed legacycaller should not be supported');
</script>

View file

@ -0,0 +1,17 @@
<!doctype html>
<meta charset=utf-8>
<title>Append iframe element to its own child document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id=x></iframe>
<script>
test(function() {
var iframe = document.getElementById('x');
var childWindow = iframe.contentWindow;
assert_equals(childWindow.parent, window);
childWindow.document.body.appendChild(iframe);
assert_equals(childWindow.parent, null);
assert_equals(iframe.contentWindow, null);
assert_equals(childWindow.document.body.firstChild, iframe);
});
</script>

View file

@ -7,9 +7,10 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="testIframe" src="support/sandbox_allow_script.html" sandbox="allow-same-origin" style="display:none"></iframe>
<div id="log"></div>
<script>
// Set up all our script stuff before the iframe starts loading, so we don't
// miss any messages from it.
var step1 = false;
var t = async_test("iframe_sandbox_allow_scripts");
@ -35,5 +36,11 @@
t.done();
}
setTimeout(run, 500);
// Make sure the iframe loads before we mess with it.
window.addEventListener("load", function() {
// The load event might fire before a message from the child comes in...
// Wait a bit to see if that message does come in.
setTimeout(run, 500);
});
</script>
<iframe id="testIframe" src="support/sandbox_allow_script.html" sandbox="allow-same-origin" style="display:none"></iframe>

View file

@ -19,7 +19,7 @@
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
document.querySelector("iframe").src = "iframe_sandbox_popups_helper.html";
document.querySelector("iframe").src = "iframe_sandbox_popups_helper-1.html";
});
postMessage("hello", "*");
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe escape the sandbox if
allow-popups-to-escape-sandbox is used</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox">
</iframe>
<script>
var t = async_test();
var ourOrigin;
onmessage = t.step_func(function(e) {
assert_equals(e.data, "hello", "This is our origin getter message");
ourOrigin = e.origin;
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
var iframe = document.querySelector("iframe");
iframe.onload = function() {
frames[0].postMessage("start", "*");
}
iframe.src = "iframe_sandbox_popups_helper-2.html";
});
addEventListener("load", function() {
postMessage("hello", "*");
});
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe escape the sandbox if
allow-popups-to-escape-sandbox is used</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox">
</iframe>
<script>
var t = async_test();
var ourOrigin;
onmessage = t.step_func(function(e) {
assert_equals(e.data, "hello", "This is our origin getter message");
ourOrigin = e.origin;
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
document.querySelector("iframe").src = "iframe_sandbox_popups_helper-3.html";
});
postMessage("hello", "*");
</script>

View file

@ -1,6 +1,5 @@
<!DOCTYPE html>
<script>
var popupWin;
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<body>
<script>
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.
opener.postMessage(undefined, "*");
self.close();
} else {
// We're the child. Start listening for messages from our parent and open
// ourselves as the popup when we get the "start" message.
onmessage = function (e) {
if (e.data == "start") {
// Now listen for messages from the thing we plan to open.
onmessage = function(e) {
parent.postMessage({ data: e.data, origin: e.origin }, "*");
}
var a = document.createElement("a");
a.href = location.href;
a.target = "_blank";
document.body.appendChild(a);
a.click();
}
};
}
</script>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.
opener.postMessage(undefined, "*");
self.close();
} else {
// We're the child. Start listening for messages and open ourselves as the
// popup.
onmessage = function (e) {
parent.postMessage({ data: e.data, origin: e.origin }, "*");
};
var popupWin = window.open();
popupWin.location.href = location.href;
}
</script>

View file

@ -12,4 +12,4 @@
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper.html"></iframe>
src="iframe_sandbox_popups_helper-1.html"></iframe>

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe do not escape the sandbox</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, "null", "Should not have escaped the sandbox");
});
addEventListener("load", function() {
frames[0].postMessage("start", "*");
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper-2.html"></iframe>

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe do not escape the sandbox</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, "null", "Should not have escaped the sandbox");
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper-3.html"></iframe>

View file

@ -0,0 +1,22 @@
<!doctype html>
<meta charset="utf-8">
<title>data URL image</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
var c = document.createElement("canvas"),
con = c.getContext("2d"),
img = document.createElement("img")
img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAA+UlEQVR4nO3RoRHAQBDEsOu/6YR+B2sgIO4Z3919pMwDMCRtHoAhafMADEmbB2BI2jwAQ9LmARiSNg/AkLR5AIakzQMwJG0egCFp8wAMSZsHYEjaPABD0uYBGJI2D8CQtHkAhqTNAzAkbR6AIWnzAAxJmwdgSNo8AEPS5gEYkjYPwJC0eQCGpM0DMCRtHoAhafMADEmbB2BI2jwAQ9LmARiSNg/AkLR5AIakzQMwJG0egCFp8wAMSZsHYEjaPABD0uYBGJI2D8CQtHkAhqTNAzAkbR6AIWnzAAxJmwdgSNo8AEPS5gEYkjYPwJC0eQCGpM0DMCRtHsDjB5K06yueJFXJAAAAAElFTkSuQmCC"
img.onload = () => {
con.drawImage(img, 0, 0)
var data = con.getImageData(0, 0, 10, 10) // should not throw as data URLs are same-origin
for(var i = 0; i < data.data.length; i++) {
var expected = ((i+1) % 4 == 0) ? 255 : 0
assert_equals(data.data[i], expected)
}
c.toDataURL() // shouldn't throw either
done()
}
</script>

View file

@ -3,10 +3,11 @@
<title>Loading a non-parsing URL as an image should silently fail; triggering appropriate events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<img id=myimg />
<img id=brokenurl />
<img id=emptysrc />
<script>
async_test(function(t) {
var img = document.getElementById("myimg");
var img = document.getElementById("brokenurl");
img.src = "http://also a broken url";
var errorevent = false;
@ -16,6 +17,26 @@ async_test(function(t) {
img.addEventListener('loadend', t.step_func_done(function() {
assert_true(errorevent, "error event fired");
}));
});
}, 'src="http://also a broken url"');
async_test(function(t) {
var img = document.getElementById("emptysrc");
img.src = "";
var loadendevent = false;
// Setting src to empty string triggers only error event.
// The errors should be queued in the event loop, so they should only trigger
// after this block of code finishes, not during the img.src setter itself
img.addEventListener('error', t.step_func(function() {
// Queue this check in the event loop to check there is no loadend event
// fired.
t.step_timeout(t.step_func_done(function() {
assert_false(loadendevent, "loadend event should not fired");
}), 0)
}));
img.addEventListener('loadend', t.step_func(function() {
loadendevent = true;
}));
}, 'src=""');
</script>

View file

@ -0,0 +1,93 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>img usemap case-sensitive</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-hash-name-reference">
<!-- See also: https://github.com/whatwg/html/issues/1666 -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<img src="/images/threecolors.png" usemap="#sanityCheck" width="300" height="300">
<map name="sanityCheck"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#sImPlE" width="300" height="300">
<map name="simple"><area shape="rect" coords="0,0,300,300"></map>
<map name="SIMPLE"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#paSSfield-killroyß" width="300" height="300">
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-&#x212a;illroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paßfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#глупый" width="300" height="300">
<map name="глупы&#x438;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫ&#x418;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#åωk" width="300" height="300">
<map name="ÅΩK"><area shape="rect" coords="0,0,300,300"></map>
<map name="&#x212b;ωk"><area shape="rect" coords="0,0,300,300"></map>
<map name="å&#x2126;k"><area shape="rect" coords="0,0,300,300"></map>
<map name="åω&#x212a;"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#blah1" width="300" height="300">
<map name="blah&#x2460;"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24b6;h1"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24d0;h1"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#t&Eacute;dz5アパートFi" width="300" height="300">
<map name="T&Eacute;DZ5アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&eacute;&#x01F1;&#x2075;アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x3300;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x30A2;&#x30CF;&#x309A;&#x30FC;&#x30C8;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ5アパートfi"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#ΣΣ" width="300" height="300">
<map name="σς"><area shape="rect" coords="0,0,300,300"></map>
<script>
"use strict";
setup({ explicit_done: true });
onload = () => {
test(() => {
const image = document.querySelector(`img[usemap="#sanityCheck"]`);
const imageRect = image.getBoundingClientRect();
const x = imageRect.left + imageRect.width / 2;
const y = imageRect.top + imageRect.height / 2;
const element = document.elementFromPoint(x, y);
const area = document.querySelector(`map[name="sanityCheck"] > area`);
assert_equals(element, area);
}, `Image with usemap of #sanityCheck should match the area with map named sanityCheck`);
const images = Array.from(document.querySelectorAll(`img:not([usemap="#sanityCheck"])`));
for (let image of images) {
test(() => {
const imageRect = image.getBoundingClientRect();
const x = imageRect.left + imageRect.width / 2;
const y = imageRect.top + imageRect.height / 2;
const element = document.elementFromPoint(x, y);
const name = element.parentElement.getAttribute("name");
const messageSuffix = name ? `; used <map> with name "${name}"` : "";
assert_equals(element, image, "The element retrieved must be the image, not an area" + messageSuffix);
}, `Image with usemap of ${image.useMap} should not match any of the areas`);
}
done();
};
</script>

View file

@ -0,0 +1,15 @@
<!doctype html>
<title>Historical object element features should not be supported</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<object id=object></object>
<script>
test(function() {
var elm = document.getElementById('object');
assert_equals(typeof elm, 'object', 'typeof');
assert_throws(new TypeError(), function() {
elm();
});
}, 'object legacycaller should not be supported');
</script>

View file

@ -0,0 +1,93 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>object usemap case-sensitive</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-hash-name-reference">
<!-- See also: https://github.com/whatwg/html/issues/1666 -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<object data="/images/threecolors.png" usemap="#sanityCheck" width="300" height="300"></object>
<map name="sanityCheck"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#sImPlE" width="300" height="300"></object>
<map name="simple"><area shape="rect" coords="0,0,300,300"></map>
<map name="SIMPLE"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#paSSfield-killroyß" width="300" height="300"></object>
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-&#x212a;illroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paßfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#глупый" width="300" height="300"></object>
<map name="глупы&#x438;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫ&#x418;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#åωk" width="300" height="300"></object>
<map name="ÅΩK"><area shape="rect" coords="0,0,300,300"></map>
<map name="&#x212b;ωk"><area shape="rect" coords="0,0,300,300"></map>
<map name="å&#x2126;k"><area shape="rect" coords="0,0,300,300"></map>
<map name="åω&#x212a;"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#blah1" width="300" height="300"></object>
<map name="blah&#x2460;"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24b6;h1"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24d0;h1"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#t&Eacute;dz5アパートFi" width="300" height="300"></object>
<map name="T&Eacute;DZ5アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&eacute;&#x01F1;&#x2075;アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x3300;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x30A2;&#x30CF;&#x309A;&#x30FC;&#x30C8;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ5アパートfi"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#ΣΣ" width="300" height="300"></object>
<map name="σς"><area shape="rect" coords="0,0,300,300"></map>
<script>
"use strict";
setup({ explicit_done: true });
onload = () => {
test(() => {
const object = document.querySelector(`object[usemap="#sanityCheck"]`);
const objectRect = object.getBoundingClientRect();
const x = objectRect.left + objectRect.width / 2;
const y = objectRect.top + objectRect.height / 2;
const element = document.elementFromPoint(x, y);
const area = document.querySelector(`map[name="sanityCheck"] > area`);
assert_equals(element, area);
}, `Object with usemap of #sanityCheck should match the area with map named sanityCheck`);
const objects = Array.from(document.querySelectorAll(`object:not([usemap="#sanityCheck"])`));
for (let object of objects) {
test(() => {
const objectRect = object.getBoundingClientRect();
const x = objectRect.left + objectRect.width / 2;
const y = objectRect.top + objectRect.height / 2;
const element = document.elementFromPoint(x, y);
const name = element.parentElement.getAttribute("name");
const messageSuffix = name ? `; used <map> with name "${name}"` : "";
assert_equals(element, object, "The element retrieved must be the object, not an area" + messageSuffix);
}, `Object with usemap of ${object.useMap} should not match any of the areas`);
}
done();
};
</script>