summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/chrome/bug1041200_window.html
blob: e098e1d924ee017ead6392cfa6d25bd6a0427c79 (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
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for Bug 1041200</title>
  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
</head>
<body>
<iframe style="width:700px; height:500px; margin-top:200px;" id="ourFrame"></iframe>
<script>
var SpecialPowers = window.opener.wrappedJSObject.SpecialPowers;
var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
var ok = window.opener.wrappedJSObject.ok;
var info = window.opener.wrappedJSObject.info;

var viewer =
  SpecialPowers.wrap(ourFrame).contentWindow
               .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
               .getInterface(SpecialPowers.Ci.nsIWebNavigation)
               .QueryInterface(SpecialPowers.Ci.nsIDocShell)
               .contentViewer;
viewer.fullZoom = 2;

SimpleTest.waitForExplicitFinish();

window.onload = function() {
  window.waitForAllPaintsFlushed(function () {
    // Supply random key to ensure load actually happens
    ourFrame.src = "data:text/html,<body onload='parent.childLoaded()' style='background:lime'><p>Hello<p>Hello<p>Hello<p>Hello<p>Hello<p>" + Math.random();
  }, document.getElementById("ourFrame").contentDocument);
};

window.childLoaded = function() {
  setTimeout(function() {
    window.waitForAllPaintsFlushed(function(x1, y1, x2, y2) {
      ok(x2 - x1 >= 700 && y2 - y1 >= 500,
         "expected to see invalidate of entire frame, got " + [x1,y1,x2,y2].join(','));
      SimpleTest.finish();
      window.close();
    });
  }, 0);
};
</script>