|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 waitForExplicitFinish(); |
|
6 |
|
7 gBrowser.selectedTab = gBrowser.addTab(); |
|
8 gBrowser.selectedBrowser.addEventListener("load", function () { |
|
9 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); |
|
10 |
|
11 content.history.pushState({}, "2", "2.html"); |
|
12 |
|
13 testBackButton(); |
|
14 }, true); |
|
15 |
|
16 loadURI("http://example.com"); |
|
17 } |
|
18 |
|
19 function testBackButton() { |
|
20 var backButton = document.getElementById("back-button"); |
|
21 var rect = backButton.getBoundingClientRect(); |
|
22 |
|
23 info("waiting for the history menu to open"); |
|
24 |
|
25 backButton.addEventListener("popupshown", function (event) { |
|
26 backButton.removeEventListener("popupshown", arguments.callee, false); |
|
27 |
|
28 ok(true, "history menu opened"); |
|
29 event.target.hidePopup(); |
|
30 gBrowser.removeTab(gBrowser.selectedTab); |
|
31 finish(); |
|
32 }, false); |
|
33 |
|
34 EventUtils.synthesizeMouseAtCenter(backButton, {type: "mousedown"}); |
|
35 EventUtils.synthesizeMouse(backButton, rect.width / 2, rect.height, {type: "mouseup"}); |
|
36 } |