Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 <!DOCTYPE HTML>
2 <title>Canvas test: canvas demotion</title>
3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
4 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
5 <body>
6 <canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
7 <script>
9 SimpleTest.waitForExplicitFinish();
10 addLoadEvent(function () {
12 var canvas = document.getElementById('c');
13 var ctx = canvas.getContext('2d');
15 ctx.fillStyle = 'rgb(50, 50, 50)';
16 ctx.fillRect(0, 0, 100, 50);
17 ctx.translate(25, 25);
19 SpecialPowers.wrap(ctx).demote();
21 setTimeout(function() {
22 ctx.fillStyle = 'rgb(127, 127, 127)';
23 ctx.fillRect(0, 0, 10, 10);
25 var pixels = ctx.getImageData(0, 0, 1, 1);
27 ok(pixels.data[0] === 50, "pixels.data[0] expected 50, got " + pixels.data[0]);
28 ok(pixels.data[1] === 50, "pixels.data[1] expected 50, got " + pixels.data[1]);
29 ok(pixels.data[2] === 50, "pixels.data[2] expected 50, got " + pixels.data[2]);
31 pixels = ctx.getImageData(25, 25, 1, 1);
33 ok(pixels.data[0] === 127, "pixels.data[0] expected 127, got " + pixels.data[0]);
34 ok(pixels.data[1] === 127, "pixels.data[1] expected 127, got " + pixels.data[1]);
35 ok(pixels.data[2] === 127, "pixels.data[2] expected 127, got " + pixels.data[2]);
37 SimpleTest.finish();
38 }, 50);
41 });
42 </script>