Bug 672813: clicking the Go button needs to focus the content area, r=dao

This commit is contained in:
Gavin Sharp 2011-07-20 16:21:55 -04:00
parent ab6606e5a9
commit 783b0033f3
2 changed files with 11 additions and 10 deletions

View File

@ -46,6 +46,10 @@ function testURL(url, loadFunc, endFunc) {
loadFunc(url);
addPageShowListener(function () {
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
is(fm.focusedElement, null, "should be no focused element");
is(fm.focusedWindow, gBrowser.contentWindow, "content window should be focused");
ok(!gBrowser.contentPrincipal.equals(pagePrincipal),
"load of " + url + " by " + loadFunc.name + " should produce a page with a different principal");
endFunc();

View File

@ -327,6 +327,11 @@
gBrowser.loadURIWithFlags(url, flags, null, null, postData);
}
// Focus the content area before triggering loads, since if the load
// occurs in a new tab, we want focus to be restored to the content
// area when the current tab is re-selected.
gBrowser.selectedBrowser.focus();
if (aTriggeringEvent instanceof MouseEvent) {
// We have a mouse event (from the go button), so use the standard
// UI link behaviors
@ -335,18 +340,12 @@
loadCurrent();
} else {
this.handleRevert();
content.focus();
openUILinkIn(url, where,
{ allowThirdPartyFixup: true, postData: postData });
}
return;
}
if (aTriggeringEvent &&
aTriggeringEvent.altKey &&
!isTabEmpty(gBrowser.selectedTab)) {
} else if (aTriggeringEvent && aTriggeringEvent.altKey &&
!isTabEmpty(gBrowser.selectedTab)) {
this.handleRevert();
content.focus();
gBrowser.loadOneTab(url, {
postData: postData,
inBackground: false,
@ -356,8 +355,6 @@
} else {
loadCurrent();
}
gBrowser.selectedBrowser.focus();
]]></body>
</method>