зеркало из https://github.com/mozilla/pjs.git
Bug 653364 - HashChange event should have isTrusted property. r=bz
--HG-- extra : rebase_source : 6829b06980ed01c38e0cc5b88a9428fc784c1bb0
This commit is contained in:
Родитель
e58e8b7ac3
Коммит
de8d6b2b66
|
@ -2620,7 +2620,7 @@ nsDOMClassInfo::Init()
|
|||
|
||||
DOM_CLASSINFO_MAP_BEGIN(HashChangeEvent, nsIDOMHashChangeEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHashChangeEvent)
|
||||
DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
if (nsDOMTouchEvent::PrefEnabled()) {
|
||||
|
|
|
@ -54,6 +54,7 @@ _TEST_FILES = \
|
|||
test_bug628069_2.html \
|
||||
file_bug628069.html \
|
||||
test_bug631440.html \
|
||||
test_bug653364.html \
|
||||
test_consoleAPI.html \
|
||||
test_domWindowUtils.html \
|
||||
test_domWindowUtils_scrollXY.html \
|
||||
|
|
|
@ -41,6 +41,7 @@ function childLoad() {
|
|||
function childHashchange(e) {
|
||||
is(e.oldURL, gOrigURL, 'event.oldURL');
|
||||
is(e.newURL, gOrigURL + '#hash', 'event.newURL');
|
||||
is(e.isTrusted, true, 'Hashchange event should be trusted.');
|
||||
popup.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ document.addEventListener("hashChange", function(e) {
|
|||
gotHashChange = 1;
|
||||
is(e.oldURL, "oldURL");
|
||||
is(e.newURL, "newURL");
|
||||
is(e.isTrusted, false, "Hashchange event shouldn't be trusted.");
|
||||
}, true);
|
||||
|
||||
let hc = document.createEvent("HashChangeEvent");
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=653364
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 653364</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=653364">Mozilla Bug 653364</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe id="frame" style="height:100px; width:100px; border:0"></iframe>
|
||||
<div id="status" style="display: none"></div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
/** Test for Bug 653364 **/
|
||||
|
||||
gotPopState = 0;
|
||||
document.addEventListener("popState", function(e) {
|
||||
gotPopState = 1;
|
||||
is(e.state.foo, 'bar', "PopState event should have state we set.");
|
||||
is(e.isTrusted, false, "PopState event shouldn't be trusted.");
|
||||
}, true);
|
||||
|
||||
let ps = document.createEvent("PopStateEvent");
|
||||
ps.initPopStateEvent("popState", true, false, {'foo': 'bar'});
|
||||
document.documentElement.dispatchEvent(ps);
|
||||
is(gotPopState, 1, 'Document received PopState event.');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -274,6 +274,7 @@ function runTest() {
|
|||
|
||||
statusMsg("Awake after going back to page 1.");
|
||||
popstateExpected("Going back to page 1 should trigger a popstate.");
|
||||
is(gLastPopStateEvent.isTrusted, true, 'Popstate event should be trusted.');
|
||||
is(JSON.stringify(gLastPopStateEvent.state), JSON.stringify(testObj1),
|
||||
"Wrong state object popped after going back to page 1.");
|
||||
ok(gLastPopStateEvent.state === iframeCw.history.state,
|
||||
|
|
Загрузка…
Ссылка в новой задаче