1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/general/test_bug653364.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=653364 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 653364</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=653364">Mozilla Bug 653364</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 653364 **/ 1.26 + 1.27 +gotPopState = 0; 1.28 +document.addEventListener("popState", function(e) { 1.29 + gotPopState = 1; 1.30 + is(e.state.foo, 'bar', "PopState event should have state we set."); 1.31 + is(e.isTrusted, false, "PopState event shouldn't be trusted."); 1.32 +}, true); 1.33 + 1.34 +let ps = document.createEvent("PopStateEvent"); 1.35 +ps.initPopStateEvent("popState", true, false, {'foo': 'bar'}); 1.36 +document.documentElement.dispatchEvent(ps); 1.37 +is(gotPopState, 1, 'Document received PopState event.'); 1.38 + 1.39 +</script> 1.40 +</body> 1.41 +</html>