mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Update web-platform-tests to revision 36634cbcf3253dfe8d220990a27ad4eeebf8ec2f
This commit is contained in:
parent
0964d055cd
commit
7295abcc2a
245 changed files with 5966 additions and 1901 deletions
|
@ -1,12 +1,14 @@
|
|||
These tests exercise differnt ways to load an image, generated via
|
||||
```/referrer-policy/generic/subresource/image.py?id=<UUID>``` and later
|
||||
verify the headers used to request that image.
|
||||
These tests exercise different ways to fetch a resource (image, font-face, svg
|
||||
references), generated via the sub-resource python script in
|
||||
```./generic/subresource/``` (for example, loading an image:
|
||||
```/referrer-policy/generic/subresource/image.py?id=<UUID>```) and later verify
|
||||
the headers used to fetch the resource.
|
||||
|
||||
Since there is no way to wait for a resource referenced from CSS to be loaded,
|
||||
all tests use ```step_timeout()``` to delay the verification step until
|
||||
after the image (hopefully) was loaded.
|
||||
after the resource (hopefully) was loaded.
|
||||
|
||||
Since there is also no way to retrieve headers (or other information) from
|
||||
images loaded via CSS, we store the headers with the given ```UUID``` as key
|
||||
on the server, and retrieve them later via an XHR to
|
||||
resources loaded via CSS, we store the headers with the given ```UUID``` as key
|
||||
on the server, and retrieve them later via an XHR, for example:
|
||||
```/referrer-policy/generic/subresource/image.py?id=<UUID>&report-headers```.
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Child css from external stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that child css are loaded with the referrer and referrer policy
|
||||
from the external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Child css from external stylesheet.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&import-rule" + "&referrer-policy=no-referrer";
|
||||
let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let link = document.createElement("link");
|
||||
link.href = css_url;
|
||||
link.rel = "stylesheet";
|
||||
link.onload = function() {
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_equals(message.referrer, undefined);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
};
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Child css from internal stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that child css are loaded with the referrer and referrer policy
|
||||
from the internal stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Child css from internal stylesheet.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule";
|
||||
let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let style = document.createElement("style");
|
||||
style.type = 'text/css';
|
||||
style.appendChild(document.createTextNode("@import url('" + css_url + "');"));
|
||||
document.head.appendChild(style);
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_url);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - child css via a ProcessingInstruction</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that child css are loaded with the referrer and referrer policy the
|
||||
external stylesheet(referenced from a ProcessingInstruction).</p>
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Child css via a ProcessingInstruction.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
|
||||
id;
|
||||
let css_url = url_prefix + "&import-rule";
|
||||
let expected = url_prefix + "&import-rule";
|
||||
let check_url = url_prefix + "&report-headers";
|
||||
|
||||
let processingInstruction =
|
||||
document.createProcessingInstruction(
|
||||
"xml-stylesheet", "href=\"" +css_url + "\" type=\"text/css\"");
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, expected);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
document.insertBefore(processingInstruction, document.firstChild);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,66 @@
|
|||
var svg_ns = "http://www.w3.org/2000/svg";
|
||||
var url_prefix = location.protocol + "//" + location.hostname + ":" +
|
||||
location.port + "/referrer-policy/generic/subresource/";
|
||||
|
||||
var svg_test_properties = [
|
||||
'fill',
|
||||
'stroke',
|
||||
'filter',
|
||||
'clip-path',
|
||||
'marker-start',
|
||||
'marker-mid',
|
||||
'marker-end',
|
||||
'mask',
|
||||
'mask-image',
|
||||
];
|
||||
|
||||
// Schedules async_test's for each of the test properties
|
||||
// Parameters:
|
||||
// testProperties: An array of test properties.
|
||||
// testDescription: A test description
|
||||
// testFunction: A function call which sets up the expect result and runs
|
||||
// the actual test
|
||||
function runSvgTests(testProperties, testDescription, testFunction) {
|
||||
let runNextTest = function () {
|
||||
let property = testProperties.shift();
|
||||
if (property === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
let current = {
|
||||
test: async_test(testDescription + " " + property),
|
||||
id: token(),
|
||||
property: property,
|
||||
};
|
||||
|
||||
testFunction(current);
|
||||
|
||||
let check_url = url_prefix + "svg.py" + "?id=" + current.id +
|
||||
"&report-headers";
|
||||
current.test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
current.test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, current.expected);
|
||||
});
|
||||
current.test.done();
|
||||
}),
|
||||
800);
|
||||
|
||||
};
|
||||
|
||||
add_result_callback(runNextTest);
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function createSvg() {
|
||||
let svg = document.createElementNS(svg_ns, 'svg');
|
||||
svg.setAttribute('width', '400');
|
||||
svg.setAttribute('height', '400');
|
||||
let path = document.createElementNS(svg_ns, 'path');
|
||||
path.setAttribute('d', 'M 50,5 95,100 5,100 z');
|
||||
svg.appendChild(path);
|
||||
return svg;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from imported stylesheet (external)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from imported stylesheets (loaded from external
|
||||
stylesheets) are loaded with the referrer and referrer policy from the
|
||||
external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from imported stylesheet (external).");
|
||||
let id = token();
|
||||
let css_url = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&import-rule" + "&type=font";
|
||||
let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
|
||||
let css_referrer = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
|
||||
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
|
||||
"?id=" + id + "&report-headers" + "&type=font";
|
||||
|
||||
let link = document.createElement("link");
|
||||
link.href = css_url;
|
||||
link.rel = "stylesheet";
|
||||
link.onload = function() {
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_referrer);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
};
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from external stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets are loaded with
|
||||
the referrer and referrer policy from the external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from external stylesheet.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
|
||||
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let link = document.createElement("link");
|
||||
link.href = css_url;
|
||||
link.rel = "stylesheet";
|
||||
link.onload = function() {
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_url);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
};
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from imported stylesheet (internal)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from stylesheets (imported from internal
|
||||
stylesheets) are loaded with the referrer and referrer policy from from the
|
||||
imported style sheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from imported stylesheet (internal).");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port + "/referrer-policy/generic/subresource/";
|
||||
let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font";
|
||||
let font_url = url_prefix + "font.py?report-headers&id=" + id;
|
||||
|
||||
let style = document.createElement("style");
|
||||
style.textContent = "@import url('" + css_url + "');";
|
||||
document.head.appendChild(style);
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_url);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from internal stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from internal stylesheets are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from internal stylesheet.");
|
||||
let id = token();
|
||||
let css_url = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port +
|
||||
"/referrer-policy/generic/subresource/font.py" + "?id=" +
|
||||
id + "&type=font";
|
||||
let font_url = css_url + "&report-headers";
|
||||
|
||||
let style = document.createElement("style");
|
||||
style.textContent = "@font-face { font-family: 'wpt'; font-style: normal; font-weight: normal; src: url(" + css_url + "); format('truetype'); } body { font-family: 'wpt';}";
|
||||
document.head.appendChild(style);
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, location.origin + "/");
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from external stylesheet inserted via a ProcessingInstruction</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets (referenced from a
|
||||
ProcessingInstruction) are loaded with the referrer and referrer policy
|
||||
from the external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from external stylesheet (from ProcessingInstruction).");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
|
||||
id + "&type=font";
|
||||
let expected = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
|
||||
id + "&type=font";
|
||||
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let processingInstruction =
|
||||
document.createProcessingInstruction(
|
||||
"xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, expected);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
document.insertBefore(processingInstruction, document.firstChild);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -19,10 +19,13 @@
|
|||
<script>
|
||||
var css_test = async_test("Image from imported stylesheet (external).");
|
||||
var id = token();
|
||||
var cross_origin_url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
var css_url = cross_origin_url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule";
|
||||
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&import-rule" + "&type=image";
|
||||
var url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
|
||||
var css_referrer = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
|
||||
var css_referrer = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&type=image";
|
||||
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from external stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets are loaded with
|
||||
the referrer and referrer policy from the external stylesheet.</p>
|
||||
|
||||
<script>
|
||||
function addLinkStyleSheet(test) {
|
||||
let css_url = url_prefix + "stylesheet.py?id=" + test.id +
|
||||
"&type=svg" + "&property=" + test.property;
|
||||
test.expected = css_url;
|
||||
|
||||
let stylesheet =
|
||||
document.createElementNS("http://www.w3.org/1999/xhtml", "link");
|
||||
stylesheet.setAttribute("type", "text/css");
|
||||
stylesheet.setAttribute("rel", "stylesheet");
|
||||
stylesheet.setAttribute("href", css_url);
|
||||
let svg = createSvg();
|
||||
document.body.appendChild(svg);
|
||||
svg.appendChild(stylesheet);
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Test styling SVG from external style",
|
||||
addLinkStyleSheet);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from inline style</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from inline styles are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
<script>
|
||||
function setInlineStyle(test)
|
||||
{
|
||||
test.expected = location.origin + "/";
|
||||
let svg = createSvg();
|
||||
document.body.appendChild(svg);
|
||||
let element = svg.getElementsByTagName('path')[0];
|
||||
element.style = test.property + ": url(" + url_prefix + "svg.py?id=" +
|
||||
test.id + "#invalidFragment);";
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Styling SVG from inline styles",
|
||||
setInlineStyle);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from internal style</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from internal styles are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
<script>
|
||||
function setInternalStyle(test) {
|
||||
test.expected = location.origin + "/";
|
||||
let style = document.createElementNS(svg_ns, "style");
|
||||
style.textContent = "path { " + test.property + ": url(" + url_prefix +
|
||||
"svg.py?id=" + test.id + "#invalidFragment);";
|
||||
let svg = createSvg();
|
||||
svg.appendChild(style);
|
||||
document.body.appendChild(svg);
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Styling SVG from internal styles",
|
||||
setInternalStyle);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from external stylesheet from
|
||||
presentation attribute</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from presentation attributes are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
<script>
|
||||
function setPresentationAttribute(test)
|
||||
{
|
||||
test.expected = location.origin + "/";
|
||||
let svg = createSvg();
|
||||
document.body.appendChild(svg);
|
||||
let element = svg.getElementsByTagName("path")[0];
|
||||
// The test property should have map 1:1 with presentation attribute.
|
||||
let attr = test.property;
|
||||
element.setAttribute(attr, "url(" + url_prefix + "svg.py?id=" +
|
||||
test.id + "#invalidFragment)");
|
||||
}
|
||||
|
||||
// mask-image is not the presentation attribute.
|
||||
runSvgTests(svg_test_properties.filter(p => p != 'mask-image'),
|
||||
"Styling SVG from presentation attributes",
|
||||
setPresentationAttribute);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from external stylesheet via
|
||||
ProcessingInstruction</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets (referenced from a
|
||||
ProcessingInstruction) are loaded with the referrer and referrer policy
|
||||
from the external stylesheet.</p>
|
||||
<script>
|
||||
function addProcessingInstruction(test) {
|
||||
let svg_url = url_prefix + "svg.py?id=" + test.id + "&type=svg" +
|
||||
"&property=" + test.property + "&embedded-svg";
|
||||
let iframe = document.createElement("iframe");
|
||||
test.expected = url_prefix + "stylesheet.py?id=" + test.id +
|
||||
"&type=svg" + "&property=" + test.property;
|
||||
iframe.src = svg_url;
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Styling SVG from ProcessingInstruction",
|
||||
addProcessingInstruction);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue