docshell/test/test_bug640387_2.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=640387
     5 -->
     6 <head>
     7   <title>Test for Bug 640387</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=640387">Mozilla Bug 640387</a>
    15 <!-- Test that, when going from
    17   http://example.com/#foo
    19 to
    21   http://example.com/
    23 via a non-history load, we do a true load, rather than a scroll. -->
    25 <script type='application/javascript;version=1.7'>
    26 SimpleTest.waitForExplicitFinish();
    28 callbackOnLoad = false;
    29 function childLoad() {
    30   if (callbackOnLoad) {
    31     callbackOnLoad = false;
    32     gGen.next();
    33   }
    34 }
    36 errorOnHashchange = false;
    37 callbackOnHashchange = false;
    38 function childHashchange() {
    39   if (errorOnHashchange) {
    40     ok(false, 'Got unexpected hashchange.');
    41   }
    42   if (callbackOnHashchange) {
    43     callbackOnHashchange = false;
    44     gGen.next();
    45   }
    46 }
    48 function run_test() {
    49   var iframe = $('iframe').contentWindow;
    51   ok(true, 'Got first load');
    53   // Spin the event loop so we exit the onload handler.
    54   SimpleTest.executeSoon(function() { gGen.next() });
    55   yield undefined;
    57   let origLocation = iframe.location + '';
    58   callbackOnHashchange = true;
    59   iframe.location.hash = '#1';
    60   // Wait for a hashchange event.
    61   yield undefined;
    63   ok(true, 'Got hashchange.');
    65   iframe.location = origLocation;
    66   // This should produce a load event and *not* a hashchange, because the
    67   // result of the load is a different document than we had previously.
    68   callbackOnLoad = true;
    69   errorOnHashchange = true;
    70   yield undefined;
    72   ok(true, 'Got final load.');
    74   // Spin the event loop to give hashchange a chance to fire, if it's going to.
    75   SimpleTest.executeSoon(function() { gGen.next() });
    76   yield undefined;
    78   SimpleTest.finish();
    79   yield undefined;
    80 }
    82 callbackOnLoad = true;
    83 gGen = run_test();
    85 </script>
    87 <iframe id='iframe' src='file_bug640387.html'></iframe>
    89 </body>
    90 </html>

mercurial