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 whether windowless plugins receive correct visible/invisible notifications.</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="text/javascript" src="utils.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 <style type="text/css">
10 body {
11 height: 10000px;
12 }
13 </style>
15 <body onload="startTest()">
16 <p id="display"></p>
18 <script type="application/javascript;version=1.8">
19 SimpleTest.waitForExplicitFinish();
20 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
22 var p = null;
24 function startTest() {
25 p = document.getElementById('theplugin');
27 // Wait for the plugin to have painted once
28 var interval = setInterval(function() {
29 if (!p.getPaintCount())
30 return;
32 clearInterval(interval);
33 doScroll();
34 }, 100);
35 }
37 const kScrollAmount = 1000;
38 var startY;
40 function doScroll() {
41 let [x, y, w, h] = p.getWindowPosition();
42 startY = y;
44 scrollBy(0, kScrollAmount);
45 setTimeout(checkScroll, 500);
46 }
48 function checkScroll() {
49 let [x, y, w, h] = p.getWindowPosition();
51 is(y, startY - kScrollAmount, "Window should be informed of its new position.");
52 SimpleTest.finish();
53 }
54 </script>
56 <embed id="theplugin" type="application/x-test" width="200" height="200"></embed>