layout/base/tests/bug583889_inner1.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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