browser/base/content/test/general/browser_backButtonFitts.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     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();
    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.
    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 }

mercurial