From 0ea0cbfef11f121db5957665d8e48333af3ebc3a Mon Sep 17 00:00:00 2001 From: "law%netscape.com" Date: Thu, 14 Sep 2006 05:58:26 +0000 Subject: [PATCH] Bug 81712; new turbo-mode implementation, removes old stuff and replaces it with code that no longer holds a browser window open; r=syd, sr=blake, a=asa git-svn-id: svn://10.0.0.236/trunk@210810 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/suite/browser/navigator.js | 52 +++++++--------------- mozilla/suite/browser/navigator.xul | 2 +- mozilla/suite/browser/navigatorOverlay.xul | 2 +- 3 files changed, 17 insertions(+), 39 deletions(-) diff --git a/mozilla/suite/browser/navigator.js b/mozilla/suite/browser/navigator.js index 0863a895944..559468a52d5 100644 --- a/mozilla/suite/browser/navigator.js +++ b/mozilla/suite/browser/navigator.js @@ -278,6 +278,7 @@ function Startup() contentArea.addEventListener("load", loadEventHandlers, true); contentArea.addEventListener("focus", contentAreaFrameFocus, true); + var turboMode = false; // set default character set if provided if ("arguments" in window && window.arguments.length > 1 && window.arguments[1]) { if (window.arguments[1].indexOf("charset=") != -1) { @@ -286,6 +287,8 @@ function Startup() //we should "inherit" the charset menu setting in a new window appCore.setDefaultCharacterSet(arrayArgComponents[1]); //XXXjag see bug 67442 } + } else if (window.arguments[1].indexOf("turbo=yes") != -1) { + turboMode = true; } } @@ -314,7 +317,7 @@ function Startup() if (!isPageCycling) { var uriToLoad; - if (!appCore.cmdLineURLUsed) { + if (!appCore.cmdLineURLUsed && !turboMode) { var cmdLineService = Components.classes["@mozilla.org/appshell/commandLineService;1"] .getService(Components.interfaces.nsICmdLineService); uriToLoad = cmdLineService.URLToLoad; @@ -337,6 +340,17 @@ function Startup() loadURI(uriToLoad); } + // Close the window now, if it's for turbo mode startup. + if ( turboMode ) { + // Set "command line used" flag. If we don't do this, then when a cmd line url + // for a "real* invocation comes in, we will override it with the "cmd line url" + // from the turbo-mode process (i.e., the home page). + appCore.cmdLineURLUsed = true; + // For some reason, window.close() directly doesn't work, so do it in the future. + window.setTimeout( "window.close()", 100 ); + return; + } + // Focus the content area if the caller instructed us to. if ("arguments" in window && window.arguments.length >= 3 && window.arguments[2] == true) _content.focus(); @@ -364,42 +378,6 @@ function BrowserFlushBookmarksAndHistory() { } } -function BrowserCanClose() { - // Check for "server mode." - try { - var appShellSvc = Components.classes["@mozilla.org/appshell/appShellService;1"] - .getService(Components.interfaces.nsIAppShellService); - var nativeSupport = appShellSvc.nativeAppSupport; - if (nativeSupport && nativeSupport.isServerMode) { - // Give native app a chance to cache this window. - if (nativeSupport.cacheBrowserWindow(window)) { - // Window is "cached" so don't close it. - - // But flush bookmarks and history, as if we did close it. - BrowserFlushBookmarksAndHistory(); - - // Reset session history. - var webNav = getWebNavigation(); - if (webNav) { - try { - webNav.sessionHistory.PurgeHistory( webNav.sessionHistory.count ); - } catch(ex) { - } - } - - // Go to blank page. - loadURI( "about:blank" ); - - // This stops the close. - return false; - } - } - } catch (ex) { - } - // Ok to close window. - return true; -} - function Shutdown() { var browser = getBrowser(); diff --git a/mozilla/suite/browser/navigator.xul b/mozilla/suite/browser/navigator.xul index 68c2b087a6b..678838000c7 100644 --- a/mozilla/suite/browser/navigator.xul +++ b/mozilla/suite/browser/navigator.xul @@ -45,7 +45,7 @@ Contributor(s): ______________________________________. --> - +