Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Test handling plugins invalidating during paint</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="text/javascript" src="enableTestPlugin.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
8 <style>
9 embed { width:200px; height:200px; display:block; }
10 </style>
11 </head>
12 <body>
13 <p id="display"></p>
14 <div id="content" style="display: block">
15 <embed id="p1" type="application/x-test" drawmode="solid" color="80808080"></embed>
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
19 var p1 = document.getElementById("p1");
20 var initialPaintCount;
22 function checkEnded() {
23 var paints = p1.getPaintCount() - initialPaintCount;
24 if (paints > 20) {
25 ok(true, "Got " + paints + " paints");
26 SimpleTest.finish();
27 return;
28 }
30 setTimeout(checkEnded, 30);
31 }
33 function doTest() {
34 initialPaintCount = p1.getPaintCount();
36 // Tell the plugin to invalidate every time it paints
37 p1.setInvalidateDuringPaint(true);
38 // Trigger an invalidation to get painting started
39 p1.setColor("FFFFFFFF");
40 // Now we should have an infinite cycle of painting and invalidations.
42 // Poll for more than 20 paints to happen.
43 checkEnded();
44 }
46 // Need to run 'doTest' after painting is unsuppressed, or we'll set clip
47 // regions to empty.
48 addLoadEvent(doTest);
49 SimpleTest.waitForExplicitFinish();
51 </script>
52 </pre>
53 </body>
54 </html>