From a183f6750ae26a7b7c8910e65ec98b8e7560bb63 Mon Sep 17 00:00:00 2001 From: "jaggernaut%netscape.com" Date: Sat, 29 Jul 2006 05:40:23 +0000 Subject: [PATCH] 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 --- suite/common/contentAreaUtils.js | 33 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/suite/common/contentAreaUtils.js b/suite/common/contentAreaUtils.js index 2609fd456fb1..31f1df5f701d 100644 --- a/suite/common/contentAreaUtils.js +++ b/suite/common/contentAreaUtils.js @@ -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)