summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/canvas/feimage-with-foreignobject-taint-canvas.html
blob: bcee2f65371d0fe65c6c462d18ee002817da8463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE HTML>
<html>
<script>
var canvas, context, pattern, image;

function runTest() {
  if (window.testRunner)
    testRunner.waitUntilDone();

  canvas = document.getElementById('canvas');
  context = canvas.getContext('2d');

  image = document.createElement('img');
  image.setAttribute('src', 'resources/svg-with-feimage-with-foreignobject.svg');
  image.onload = function() {
    pattern = context.createPattern(image, 'repeat');
    context.fillStyle = pattern;
    context.fillRect(0, 0, 100, 100);
    try {
      // This should throw an exception.
      var pixels = context.getImageData(0, 0, 1, 1).data;
      finishTest('FAIL - svg with feImage with foreignObject did not taint the canvas.');
    } catch (e) {
      finishTest('PASS');
    }
  }
}

function finishTest(output) {
  document.write(output);
  if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.notifyDone();
  }
}
</script>
<body onload='runTest()'>
  Test for crbug.com/279445: An SVG image with an feImage with a foreignObject should taint the canvas.<br/>
  FAIL - test did not run.<br/>
<canvas id='canvas' width='100' height='100'></canvas>
</body>
</html>