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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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