michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: let fm = Components.classes["@mozilla.org/focus-manager;1"] michael@0: .getService(Components.interfaces.nsIFocusManager); michael@0: michael@0: let tabs = [ gBrowser.selectedTab, gBrowser.addTab() ]; michael@0: michael@0: // The first tab has an autofocused element. michael@0: // The second tab is exactly like the first one without the autofocus. michael@0: let testingList = [ michael@0: { uri: "data:text/html,
", michael@0: tagName: "INPUT"}, michael@0: ]; michael@0: michael@0: function runTest() { michael@0: // Set the focus to the first tab. michael@0: tabs[0].linkedBrowser.focus(); michael@0: michael@0: // Load the first tab on background. michael@0: tabs[1].linkedBrowser.addEventListener("load", onLoadBackgroundTab, true); michael@0: tabs[1].linkedBrowser.loadURI(testingList[0].uri); michael@0: } michael@0: michael@0: function onLoadBackgroundTab() { michael@0: tabs[1].linkedBrowser.removeEventListener("load", onLoadBackgroundTab, true); michael@0: michael@0: // The focus event (from autofocus) has been sent, michael@0: // let's test with executeSoon so we are sure the test is done michael@0: // after the focus event is processed. michael@0: executeSoon(doTest); michael@0: } michael@0: michael@0: function doTest() { michael@0: for (var i=0; i