dom/tests/mochitest/general/test_bug628069_2.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/general/test_bug628069_2.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=628069
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 628069</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=628069">Mozilla Bug 628069</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content">
    1.19 +  <iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
    1.20 +  <div id="status" style="display: none"></div>
    1.21 +</div>
    1.22 +<pre id="test">
    1.23 +<script type="application/javascript;version=1.7">
    1.24 +
    1.25 +/** Test for Bug 628069 **/
    1.26 +
    1.27 +gotHashChange = 0;
    1.28 +document.addEventListener("hashChange", function(e) {
    1.29 +  gotHashChange = 1;
    1.30 +  is(e.oldURL, "oldURL");
    1.31 +  is(e.newURL, "newURL");
    1.32 +  is(e.isTrusted, false, "Hashchange event shouldn't be trusted.");
    1.33 +}, true);
    1.34 +
    1.35 +let hc = document.createEvent("HashChangeEvent");
    1.36 +hc.initHashChangeEvent("hashChange", true, false, "oldURL", "newURL");
    1.37 +document.documentElement.dispatchEvent(hc);
    1.38 +is(gotHashChange, 1, 'Document received hashchange event.');
    1.39 +
    1.40 +</script>
    1.41 +</body>
    1.42 +</html>

mercurial