summaryrefslogtreecommitdiffstats
path: root/layout/printing/crashtests/1758199-1.html
blob: 3f7c9227a48a35a8cd1c970e21f111eb4bf957ca (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
50
51
52
53
54
<html class="reftest-wait">
<script>
let pp;
let documentElements = [];
documentElements.push(document.documentElement);

window.onload = () => {
  documentElements.push(document.documentElement);

  let o = document.getElementById('a')
  o.parentNode.appendChild(o)
  pp = SpecialPowers.wrap(self).printPreview();
  pp?.print()
  window.requestIdleCallback(() => {
    documentElements.push(document.documentElement);

    document.write('');

    setTimeout(finish, 100);
  });
}

function finish() {

  // The printPreview call above actually opens two print preview windows
  // because the <embed src='#'> below causes a second one to open. At least
  // we close the one window we can access, not sure if there is a way to get
  // ahold of the other window to close it. So this test leaves a window open
  // after it finishes.
  try { pp.close(); } catch (e) {}

  if (document.documentElement) {
    try { document.documentElement.className = ""; } catch (e) {}
  }

  // The documentElement that the reftest harness looks at to determine if the
  // test is done is not what document.documentElement points to when this code
  // is run. So we save all the document.documentElement's we encounter while
  // running this test and clear all of their class names.
  for (let de of documentElements) {
    if (de) {
      try {
        de.className = "";
      } catch (e) {}
    }
  }
}
</script>
<style>
:first-of-type { padding-block-start: 99% }
</style>
<mark id='a'>
<embed src='#'>
</html>