зеркало из https://github.com/mozilla/gecko-dev.git
Bug 695385: Add a mochitest to validate that cross-origin svg filters are blocked. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D13844 --HG-- rename : layout/reftests/filters.svg => layout/svg/tests/filters.svg extra : moz-landing-system : lando
This commit is contained in:
Родитель
eeab7cf802
Коммит
234ebbeea8
|
@ -0,0 +1,9 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<rect height="100%" width="100%" fill="yellow" />
|
||||
<rect height="50%" width="100%" fill="black" />
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 330 B |
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<!-- We include these <use> elements simply to be sure the SVG resource URLs
|
||||
get a chance to block 'onload', if they can be loaded. -->
|
||||
<use xlink:href="http://mochi.test:8888/tests/layout/svg/tests/filters.svg#empty" />
|
||||
<use xlink:href="http://example.org/tests/layout/svg/tests/filters.svg#empty" />
|
||||
|
||||
<!-- giant yellow rect in the background, just so you can visually tell
|
||||
that this SVG file has loaded/rendered. -->
|
||||
<rect height="100%" width="100%" fill="yellow" />
|
||||
|
||||
<!-- For both rects below: if it's black, its filter resolved successfully.
|
||||
If it's transparent, it means we failed to load the resource
|
||||
(e.g. because it was blocked as a cross-origin resource). -->
|
||||
<rect height="50%" width="100%" fill="red"
|
||||
filter="url(http://mochi.test:8888/tests/layout/svg/tests/filters.svg#NonWhiteToBlack)"/>
|
||||
<rect y="50%"
|
||||
height="50%" width="100%" fill="red"
|
||||
filter="url(http://example.org/tests/layout/svg/tests/filters.svg#NonWhiteToBlack)"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -0,0 +1,9 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<rect height="100%" width="100%" fill="yellow" />
|
||||
<rect y="50%" height="50%" width="100%" fill="black" />
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 338 B |
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
|
||||
<defs>
|
||||
|
||||
<!-- so that other documents can svg:use this one and force it to
|
||||
load before onload -->
|
||||
<g id="empty" />
|
||||
|
||||
<!-- Keep all white pixels white, and change any others to black. -->
|
||||
<!-- NOTE: alpha is preserved, so it will not adjust alpha edges -->
|
||||
<filter id="NonWhiteToBlack" x="0%" y="0%" width="100%" height="100%">
|
||||
<feComponentTransfer>
|
||||
<feFuncR type="linear" slope="-1" intercept="1" />
|
||||
<feFuncG type="linear" slope="-1" intercept="1" />
|
||||
<feFuncB type="linear" slope="-1" intercept="1" />
|
||||
</feComponentTransfer>
|
||||
<feColorMatrix type="matrix" values="255 255 255 0 0
|
||||
255 255 255 0 0
|
||||
255 255 255 0 0
|
||||
0 0 0 1 0" />
|
||||
<feComponentTransfer>
|
||||
<feFuncR type="linear" slope="-1" intercept="1" />
|
||||
<feFuncG type="linear" slope="-1" intercept="1" />
|
||||
<feFuncB type="linear" slope="-1" intercept="1" />
|
||||
</feComponentTransfer>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.1 KiB |
|
@ -3,3 +3,9 @@ support-files =
|
|||
file_disabled_iframe.html
|
||||
|
||||
[test_disabled.html]
|
||||
[test_filter_crossorigin.html]
|
||||
support-files =
|
||||
filters.svg
|
||||
file_filter_crossorigin.svg
|
||||
file_black_yellow.svg
|
||||
file_yellow_black.svg
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=695385
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 695385</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=695385">Mozilla Bug 695385</a>
|
||||
<br>
|
||||
<!-- These iframes' renderings are expected to match: -->
|
||||
<iframe src="http://mochi.test:8888/tests/layout/svg/tests/file_filter_crossorigin.svg"></iframe>
|
||||
<iframe src="file_black_yellow.svg"></iframe>
|
||||
<br>
|
||||
<!-- These iframes' renderings are expected to match: -->
|
||||
<iframe src="http://example.org/tests/layout/svg/tests/file_filter_crossorigin.svg"></iframe>
|
||||
<iframe src="file_yellow_black.svg"></iframe>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
// Main Function
|
||||
function run() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
let snapshots = new Array(4);
|
||||
for (let i = 0; i < snapshots.length; i++) {
|
||||
snapshots[i] = snapshotWindow(frames[i].window, false);
|
||||
}
|
||||
|
||||
// Compare mochi.test iframe against its reference:
|
||||
assertSnapshots(snapshots[0], snapshots[1], true, null,
|
||||
"Testcase loaded from mochi.test", "Reference: black/yellow");
|
||||
|
||||
// Compare example.org iframe against its reference:
|
||||
assertSnapshots(snapshots[2], snapshots[3], true, null,
|
||||
"Testcase loaded from example.org", "Reference: yellow/black");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче