summaryrefslogtreecommitdiffstats
path: root/image/test/crashtests/1629490-1.html
blob: f35568ca4e1294b0f4baa6d150961567075d491f (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
43
44
45
46
47
48
49
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
</head>
<body>
<div id="container">
  <iframe id='if' src="1629490-1-iframe.html"></iframe>
</div>

<script>
let iterationsLeft = 25;

function runTest() {
  // Make sure the image is decoded and advanced to it's final frame.
  let img = document.getElementById("if").contentWindow.document.getElementById("image1");
  img.decode().then(function() {
    setTimeout(forceDiscard, 2000);
  });
}

function showIframe() {
  document.getElementById("container").style.display = "";
  document.documentElement.getBoundingClientRect();
  requestAnimationFrame(forceDecode);
}

function forceDecode() {
  let img = document.getElementById("if").contentWindow.document.getElementById("image1");
  img.decode().then(function() {
    setTimeout(forceDiscard, 0);
  });
}

function forceDiscard() {
  iterationsLeft--;
  if (iterationsLeft < 0) {
    document.documentElement.className = "";
    return;
  }
  document.getElementById("container").style.display = "none";
  document.documentElement.getBoundingClientRect();
  requestAnimationFrame(() => { requestAnimationFrame( () => { setTimeout(showIframe, 0); } ) });
}

//window.addEventListener("load", runTest);
window.addEventListener("MozReftestInvalidate", runTest);
</script>
</body>
</html>