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