Bug 37638: URL bar is given focus by default in new window [via accel+N or File > New Navigator Window]

Bug 89835: Window opened up with JavaScript has focus in the URL bar while NN4 and IE put focus on the content area

Focus will now always go to the content area unless we're opening for a blank page.

r=bryner, sr=hewitt


git-svn-id: svn://10.0.0.236/trunk@118700 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jaggernaut%netscape.com
2002-04-11 01:20:02 +00:00
parent 7eecf8f9aa
commit 8880e4d3a9
2 changed files with 18 additions and 28 deletions

View File

@@ -410,8 +410,8 @@ function Startup()
if (uriToLoad && uriToLoad != "about:blank") {
gURLBar.value = uriToLoad;
if ("arguments" in window && window.arguments.length >= 4) {
loadURI(uriToLoad, window.arguments[3]);
if ("arguments" in window && window.arguments.length >= 3) {
loadURI(uriToLoad, window.arguments[2]);
} else {
loadURI(uriToLoad);
}
@@ -428,12 +428,11 @@ function Startup()
return;
}
// Focus the content area if the caller instructed us to.
if ("arguments" in window && window.arguments.length >= 3 && window.arguments[2] == true ||
!window.locationbar.visible)
setTimeout(WindowFocusTimerCallback, 0, _content);
else
// Focus the content area unless we're loading a blank page
if (uriToLoad == "about:blank" && window.locationbar.visible)
setTimeout(WindowFocusTimerCallback, 0, gURLBar);
else
setTimeout(WindowFocusTimerCallback, 0, _content);
// Perform default browser checking (after window opens).
setTimeout( checkForDefaultBrowser, 0 );

View File

@@ -84,38 +84,29 @@ function getReferrer(doc)
function openNewWindowWith(url)
{
urlSecurityCheck(url, document);
var newWin;
var wintype = document.firstChild.getAttribute('windowtype');
var referrer = getReferrer(document);
// if and only if the current window is a browser window and it has a document with a character
// set, then extract the current charset menu setting from the current document and use it to
// initialize the new browser window...
if (window && (wintype == "navigator:browser") &&
window._content && window._content.document) {
var DocCharset = window._content.document.characterSet;
var charsetArg = "charset="+DocCharset;
var charsetArg = null;
var wintype = document.firstChild.getAttribute('windowtype');
if (wintype == "navigator:browser")
charsetArg = "charset=" + window._content.document.characterSet;
//we should "inherit" the charset menu setting in a new window
newWin = window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url, charsetArg, true, referrer );
}
else { // forget about the charset information.
newWin = window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url, null, true, referrer );
}
var referrer = getReferrer(document);
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url, charsetArg, referrer);
}
function openNewTabWith(url)
{
urlSecurityCheck(url, document);
var wintype = document.firstChild.getAttribute('windowtype');
var referrer = getReferrer(document);
var browser = getBrowser();
if (window && (wintype == "navigator:browser")) {
var browser = getBrowser();
var t = browser.addTab(url, referrer); // open link in new tab
if (pref && !pref.getBoolPref("browser.tabs.loadInBackground"))
browser.selectedTab = t;
}
var referrer = getReferrer(document);
var tab = browser.addTab(url, referrer); // open link in new tab
if (pref && !pref.getBoolPref("browser.tabs.loadInBackground"))
browser.selectedTab = tab;
}
function findParentNode(node, parentNode)