Attachment #519791: For check-in for bug #629632

View | Details | Raw Unified | Return to bug 629632
Collapse All | Expand All

(-)a/modules/libpr0n/test/crashtests/delaytest.html (-19 / +28 lines)
Line     Link Here 
 Lines 1-41    Link Here 
1
<!DOCTYPE HTML>
1
<!DOCTYPE HTML>
2
<html class="reftest-wait">
2
<html class="reftest-wait">
3
<head>
3
<head>
4
<title>Delayed image reftest wrapper</title>
4
<title>Delayed image reftest wrapper</title>
5
</head>
5
</head>
6
<body>
6
<body onload="runTests()">
7
<img id="image1">
7
<img id="image1">
8
<script>
8
<script>
9
// This loads a externally specified image, forces a draw (in case of
9
// This loads a externally specified image, forces a draw (in case of
10
// decode-on-draw), waits 350ms, and then triggers the reftest snapshot.
10
// decode-on-draw), waits for a repaint, and then triggers the reftest snapshot.
11
// This allows the animation on the page to complete.
11
// This allows the animation on the page to complete.
12
//
12
//
13
// Use as "delaytest.html?animation.png"
13
// Use as "delaytest.html?animation.png"
14
//
14
//
15
15
16
// Get the image URL from our URL
16
function runTests() {
17
var imgURL = document.location.search.substr(1);
17
  // Get the image URL from our URL
18
  var imgURL = document.location.search.substr(1);
18
19
19
// Load the image
20
  // Load the image
20
var img = document.images[0];
21
  var img = document.images[0];
21
img.src = imgURL;
22
  img.src = imgURL;
22
img.onload = forceDecode;
23
  img.onload = forceDecode;
23
24
24
function forceDecode() {
25
  function forceDecode() {
25
26
26
  // We need to force drawing of the image in an invisible context
27
    // We need to force drawing of the image in an invisible context
27
  var canvas = document.createElement("canvas");
28
    var canvas = document.createElement("canvas");
28
  var ctx = canvas.getContext("2d");
29
    var ctx = canvas.getContext("2d");
29
  ctx.drawImage(img, 0, 0);
30
    ctx.drawImage(img, 0, 0);
30
31
31
  // We've force the decode. start the timer to trigger the reftest
32
    // We've force the decode. wait for a repaint, and trigger the reftest
32
  startTimer();
33
    waitForRepaint();
34
  }
35
36
  function waitForRepaint() {
37
    var repaints = 0;
38
    const expectedRepaints = 2;
39
    window.addEventListener("MozAfterPaint", function() {
40
      if (++repaints != expectedRepaints)
41
        return;
42
      window.removeEventListener("MozAfterPaint", arguments.callee, false);
43
      document.documentElement.className = "";
44
    }, false);
45
  }
33
}
46
}
34
47
35
function startTimer() {
36
  const delay = 350;
37
  setTimeout("document.documentElement.className = '';", delay);
38
}
39
</script>
48
</script>
40
</body>
49
</body>
41
</html>
50
</html>
(-)a/modules/libpr0n/test/reftest/apng/delaytest.html (-19 / +28 lines)
Line     Link Here 
 Lines 1-41    Link Here 
1
<!DOCTYPE HTML>
1
<!DOCTYPE HTML>
2
<html class="reftest-wait">
2
<html class="reftest-wait">
3
<head>
3
<head>
4
<title>Delayed image reftest wrapper</title>
4
<title>Delayed image reftest wrapper</title>
5
</head>
5
</head>
6
<body>
6
<body onload="runTests()">
7
<img id="image1">
7
<img id="image1">
8
<script>
8
<script>
9
// This loads a externally specified image, forces a draw (in case of
9
// This loads a externally specified image, forces a draw (in case of
10
// decode-on-draw), waits 100ms, and then triggers the reftest snapshot.
10
// decode-on-draw), waits for a repaint, and then triggers the reftest snapshot.
11
// This allows the animation on the page to complete.
11
// This allows the animation on the page to complete.
12
//
12
//
13
// Use as "delaytest.html?animation.png"
13
// Use as "delaytest.html?animation.png"
14
//
14
//
15
15
16
// Get the image URL from our URL
16
function runTests() {
17
var imgURL = document.location.search.substr(1);
17
  // Get the image URL from our URL
18
  var imgURL = document.location.search.substr(1);
18
19
19
// Load the image
20
  // Load the image
20
var img = document.images[0];
21
  var img = document.images[0];
21
img.src = imgURL;
22
  img.src = imgURL;
22
img.onload = forceDecode;
23
  img.onload = forceDecode;
23
24
24
function forceDecode() {
25
  function forceDecode() {
25
26
26
  // We need to force drawing of the image in an invisible context
27
    // We need to force drawing of the image in an invisible context
27
  var canvas = document.createElement("canvas");
28
    var canvas = document.createElement("canvas");
28
  var ctx = canvas.getContext("2d");
29
    var ctx = canvas.getContext("2d");
29
  ctx.drawImage(img, 0, 0);
30
    ctx.drawImage(img, 0, 0);
30
31
31
  // We've force the decode. start the timer to trigger the reftest
32
    // We've force the decode. wait for a repaint, and trigger the reftest
32
  startTimer();
33
    waitForRepaint();
34
  }
35
36
  function waitForRepaint() {
37
    var repaints = 0;
38
    const expectedRepaints = 2;
39
    window.addEventListener("MozAfterPaint", function() {
40
      if (++repaints != expectedRepaints)
41
        return;
42
      window.removeEventListener("MozAfterPaint", arguments.callee, false);
43
      document.documentElement.className = "";
44
    }, false);
45
  }
33
}
46
}
34
47
35
function startTimer() {
36
  const delay = 100;
37
  setTimeout("document.documentElement.className = '';", delay);
38
}
39
</script>
48
</script>
40
</body>
49
</body>
41
</html>
50
</html>
(-)a/modules/libpr0n/test/reftest/gif/delaytest.html (-19 / +28 lines)
Line     Link Here 
 Lines 1-41    Link Here 
1
<!DOCTYPE HTML>
1
<!DOCTYPE HTML>
2
<html class="reftest-wait">
2
<html class="reftest-wait">
3
<head>
3
<head>
4
<title>Delayed image reftest wrapper</title>
4
<title>Delayed image reftest wrapper</title>
5
</head>
5
</head>
6
<body>
6
<body onload="runTests()">
7
<img id="image1">
7
<img id="image1">
8
<script>
8
<script>
9
// This loads a externally specified image, forces a draw (in case of
9
// This loads a externally specified image, forces a draw (in case of
10
// decode-on-draw), waits 100ms, and then triggers the reftest snapshot.
10
// decode-on-draw), waits for a repaint, and then triggers the reftest snapshot.
11
// This allows the animation on the page to complete.
11
// This allows the animation on the page to complete.
12
//
12
//
13
// Use as "delaytest.html?animation.png"
13
// Use as "delaytest.html?animation.png"
14
//
14
//
15
15
16
// Get the image URL from our URL
16
function runTests() {
17
var imgURL = document.location.search.substr(1);
17
  // Get the image URL from our URL
18
  var imgURL = document.location.search.substr(1);
18
19
19
// Load the image
20
  // Load the image
20
var img = document.images[0];
21
  var img = document.images[0];
21
img.src = imgURL;
22
  img.src = imgURL;
22
img.onload = forceDecode;
23
  img.onload = forceDecode;
23
24
24
function forceDecode() {
25
  function forceDecode() {
25
26
26
  // We need to force drawing of the image in an invisible context
27
    // We need to force drawing of the image in an invisible context
27
  var canvas = document.createElement("canvas");
28
    var canvas = document.createElement("canvas");
28
  var ctx = canvas.getContext("2d");
29
    var ctx = canvas.getContext("2d");
29
  ctx.drawImage(img, 0, 0);
30
    ctx.drawImage(img, 0, 0);
30
31
31
  // We've force the decode. start the timer to trigger the reftest
32
    // We've force the decode. wait for a repaint, and trigger the reftest
32
  startTimer();
33
    waitForRepaint();
34
  }
35
36
  function waitForRepaint() {
37
    var repaints = 0;
38
    const expectedRepaints = 3;
39
    window.addEventListener("MozAfterPaint", function() {
40
      if (++repaints != expectedRepaints)
41
        return;
42
      window.removeEventListener("MozAfterPaint", arguments.callee, false);
43
      document.documentElement.className = "";
44
    }, false);
45
  }
33
}
46
}
34
47
35
function startTimer() {
36
  const delay = 500;
37
  setTimeout("document.documentElement.className = '';", delay);
38
}
39
</script>
48
</script>
40
</body>
49
</body>
41
</html>
50
</html>
(-)a/modules/libpr0n/test/reftest/gif/reftest.list (-1 / +1 lines)
Line     Link Here 
 Lines 9-17    Link Here 
9
== comment.gif comment.png
9
== comment.gif comment.png
10
10
11
# a GIF file with a background smaller than the size of the canvas
11
# a GIF file with a background smaller than the size of the canvas
12
== small-background-size.gif small-background-size-ref.gif
12
== small-background-size.gif small-background-size-ref.gif
13
== small-background-size-2.gif small-background-size-2-ref.gif
13
== small-background-size-2.gif small-background-size-2-ref.gif
14
14
15
# a transparent gif that disposes previous frames with clear; we must properly
15
# a transparent gif that disposes previous frames with clear; we must properly
16
# clear each frame to pass.
16
# clear each frame to pass.
17
random == delaytest.html?transparent-animation.gif transparent-animation-finalframe.gif # incorrect timing dependence (bug 558678)
17
== delaytest.html?transparent-animation.gif transparent-animation-finalframe.gif

Return to bug 629632