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