Bug 249136. Focus and key navigation broken for links opened in new tabs. r=mconnor, r=timeless, a=bsmedberg

This commit is contained in:
aaronleventhal%moonset.net 2005-08-06 04:20:13 +00:00
Родитель e3d1c1e4a6
Коммит ff4ab56d38
4 изменённых файлов: 34 добавлений и 14 удалений

Просмотреть файл

@ -2735,9 +2735,7 @@ function OpenSearch(tabName, searchStr, newTabFlag)
loadURI(defaultSearchURL, null, null);
}
else {
var newTab = getBrowser().addTab(defaultSearchURL);
if (!gPrefService.getBoolPref("browser.tabs.loadInBackground"))
getBrowser().selectedTab = newTab;
getBrowser().loadOneTab(defaultSearchURL);
}
}
}

Просмотреть файл

@ -742,8 +742,13 @@ var BookmarksCommand = {
// focus the first tab if prefs say to
if (!loadInBackground || doReplace) {
// Select the first tab in the group.
// Set newly selected tab after quick timeout, otherwise hideous focus problems
// can occur because new presshell is not ready to handle events
function selectNewForegroundTab(browser, tab) {
browser.selectedTab = tab;
}
var tabs = browser.mTabContainer.childNodes;
browser.selectedTab = tabs[index0];
setTimeout(selectNewForegroundTab, 0, browser, tabs[index0]);
}
// Close any remaining open tabs that are left over.

Просмотреть файл

@ -76,9 +76,7 @@ function openNewTabWith(href, linkNode, event, securityCheck, postData, sendRefe
// If sendReferrer is not specified, default to true
var referrer = (sendReferrer == false) ? null : getReferrer(document);
var theTab = browser.addTab(href, referrer, originCharset, postData);
if (!loadInBackground)
browser.selectedTab = theTab;
browser.loadOneTab(href, referrer, originCharset, postData, loadInBackground);
if (linkNode)
markLinkVisited(href, linkNode);

Просмотреть файл

@ -953,6 +953,30 @@
</body>
</method>
<method name="loadOneTab">
<parameter name="aURI"/>
<parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<parameter name="aPostData"/>
<parameter name="aLoadInBackground"/>
<body>
<![CDATA[
var tab = this.addTab(aURI, aReferrerURI, aCharset, aPostData);
var bgLoad = (typeof(aLoadInBackground) != "undefined") ? aLoadInBackground :
this.mPrefs.getBoolPref("browser.tabs.loadInBackground");
// Set newly selected tab after quick timeout, otherwise hideous focus problems
// can occur when "browser.tabs.loadInBackground" is false and presshell is not ready
if (!bgLoad) {
function selectNewForegroundTab(browser, tab) {
this.selectedTab = tab;
}
setTimeout(selectNewForegroundTab, 0, getBrowser(), tab);
}
return tab;
]]>
</body>
</method>
<method name="addTab">
<parameter name="aURI"/>
<parameter name="aReferrerURI"/>
@ -1457,20 +1481,15 @@
this.dragDropSecurityCheck(aEvent, aDragSession, url);
var bgLoad = this.mPrefs.getBoolPref("browser.tabs.loadInBackground");
var tab = null;
if (aEvent.originalTarget.localName != "tab") {
// We're adding a new tab.
tab = this.addTab(getShortcutOrURI(url));
this.loadOneTab(getShortcutOrURI(url));
}
else {
// Load in an existing tab.
tab = aEvent.originalTarget;
var tab = aEvent.originalTarget;
this.getBrowserForTab(tab).loadURI(getShortcutOrURI(url));
}
if (this.mCurrentTab != tab && !bgLoad)
this.selectedTab = tab;
}
]]>
</body>