dom/tests/browser/browser_autofocus_preference.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.)

     1 function test() {
     2   waitForExplicitFinish();
     4   var prefs = Components.classes["@mozilla.org/preferences-service;1"]
     5             .getService(Components.interfaces.nsIPrefBranch);
     6   var gAutofocusPref = prefs.getBoolPref("browser.autofocus");
     7   prefs.setBoolPref("browser.autofocus", false);
     9   gBrowser.selectedTab.linkedBrowser.addEventListener("load", function () {
    10     gBrowser.selectedTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
    12     executeSoon(function () {
    13       is(gBrowser.selectedTab.linkedBrowser.contentDocument.activeElement,
    14          gBrowser.selectedTab.linkedBrowser.contentDocument.body,
    15          "foo");
    17       prefs.setBoolPref("browser.autofocus", gAutofocusPref);
    19       finish();
    20     });
    21   }, true);
    23   gBrowser.selectedTab.linkedBrowser.loadURI("data:text/html,<!DOCTYPE html><html><body><input autofocus><button autofocus></button><textarea autofocus></textarea><select autofocus></select></body></html>");
    24 }

mercurial