Bug 619786 - System titlebar seen at all times [r=mbrubeck]

This commit is contained in:
Mark Finkle 2011-01-03 16:08:54 -05:00
parent 510c49ead3
commit 326ea88da6
2 changed files with 23 additions and 7 deletions

View File

@ -366,8 +366,10 @@ var Browser = {
// Make sure we're online before attempting to load
Util.forceOnline();
let homeURL = this.getHomePage();
let commandURL;
// If this is an intial window launch the commandline handler passes us the default
// page as an argument. commandURL _should_ never be empty, but we protect against it
// below. However, we delay trying to get the fallback homepage until we really need it.
let commandURL = null;
if (window.arguments && window.arguments[0])
commandURL = window.arguments[0];
@ -375,10 +377,12 @@ var Browser = {
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
if (ss.shouldRestore()) {
ss.restoreLastSession();
if (commandURL)
// Also open any commandline URLs, except the homepage
if (commandURL && commandURL != this.getHomePage())
this.addTab(commandURL, true);
} else {
this.addTab(commandURL || homeURL, true);
this.addTab(commandURL || this.getHomePage(), true);
}
// JavaScript Error Console

View File

@ -105,6 +105,16 @@ function needHomepageOverride() {
return "none";
}
function getHomePage() {
let url = "about:home";
try {
url = Services.prefs.getComplexValue("browser.startup.homepage", Ci.nsIPrefLocalizedString).data;
} catch (e) { }
return url;
}
function BrowserCLH() { }
BrowserCLH.prototype = {
@ -172,7 +182,8 @@ BrowserCLH.prototype = {
try {
win = Services.wm.getMostRecentWindow("navigator:browser");
if (!win) {
let defaultURL;
// Default to the saved homepage
let defaultURL = getHomePage();
// Override the default if we have a new profile
if (needHomepageOverride() == "new profile")
@ -195,6 +206,8 @@ BrowserCLH.prototype = {
// Assumption: All remaining command line arguments have been sent remotely (browser is already running)
// Action: Open any URLs we find into an existing browser window
if (uris.length == 0)
return;
// First, get a browserDOMWindow object
while (!win.browserDOMWindow)
@ -202,8 +215,7 @@ BrowserCLH.prototype = {
// Open any URIs into new tabs
for (let i = 0; i < uris.length; i++)
win.browserDOMWindow.openURI(uris[i], null, Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
win.browserDOMWindow.openURI(uris[i], null, Ci.nsIBrowserDOMWindow.OPEN_NEWTAB, Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
},
// QI