1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_bug647886.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function test() { 1.8 + waitForExplicitFinish(); 1.9 + 1.10 + gBrowser.selectedTab = gBrowser.addTab(); 1.11 + gBrowser.selectedBrowser.addEventListener("load", function () { 1.12 + gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); 1.13 + 1.14 + content.history.pushState({}, "2", "2.html"); 1.15 + 1.16 + testBackButton(); 1.17 + }, true); 1.18 + 1.19 + loadURI("http://example.com"); 1.20 +} 1.21 + 1.22 +function testBackButton() { 1.23 + var backButton = document.getElementById("back-button"); 1.24 + var rect = backButton.getBoundingClientRect(); 1.25 + 1.26 + info("waiting for the history menu to open"); 1.27 + 1.28 + backButton.addEventListener("popupshown", function (event) { 1.29 + backButton.removeEventListener("popupshown", arguments.callee, false); 1.30 + 1.31 + ok(true, "history menu opened"); 1.32 + event.target.hidePopup(); 1.33 + gBrowser.removeTab(gBrowser.selectedTab); 1.34 + finish(); 1.35 + }, false); 1.36 + 1.37 + EventUtils.synthesizeMouseAtCenter(backButton, {type: "mousedown"}); 1.38 + EventUtils.synthesizeMouse(backButton, rect.width / 2, rect.height, {type: "mouseup"}); 1.39 +}