gecko-dev/dom/tests/browser/browser_autofocus_preference.js
abdelrhman 3990efb3f1 Bug 1111276 - Replace gBrowser.selectedTab.linkedBrowser with gBrowser.selectedBrowser. r=dao
--HG--
extra : rebase_source : d7ef16a16f884458d99dff05efb370694d2ea5e3
2014-12-15 22:05:46 +01:00

25 lines
910 B
JavaScript

function test() {
waitForExplicitFinish();
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gAutofocusPref = prefs.getBoolPref("browser.autofocus");
prefs.setBoolPref("browser.autofocus", false);
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
executeSoon(function () {
is(gBrowser.selectedBrowser.contentDocument.activeElement,
gBrowser.selectedBrowser.contentDocument.body,
"foo");
prefs.setBoolPref("browser.autofocus", gAutofocusPref);
finish();
});
}, true);
gBrowser.selectedBrowser.loadURI("data:text/html,<!DOCTYPE html><html><body><input autofocus><button autofocus></button><textarea autofocus></textarea><select autofocus></select></body></html>");
}