layout/base/tests/bug583889_inner1.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/bug583889_inner1.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +<html>
     1.5 +<body>
     1.6 +<iframe id="inner" style="height: 10px; width: 10px"></iframe>
     1.7 +<div style="width: 1000px; height: 1000px"></div>
     1.8 +<script type="application/javascript;version=1.8">
     1.9 +function grabEventAndGo(event) {
    1.10 +  gen.send(event);
    1.11 +}
    1.12 +
    1.13 +function waitAsync() {
    1.14 +  setTimeout(function() { gen.next() }, 0);
    1.15 +}
    1.16 +
    1.17 +function postPos() {
    1.18 +  parent.postMessage(JSON.stringify({ top: document.body.scrollTop,
    1.19 +                                      left: document.body.scrollLeft }),
    1.20 +                     "*");
    1.21 +}
    1.22 +
    1.23 +function runTest() {
    1.24 +  var inner = document.getElementById("inner");
    1.25 +  window.onload = grabEventAndGo;
    1.26 +  // Wait for onLoad event.
    1.27 +  yield;
    1.28 +
    1.29 +  document.body.scrollTop = 300;
    1.30 +  document.body.scrollLeft = 300;
    1.31 +
    1.32 +  postPos();
    1.33 +
    1.34 +  inner.src = "bug583889_inner2.html#id1";
    1.35 +  inner.onload = grabEventAndGo;
    1.36 +  // Let parent process sent message.
    1.37 +  // Wait for onLoad event from 'inner' iframe.
    1.38 +  yield;
    1.39 +  
    1.40 +  postPos();
    1.41 +  
    1.42 +  inner.onload = null;
    1.43 +  dump("hi");
    1.44 +  inner.contentWindow.location = "bug583889_inner2.html#id2"
    1.45 +  waitAsync();
    1.46 +  // Let parent process sent message.
    1.47 +  // Let 'inner' iframe update itself.
    1.48 +  yield;
    1.49 +
    1.50 +  postPos();
    1.51 +
    1.52 +  inner.contentWindow.location.hash = "#id3"
    1.53 +  waitAsync();
    1.54 +  // Let parent process sent message.
    1.55 +  // Let 'inner' iframe update itself.
    1.56 +  yield;
    1.57 +
    1.58 +  postPos();
    1.59 +
    1.60 +  parent.postMessage("done", "*");
    1.61 +  // Let parent process sent messages.
    1.62 +  // "End" generator.
    1.63 +  yield;
    1.64 +}
    1.65 +
    1.66 +var gen = runTest();
    1.67 +gen.next();
    1.68 +</script>
    1.69 +</body>
    1.70 +</html>

mercurial