michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: function test () { michael@0: waitForExplicitFinish(); michael@0: var firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html"; michael@0: gBrowser.selectedTab = gBrowser.addTab(firstLocation); michael@0: gBrowser.selectedBrowser.addEventListener("pageshow", function onPageShow1() { michael@0: gBrowser.selectedBrowser.removeEventListener("pageshow", onPageShow1); michael@0: gBrowser.selectedBrowser.contentWindow.history.pushState("page2", "page2", "page2"); michael@0: window.maximize(); michael@0: michael@0: // Find where the nav-bar is vertically. michael@0: var navBar = document.getElementById("nav-bar"); michael@0: var boundingRect = navBar.getBoundingClientRect(); michael@0: var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2); michael@0: var xPixel = 0; // Use the first pixel of the screen since it is maximized. michael@0: michael@0: gBrowser.selectedBrowser.contentWindow.addEventListener("popstate", function onPopState() { michael@0: gBrowser.selectedBrowser.contentWindow.removeEventListener("popstate", onPopState); michael@0: is(gBrowser.selectedBrowser.contentDocument.location.href, firstLocation, michael@0: "Clicking the first pixel should have navigated back."); michael@0: window.restore(); michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: }); michael@0: EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window); michael@0: }); michael@0: }