Bug 1246635, enable browser_autofocus_preference.js in e10s, r=mrbkap

This commit is contained in:
Neil Deakin 2016-03-09 09:11:35 -05:00
parent 3c1f661ece
commit 01667b7d93
2 changed files with 13 additions and 20 deletions

View File

@ -25,7 +25,6 @@ skip-if = e10s
[browser_autofocus_background.js]
skip-if= buildapp == 'mulet'
[browser_autofocus_preference.js]
skip-if = e10s
[browser_bug1238427.js]
skip-if = e10s
[browser_bug396843.js]

View File

@ -1,24 +1,18 @@
function test() {
waitForExplicitFinish();
add_task(function* () {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [["browser.autofocus", false]]}, resolve);
});
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gAutofocusPref = prefs.getBoolPref("browser.autofocus");
prefs.setBoolPref("browser.autofocus", false);
const url = "data:text/html,<!DOCTYPE html><html><body><input autofocus><button autofocus></button><textarea autofocus></textarea><select autofocus></select></body></html>";
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gBrowser.selectedBrowser.loadURI(url);
yield loadedPromise;
executeSoon(function () {
is(gBrowser.selectedBrowser.contentDocument.activeElement,
gBrowser.selectedBrowser.contentDocument.body,
"foo");
yield new Promise(resolve => executeSoon(resolve));
prefs.setBoolPref("browser.autofocus", gAutofocusPref);
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
is(content.document.activeElement, content.document.body, "body focused");
});
});
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>");
}