|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 function test () { |
|
6 waitForExplicitFinish(); |
|
7 var firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html"; |
|
8 gBrowser.selectedTab = gBrowser.addTab(firstLocation); |
|
9 gBrowser.selectedBrowser.addEventListener("pageshow", function onPageShow1() { |
|
10 gBrowser.selectedBrowser.removeEventListener("pageshow", onPageShow1); |
|
11 gBrowser.selectedBrowser.contentWindow.history.pushState("page2", "page2", "page2"); |
|
12 window.maximize(); |
|
13 |
|
14 // Find where the nav-bar is vertically. |
|
15 var navBar = document.getElementById("nav-bar"); |
|
16 var boundingRect = navBar.getBoundingClientRect(); |
|
17 var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2); |
|
18 var xPixel = 0; // Use the first pixel of the screen since it is maximized. |
|
19 |
|
20 gBrowser.selectedBrowser.contentWindow.addEventListener("popstate", function onPopState() { |
|
21 gBrowser.selectedBrowser.contentWindow.removeEventListener("popstate", onPopState); |
|
22 is(gBrowser.selectedBrowser.contentDocument.location.href, firstLocation, |
|
23 "Clicking the first pixel should have navigated back."); |
|
24 window.restore(); |
|
25 gBrowser.removeCurrentTab(); |
|
26 finish(); |
|
27 }); |
|
28 EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window); |
|
29 }); |
|
30 } |