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