mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee
This commit is contained in:
parent
c5f7c9ccf3
commit
e891345f26
1328 changed files with 36632 additions and 20588 deletions
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<script src = "/resources/testharness.js"></script>
|
||||
<script src = "/resources/testharnessreport.js"></script>
|
||||
|
||||
<link id="light-link" rel="stylesheet" href="resources/link-rel-attribute.css">
|
||||
<div id="light-div" class="green">I"m green when light DOM link is on</div>
|
||||
|
||||
<div id="host">
|
||||
I"m green when Shadow DOM link is on
|
||||
<template id="shadow-dom">
|
||||
<link id="shadow-link" rel="stylesheet" href="resources/link-rel-attribute.css">
|
||||
<div id="shadow-div" class="green">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var host = document.querySelector("#host");
|
||||
var shadow = host.attachShadow({ mode: "open" });
|
||||
var tmpl = document.querySelector("template#shadow-dom");
|
||||
var clone = document.importNode(tmpl.content, true);
|
||||
shadow.appendChild(clone);
|
||||
|
||||
function testLinkRelModification(testDiv, testLink) {
|
||||
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)");
|
||||
testLink.setAttribute("rel", "no-stylesheet");
|
||||
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 0, 0)");
|
||||
testLink.setAttribute("rel", "stylesheet");
|
||||
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)");
|
||||
testLink.removeAttribute("rel");
|
||||
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 0, 0)");
|
||||
}
|
||||
|
||||
test (() => {
|
||||
testLinkRelModification(document.querySelector("#light-div"),
|
||||
document.querySelector("#light-link"));
|
||||
}, "Removing stylesheet from link rel attribute should remove the stylesheet for light DOM");
|
||||
|
||||
test (() => {
|
||||
testLinkRelModification(shadow.querySelector("#shadow-div"),
|
||||
shadow.querySelector("#shadow-link"));
|
||||
}, "Removing stylesheet from link rel attribute should remove the stylesheet for shadow DOM");
|
||||
</script>
|
|
@ -7,6 +7,10 @@
|
|||
* avoids issues around caching of sheets based on URL.
|
||||
*/
|
||||
|
||||
// Our URLs are random, so we don't use them in error messages by
|
||||
// default, but enable doing it if someone wants to debug things.
|
||||
const DEBUG_URLS = false;
|
||||
|
||||
var isHttps = location.protocol == "https:";
|
||||
|
||||
var tests = [
|
||||
|
@ -113,12 +117,13 @@ for (var test of tests) {
|
|||
var t = async_test(description);
|
||||
var link = document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
hrefString = DEBUG_URLS ? `: ${href}` : "";
|
||||
if (success) {
|
||||
link.onload = t.step_func_done(() => {});
|
||||
link.onerror = t.step_func_done(() => assert_unreached(`error fired when load expected: ${href}`) );
|
||||
link.onerror = t.step_func_done(() => assert_unreached(`error fired when load expected${hrefString}`) );
|
||||
} else {
|
||||
link.onerror = t.step_func_done(() => {});
|
||||
link.onload = t.step_func_done(() => assert_unreached(`load fired when error expected: ${href}`) );
|
||||
link.onload = t.step_func_done(() => assert_unreached(`load fired when error expected${hrefString}`) );
|
||||
}
|
||||
link.href = href;
|
||||
document.head.appendChild(link);
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.green {
|
||||
color: green;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that getSVGDocument() returns null for a cross-origin document.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<embed src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect height="100" width="100"/></svg>'></embed>
|
||||
<script>
|
||||
const embed = document.querySelector('embed');
|
||||
var t = async_test('HTMLEmbedElement.getSVGDocument() for cross-origin document');
|
||||
window.addEventListener(
|
||||
'load', t.step_func_done(() => { assert_equals(embed.getSVGDocument(), null); }));
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that contentDocument returns null for a cross-origin document.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var t = async_test('HTMLFrameElement.contentDocument for cross-origin document');
|
||||
window.addEventListener(
|
||||
'load', t.step_func_done(() => { assert_equals(document.querySelector('frame').contentDocument, null); }));
|
||||
</script>
|
||||
<frameset>
|
||||
<frame src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect height="100" width="100"/></svg>'></frame>
|
||||
</frameset>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that contentDocument/getSVGDocument() return null for a cross-origin document.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<iframe src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect height="100" width="100"/></svg>'></iframe>
|
||||
<script>
|
||||
const iframe = document.querySelector('iframe');
|
||||
var t1 = async_test('HTMLIFrameElement.contentDocument for cross-origin document');
|
||||
window.addEventListener(
|
||||
'load', t1.step_func_done(() => { assert_equals(iframe.contentDocument, null); }));
|
||||
var t2 = async_test('HTMLIFrameElement.getSVGDocument() for cross-origin document');
|
||||
window.addEventListener(
|
||||
'load', t2.step_func_done(() => { assert_equals(iframe.getSVGDocument(), null); }));
|
||||
</script>
|
||||
</body>
|
|
@ -14,7 +14,7 @@ setup({explicit_done:true});
|
|||
function check(p, iframe) {
|
||||
var current = p.firstElementChild;
|
||||
var ref_sizes = current.getAttribute('sizes');
|
||||
var expect = p.firstElementChild.currentSrc;
|
||||
var expect = current.currentSrc;
|
||||
if (expect) {
|
||||
expect = expect.split('?')[0];
|
||||
}
|
||||
|
|
|
@ -52,8 +52,14 @@
|
|||
<img srcset='/images/green-1x1.png?e34 50w, /images/green-16x16.png?e34 51w' sizes='\[,1px'>
|
||||
<img srcset='/images/green-1x1.png?e35 50w, /images/green-16x16.png?e35 51w' sizes='1\p\x'>
|
||||
<img srcset='/images/green-1x1.png?e36 50w, /images/green-16x16.png?e36 51w' sizes='calc(1px)'>
|
||||
<img srcset='/images/green-1x1.png?e36a 50w, /images/green-16x16.png?e36a 51w' sizes='min(1px, 100px)'>
|
||||
<img srcset='/images/green-1x1.png?e36b 50w, /images/green-16x16.png?e36b 51w' sizes='min(-100px, 1px)'>
|
||||
<img srcset='/images/green-1x1.png?e37 50w, /images/green-16x16.png?e37 51w' sizes='(min-width:0) calc(1px)'>
|
||||
<img srcset='/images/green-1x1.png?e37a 50w, /images/green-16x16.png?e37a 51w' sizes='(min-width:0) min(1px, 100px)'>
|
||||
<img srcset='/images/green-1x1.png?e37b 50w, /images/green-16x16.png?e37b 51w' sizes='(min-width:0) max(-100px, 1px)'>
|
||||
<img srcset='/images/green-1x1.png?e38 50w, /images/green-16x16.png?e38 51w' sizes='(min-width:calc(0)) 1px'>
|
||||
<img srcset='/images/green-1x1.png?e38a 50w, /images/green-16x16.png?e38a 51w' sizes='(min-width:min(0, 200vw)) 1px'>
|
||||
<img srcset='/images/green-1x1.png?e38b 50w, /images/green-16x16.png?e38b 51w' sizes='(min-width:max(-200vw, 0)) 1px'>
|
||||
<img srcset='/images/green-1x1.png?e39 50w, /images/green-16x16.png?e39 51w' sizes='(min-width:0) 1px, 100vw'>
|
||||
<img srcset='/images/green-1x1.png?e40 50w, /images/green-16x16.png?e40 51w' sizes='(min-width:0) 1px, (min-width:0) 100vw, 100vw'>
|
||||
<img srcset='/images/green-1x1.png?e41 50w, /images/green-16x16.png?e41 51w' sizes='(min-width:0) 1px'>
|
||||
|
@ -126,7 +132,11 @@
|
|||
<img srcset='/images/green-1x1.png?e108 50w, /images/green-16x16.png?e108 51w' sizes='(max-width:0) or (unknown-general-enclosed !) 100vw, 1px'>
|
||||
<img srcset='/images/green-1x1.png?e109 50w, /images/green-16x16.png?e109 51w' sizes='not ((max-width:0) or (unknown "general-enclosed")) 100vw, 1px'>
|
||||
<img srcset='/images/green-1x1.png?f48 50w, /images/green-16x16.png?f48 51w' sizes='calc(1px'>
|
||||
<img srcset='/images/green-1x1.png?f48a 50w, /images/green-16x16.png?f48a 51w' sizes='min(1px, 200vw'>
|
||||
<img srcset='/images/green-1x1.png?f48b 50w, /images/green-16x16.png?f48b 51w' sizes='max(-200vw, 1px'>
|
||||
<img srcset='/images/green-1x1.png?f49 50w, /images/green-16x16.png?f49 51w' sizes='(min-width:0) calc(1px'>
|
||||
<img srcset='/images/green-1x1.png?f49a 50w, /images/green-16x16.png?f49a 51w' sizes='(min-width:0) min(1px, 200vw'>
|
||||
<img srcset='/images/green-1x1.png?f49b 50w, /images/green-16x16.png?f49b 51w' sizes='(min-width:0) max(-200vw, 1px'>
|
||||
|
||||
<p>
|
||||
<img srcset='/images/green-1x1.png?f1 50w, /images/green-16x16.png?f1 51w' sizes='100vw'>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that contentDocument/getSVGDocument() return null for a cross-origin document.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<object data='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect height="100" width="100"/></svg>'></object>
|
||||
<script>
|
||||
const object = document.querySelector('object');
|
||||
var t1 = async_test('HTMLObjectElement.contentDocument for cross-origin document');
|
||||
window.addEventListener(
|
||||
'load', t1.step_func_done(() => { assert_equals(object.contentDocument, null); }));
|
||||
var t2 = async_test('HTMLObjectElement.getSVGDocument() for cross-origin document');
|
||||
window.addEventListener(
|
||||
'load', t2.step_func_done(() => { assert_equals(object.getSVGDocument(), null); }));
|
||||
</script>
|
||||
</body>
|
|
@ -65,6 +65,7 @@ function test_rellist(tag_name, rel_table) {
|
|||
let supported = rel_table['supported'];
|
||||
for (let link_type in supported) {
|
||||
assert_true(element.relList.supports(supported[link_type]), 'tag = ' + tag + ', link type = ' + supported[link_type] + ' must be supported');
|
||||
assert_true(element.relList.supports(supported[link_type].toUpperCase()), 'tag = ' + tag + ', link type = ' + supported[link_type].toUpperCase() + ' must be supported');
|
||||
}
|
||||
let unsupported = rel_table['unsupported'];
|
||||
for (let link_type in unsupported) {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<meta http-equiv="Content-Security-Policy" content="require-sri-for script">
|
||||
|
||||
<script src="/resources/testharness.js" integrity="sha384-4Nybydhnr3tOpv1yrTkDxu3RFpnxWAxlU5kGn7c8ebKvh1iUdfVMjqP6jf0dacrV"></script>
|
||||
<script src="/resources/testharnessreport.js" integrity="sha384-GOnHxuyo+nnsFAe4enY+RAl4/+w5NPMJPCQiDroTjxtR7ndRz7Uan8vNbM2qWKmU"></script>
|
||||
<script src="/resources/testharness.js" integrity="sha384-{{file_hash(sha384, resources/testharness.js)}}"></script>
|
||||
<script src="/resources/testharnessreport.js" integrity="sha384-{{file_hash(sha384, resources/testharnessreport.js)}}"></script>
|
||||
|
||||
<div id="dummy"></div>
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
<meta http-equiv="Content-Security-Policy" content="require-sri-for script">
|
||||
|
||||
<script src="/resources/testharness.js" integrity="sha384-4Nybydhnr3tOpv1yrTkDxu3RFpnxWAxlU5kGn7c8ebKvh1iUdfVMjqP6jf0dacrV"></script>
|
||||
<script src="/resources/testharnessreport.js" integrity="sha384-GOnHxuyo+nnsFAe4enY+RAl4/+w5NPMJPCQiDroTjxtR7ndRz7Uan8vNbM2qWKmU"></script>
|
||||
<script src="/resources/testharness.js" integrity="sha384-{{file_hash(sha384, resources/testharness.js)}}"></script>
|
||||
<script src="/resources/testharnessreport.js" integrity="sha384-{{file_hash(sha384, resources/testharnessreport.js)}}"></script>
|
||||
|
||||
<div id="dummy"></div>
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>import() inside compiled strings inside a classic script</title>
|
||||
<link rel="help" href="https://github.com/whatwg/html/pull/3163">
|
||||
<link rel="help" href="https://github.com/tc39/ecma262/issues/871#issuecomment-292493142">
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
self.ran = false;
|
||||
|
||||
promise_test(t => {
|
||||
t.add_cleanup(() => {
|
||||
self.ran = false;
|
||||
})
|
||||
|
||||
return Promise.resolve(`import("../imports-a.js?1").then(() => { self.ran = true; })`)
|
||||
.then(eval)
|
||||
.then(() => {
|
||||
assert_true(self.ran);
|
||||
});
|
||||
}, "Evaled the script via eval, successful import");
|
||||
|
||||
promise_test(t => {
|
||||
t.add_cleanup(() => {
|
||||
self.ran = false;
|
||||
})
|
||||
|
||||
return Promise.resolve(`import("bad-specifier?1").catch(() => { self.ran = true; })`)
|
||||
.then(eval)
|
||||
.then(() => {
|
||||
assert_true(self.ran);
|
||||
});
|
||||
}, "Evaled the script via eval, failed import");
|
||||
|
||||
promise_test(t => {
|
||||
t.add_cleanup(() => {
|
||||
self.ran = false;
|
||||
})
|
||||
|
||||
return Promise.resolve(`return import("../imports-a.js?2").then(() => { self.ran = true; })`)
|
||||
.then(Function)
|
||||
.then(Function.prototype.call.bind(Function.prototype.call))
|
||||
.then(() => {
|
||||
assert_true(self.ran);
|
||||
});
|
||||
}, "Evaled the script via Function, successful import");
|
||||
|
||||
promise_test(t => {
|
||||
t.add_cleanup(() => {
|
||||
self.ran = false;
|
||||
})
|
||||
|
||||
return Promise.resolve(`return import("bad-specifier?2").catch(() => { self.ran = true; })`)
|
||||
.then(Function)
|
||||
.then(Function.prototype.call.bind(Function.prototype.call))
|
||||
.then(() => {
|
||||
assert_true(self.ran);
|
||||
});
|
||||
}, "Evaled the script via Function, failed import");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue