Commit edca9a70 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Split fast/canvas/canvas-filter-origin-clean.html

The original is (flakily) timing out on Mac - most likely because of the
many readbacks. Split the test in smaller, reasonably logical, chunks to
hopefully avoid timing out.

Bug: 1041846
Change-Id: I43a543cd2dbc58fd9a1f412f9f77e2fb0eadc921
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030765
Commit-Queue: Fernando Serboncini <fserb@chromium.org>
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736875}
parent 0344d44b
......@@ -6503,7 +6503,6 @@ crbug.com/1046698 external/wpt/html/cross-origin-opener-policy/coep-blob-popup.h
# Sheriff 2020-01-29
crbug.com/1041847 virtual/gpu/fast/canvas/color-space/canvas-colorManaged-convertToBlob-roundtrip.html [ Pass Timeout ]
crbug.com/995663 [ Linux ] http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html [ Pass Failure Timeout ]
crbug.com/1041846 [ Mac ] virtual/gpu/fast/canvas/canvas-filter-origin-clean.html [ Pass Timeout ]
# Sheriff 2020-01-30
crbug.com/1047126 [ Win ] external/wpt/IndexedDB/keypath-exceptions.htm [ Failure ]
......
<!doctype html>
<title>CSS shorthand filters never taint the canvas</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
function assert_not_tainted(performCommands, description) {
let ctx = document.createElement('canvas').getContext('2d');
performCommands(ctx);
assert_not_equals(ctx.getImageData(0, 0, 1, 1), null, description);
}
test(function() {
assert_not_tainted(ctx => {
ctx.fillStyle = '#0f0';
ctx.filter = 'brightness(0.5)';
ctx.fillRect(5, 5, 10, 10);
}, 'brightness(0.5)');
assert_not_tainted(ctx => {
ctx.filter = 'blur(5px)';
ctx.fillRect(5, 5, 10, 10);
}, 'blur(5px)');
assert_not_tainted(ctx => {
ctx.filter = 'hue-rotate(45deg) drop-shadow(16px 16px 20px blue)';
ctx.fillRect(5, 5, 10, 10);
}, 'hue-rotate(45deg) drop-shadow(16px 16px 20px blue)');
});
</script>
<!doctype html>
<title>CSS url() reference filters may taint the canvas: not tainting</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg style="display: block; width: 0; height: 0">
<defs>
<filter id="merge-clean">
<feColorMatrix type="matrix" values="0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1" />
<feMerge>
<feMergeNode></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="SourceAlpha"></feMergeNode>
<feMergeNode in="FillPaint"></feMergeNode>
<feMergeNode in="StrokePaint"></feMergeNode>
</feMerge>
</filter>
<circle id="circle" r="100" fill="blue" />
</defs>
</svg>
<script>
function assert_not_tainted(performCommands, description) {
let ctx = document.createElement('canvas').getContext('2d');
performCommands(ctx);
assert_not_equals(ctx.getImageData(0, 0, 1, 1), null, description);
}
// SVG reference filters taint the canvas according to
// https://drafts.fxtf.org/filter-effects/#tainted-filter-primitives
test(function() {
assert_not_tainted(ctx => {
ctx.filter = 'url(#merge-clean)';
ctx.fillRect(5, 5, 10, 10);
}, 'url(#merge-clean)');
assert_not_tainted(ctx => {
ctx.filter = 'blur(5px) url(#merge-clean) blur(5px)';
ctx.fillRect(5, 5, 10, 10);
}, 'blur(5px) url(#merge-clean) blur(5px)');
});
</script>
<!doctype html>
<title>CSS url() reference filter may taint the canvas: tainting</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg style="display: block; width: 0; height: 0">
<defs>
<filter id="drop-shadow">
......@@ -26,56 +30,16 @@
<circle id="circle" r="100" fill="blue" />
</defs>
</svg>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
function assert_not_tainted(performCommands, description) {
let ctx = document.createElement('canvas').getContext('2d');
performCommands(ctx);
assert_not_equals(ctx.getImageData(0, 0, 1, 1), null, description);
}
function assert_tainted(performCommands, description) {
let ctx = document.createElement('canvas').getContext('2d');
performCommands(ctx);
assert_throws("SecurityError", () => ctx.getImageData(0, 0, 1, 1), description);
}
// CSS shorthand filters never taint the canvas.
test(function() {
assert_not_tainted(ctx => {
ctx.fillStyle = '#0f0';
ctx.filter = 'brightness(0.5)';
ctx.fillRect(5, 5, 10, 10);
}, 'brightness(0.5)');
assert_not_tainted(ctx => {
ctx.filter = 'blur(5px)';
ctx.fillRect(5, 5, 10, 10);
}, 'blur(5px)');
assert_not_tainted(ctx => {
ctx.filter = 'hue-rotate(45deg) drop-shadow(16px 16px 20px blue)';
ctx.fillRect(5, 5, 10, 10);
}, 'hue-rotate(45deg) drop-shadow(16px 16px 20px blue)');
}, "CSS shorthand filters never taint the canvas");
// SVG reference filters taint the canvas according to
// https://drafts.fxtf.org/filter-effects/#tainted-filter-primitives
test(function() {
assert_not_tainted(ctx => {
ctx.filter = 'url(#merge-clean)';
ctx.fillRect(5, 5, 10, 10);
}, 'url(#merge-clean)');
assert_not_tainted(ctx => {
ctx.filter = 'blur(5px) url(#merge-clean) blur(5px)';
ctx.fillRect(5, 5, 10, 10);
}, 'blur(5px) url(#merge-clean) blur(5px)');
}, "Whitelisted SVG filters don't taint the canvas");
test(function() {
assert_tainted(ctx => {
ctx.filter = 'url(#drop-shadow)';
......@@ -110,5 +74,5 @@ test(function() {
ctx.filter = 'url(#image)';
ctx.fillRect(5, 5, 10, 10);
}, 'url(#image)');
}, "Non-whitelisted SVG filters taint the canvas");
});
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment