Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test handling plugins invalidating during paint</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="text/javascript" src="enableTestPlugin.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | <style> |
michael@0 | 9 | embed { width:200px; height:200px; display:block; } |
michael@0 | 10 | </style> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: block"> |
michael@0 | 15 | <embed id="p1" type="application/x-test" drawmode="solid" color="80808080"></embed> |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <script class="testbody" type="text/javascript"> |
michael@0 | 19 | var p1 = document.getElementById("p1"); |
michael@0 | 20 | var initialPaintCount; |
michael@0 | 21 | |
michael@0 | 22 | function checkEnded() { |
michael@0 | 23 | var paints = p1.getPaintCount() - initialPaintCount; |
michael@0 | 24 | if (paints > 20) { |
michael@0 | 25 | ok(true, "Got " + paints + " paints"); |
michael@0 | 26 | SimpleTest.finish(); |
michael@0 | 27 | return; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | setTimeout(checkEnded, 30); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function doTest() { |
michael@0 | 34 | initialPaintCount = p1.getPaintCount(); |
michael@0 | 35 | |
michael@0 | 36 | // Tell the plugin to invalidate every time it paints |
michael@0 | 37 | p1.setInvalidateDuringPaint(true); |
michael@0 | 38 | // Trigger an invalidation to get painting started |
michael@0 | 39 | p1.setColor("FFFFFFFF"); |
michael@0 | 40 | // Now we should have an infinite cycle of painting and invalidations. |
michael@0 | 41 | |
michael@0 | 42 | // Poll for more than 20 paints to happen. |
michael@0 | 43 | checkEnded(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | // Need to run 'doTest' after painting is unsuppressed, or we'll set clip |
michael@0 | 47 | // regions to empty. |
michael@0 | 48 | addLoadEvent(doTest); |
michael@0 | 49 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 50 | |
michael@0 | 51 | </script> |
michael@0 | 52 | </pre> |
michael@0 | 53 | </body> |
michael@0 | 54 | </html> |