browser/base/content/test/general/browser_visibleFindSelection.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.

     2 function test() {
     3   waitForExplicitFinish();
     5   let tab = gBrowser.addTab();
     6   gBrowser.selectedTab = tab;
     7   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     8     tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
    10     ok(true, "Load listener called");
    11     waitForFocus(onFocus, content);
    12   }, true);
    14   content.location = "data:text/html,<div style='position: absolute; left: 2200px; background: green; width: 200px; height: 200px;'>div</div><div style='position: absolute; left: 0px; background: red; width: 200px; height: 200px;'><span id='s'>div</span></div>";
    15 }
    17 function onFocus() {
    18   EventUtils.synthesizeKey("f", { accelKey: true });
    19   ok(gFindBarInitialized, "find bar is now initialized");
    21   EventUtils.synthesizeKey("d", {});
    22   EventUtils.synthesizeKey("i", {});
    23   EventUtils.synthesizeKey("v", {});
    24   // finds the div in the green box
    26   EventUtils.synthesizeKey("g", { accelKey: true });
    27   // finds the div in the red box
    29   var rect = content.document.getElementById("s").getBoundingClientRect();
    30   ok(rect.left >= 0, "scroll should include find result");
    32   // clear the find bar
    33   EventUtils.synthesizeKey("a", { accelKey: true });
    34   EventUtils.synthesizeKey("VK_DELETE", { });
    36   gFindBar.close();
    37   gBrowser.removeCurrentTab();
    38   finish();
    39 }

mercurial