diff --git a/xpfe/browser/resources/content/navigator.js b/xpfe/browser/resources/content/navigator.js index 3f1890262f7..d3a9f5e879c 100644 --- a/xpfe/browser/resources/content/navigator.js +++ b/xpfe/browser/resources/content/navigator.js @@ -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 ); diff --git a/xpfe/communicator/resources/content/contentAreaUtils.js b/xpfe/communicator/resources/content/contentAreaUtils.js index 2609fd456fb..31f1df5f701 100644 --- a/xpfe/communicator/resources/content/contentAreaUtils.js +++ b/xpfe/communicator/resources/content/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)