Bug 691925 - Replaced content.focus() with gBrowser.selectedBrowser.focus() and/or window.focus(). r=dao

This commit is contained in:
Abhishek Potnis 2012-09-19 12:59:26 +02:00
parent 1fa079f787
commit 482c9a8d8a
10 changed files with 15 additions and 16 deletions

View File

@ -1126,7 +1126,7 @@ var gBrowserInit = {
else if (window.arguments.length >= 3) {
loadURI(uriToLoad, window.arguments[2], window.arguments[3] || null,
window.arguments[4] || false);
content.focus();
window.focus();
}
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
// Such callers expect that window.arguments[0] is handled as a single URI.
@ -3660,7 +3660,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
if (!getBoolPref("ui.click_hold_context_menus", false))
SetClickAndHoldHandlers();
window.content.focus();
gBrowser.selectedBrowser.focus();
}
function BrowserToolboxCustomizeChange(aType) {
@ -4648,7 +4648,7 @@ nsBrowserAccess.prototype = {
gBrowser.loadURIWithFlags(aURI.spec, loadflags, referrer, null, null);
}
if (!gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground"))
content.focus();
window.focus();
}
return newWindow;
},
@ -4966,7 +4966,7 @@ function toggleSidebar(commandID, forceOpen) {
sidebarTitle.value = "";
sidebarBox.hidden = true;
sidebarSplitter.hidden = true;
content.focus();
gBrowser.selectedBrowser.focus();
} else {
fireSidebarFocusedEvent();
}

View File

@ -1187,7 +1187,7 @@
this.selectedTab = firstTabAdded;
}
else
window.content.focus();
this.selectedBrowser.focus();
}
]]></body>
</method>

View File

@ -38,7 +38,7 @@ var asyncTests = [
function (tab) {
info("closing tab with accel+w");
gBrowser.selectedTab = tab;
content.focus();
gBrowser.selectedBrowser.focus();
EventUtils.synthesizeKey("w", { accelKey: true });
},
function (tab) {

View File

@ -1,7 +1,7 @@
function test() {
is(gBrowser.tabs.length, 1, "one tab is open");
content.focus();
gBrowser.selectedBrowser.focus();
isnot(document.activeElement, gURLBar.inputField, "location bar is not focused");
var tab = gBrowser.selectedTab;

View File

@ -68,7 +68,7 @@ function step5()
is(document.activeElement, tab2, "click on tab2 while tab1 is activated activates tab");
ok(true, "focusing content then sending middle-button mousedown to tab2.");
content.focus();
gBrowser.selectedBrowser.focus();
EventUtils.synthesizeMouseAtCenter(tab2, {button: 1, type: "mousedown"});
setTimeout(step6, 0);
}

View File

@ -1,6 +1,6 @@
function test() {
var tabCount = gBrowser.tabs.length;
content.focus();
gBrowser.selectedBrowser.focus();
browserDOMWindow.openURI(makeURI("about:blank"),
null,
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,

View File

@ -323,9 +323,8 @@ function openLinkIn(url, where, params) {
var fm = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
if (window == fm.activeWindow)
w.content.focus();
else
w.gBrowser.selectedBrowser.focus();
w.focus();
w.gBrowser.selectedBrowser.focus();
if (!loadInBackground && isBlankPageURL(url))
w.focusAndSelectUrlBar();

View File

@ -3579,8 +3579,8 @@ let SessionStoreInternal = {
}
// since resizing/moving a window brings it to the foreground,
// we might want to re-focus the last focused window
if (this.windowToFocus && this.windowToFocus.content) {
this.windowToFocus.content.focus();
if (this.windowToFocus) {
this.windowToFocus.focus();
}
},

View File

@ -80,7 +80,7 @@ function test_focus_first()
test_remove_tab();
});
}, false);
window.content.focus();
window.focus();
}
function test_remove_tab()

View File

@ -36,7 +36,7 @@ function pageLoaded()
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let doCopy = function() {
content.focus();
gBrowser.selectedBrowser.focus();
EventUtils.synthesizeKey("a", {accelKey: true}, content);
EventUtils.synthesizeKey("c", {accelKey: true}, content);
};