layout/base/tests/bug583889_inner1.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:fc0649eef404
1 <html>
2 <body>
3 <iframe id="inner" style="height: 10px; width: 10px"></iframe>
4 <div style="width: 1000px; height: 1000px"></div>
5 <script type="application/javascript;version=1.8">
6 function grabEventAndGo(event) {
7 gen.send(event);
8 }
9
10 function waitAsync() {
11 setTimeout(function() { gen.next() }, 0);
12 }
13
14 function postPos() {
15 parent.postMessage(JSON.stringify({ top: document.body.scrollTop,
16 left: document.body.scrollLeft }),
17 "*");
18 }
19
20 function runTest() {
21 var inner = document.getElementById("inner");
22 window.onload = grabEventAndGo;
23 // Wait for onLoad event.
24 yield;
25
26 document.body.scrollTop = 300;
27 document.body.scrollLeft = 300;
28
29 postPos();
30
31 inner.src = "bug583889_inner2.html#id1";
32 inner.onload = grabEventAndGo;
33 // Let parent process sent message.
34 // Wait for onLoad event from 'inner' iframe.
35 yield;
36
37 postPos();
38
39 inner.onload = null;
40 dump("hi");
41 inner.contentWindow.location = "bug583889_inner2.html#id2"
42 waitAsync();
43 // Let parent process sent message.
44 // Let 'inner' iframe update itself.
45 yield;
46
47 postPos();
48
49 inner.contentWindow.location.hash = "#id3"
50 waitAsync();
51 // Let parent process sent message.
52 // Let 'inner' iframe update itself.
53 yield;
54
55 postPos();
56
57 parent.postMessage("done", "*");
58 // Let parent process sent messages.
59 // "End" generator.
60 yield;
61 }
62
63 var gen = runTest();
64 gen.next();
65 </script>
66 </body>
67 </html>

mercurial