layout/base/tests/bug583889_inner1.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 }
    10 function waitAsync() {
    11   setTimeout(function() { gen.next() }, 0);
    12 }
    14 function postPos() {
    15   parent.postMessage(JSON.stringify({ top: document.body.scrollTop,
    16                                       left: document.body.scrollLeft }),
    17                      "*");
    18 }
    20 function runTest() {
    21   var inner = document.getElementById("inner");
    22   window.onload = grabEventAndGo;
    23   // Wait for onLoad event.
    24   yield;
    26   document.body.scrollTop = 300;
    27   document.body.scrollLeft = 300;
    29   postPos();
    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;
    37   postPos();
    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;
    47   postPos();
    49   inner.contentWindow.location.hash = "#id3"
    50   waitAsync();
    51   // Let parent process sent message.
    52   // Let 'inner' iframe update itself.
    53   yield;
    55   postPos();
    57   parent.postMessage("done", "*");
    58   // Let parent process sent messages.
    59   // "End" generator.
    60   yield;
    61 }
    63 var gen = runTest();
    64 gen.next();
    65 </script>
    66 </body>
    67 </html>

mercurial