bug 513469 - remove usage of nsIBrowserInstance in Firefox's browser.js
r=gavin
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -69,17 +69,16 @@ Cu.import("resource://gre/modules/XPCOMU
const nsIWebNavigation = Ci.nsIWebNavigation;
var gCharsetMenu = null;
var gLastBrowserCharset = null;
var gPrevCharset = null;
var gProxyFavIcon = null;
var gLastValidURLStr = "";
var gProgressCollapseTimer = null;
-var appCore = null;
var gSidebarCommand = "";
var gInPrintPreviewMode = false;
let gDownloadMgr = null;
// Global variable that holds the nsContextMenu instance.
var gContextMenu = null;
var gChromeState = null; // chrome state before we went into print preview
@@ -916,20 +915,16 @@ function BrowserStartup() {
if ("arguments" in window && window.arguments[0])
uriToLoad = window.arguments[0];
var isLoadingBlank = uriToLoad == "about:blank";
var mustLoadSidebar = false;
prepareForStartup();
-#ifdef ENABLE_PAGE_CYCLER
- appCore.startPageCycler();
-#else
-# only load url passed in when we're not page cycling
if (uriToLoad && !isLoadingBlank) {
if (uriToLoad instanceof Ci.nsISupportsArray) {
let count = uriToLoad.Count();
let specs = [];
for (let i = 0; i < count; i++) {
let urisstring = uriToLoad.GetElementAt(i).QueryInterface(Ci.nsISupportsString);
specs.push(urisstring.data);
}
@@ -956,17 +951,16 @@ function BrowserStartup() {
window.arguments[4] || false);
content.focus();
}
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
// Such callers expect that window.arguments[0] is handled as a single URI.
else
loadOneOrMoreURIs(uriToLoad);
}
-#endif
if (window.opener && !window.opener.closed) {
let openerFindBar = window.opener.gFindBar;
if (openerFindBar && !openerFindBar.hidden &&
openerFindBar.findMode == gFindBar.FIND_NORMAL)
gFindBar.open();
let openerSidebarBox = window.opener.document.getElementById("sidebar-box");
@@ -1101,22 +1095,16 @@ function prepareForStartup() {
gBrowser.addEventListener("PluginBlocklisted", gMissingPluginInstaller.newMissingPlugin, true, true);
gBrowser.addEventListener("PluginDisabled", gMissingPluginInstaller.newDisabledPlugin, true, true);
gBrowser.addEventListener("NewPluginInstalled", gMissingPluginInstaller.refreshBrowser, false);
gBrowser.addEventListener("NewTab", BrowserOpenTab, false);
window.addEventListener("AppCommand", HandleAppCommandEvent, true);
var webNavigation;
try {
- // Create the browser instance component.
- appCore = Components.classes["@mozilla.org/appshell/component/browser/instance;1"]
- .createInstance(Components.interfaces.nsIBrowserInstance);
- if (!appCore)
- throw "couldn't create a browser instance";
-
webNavigation = getWebNavigation();
if (!webNavigation)
throw "no XBL binding for browser";
} catch (e) {
alert("Error launching browser window:" + e);
window.close(); // Give up.
return;
}
@@ -1139,19 +1127,16 @@ function prepareForStartup() {
var arrayArgComponents = window.arguments[1].split("=");
if (arrayArgComponents) {
//we should "inherit" the charset menu setting in a new window
getMarkupDocumentViewer().defaultCharacterSet = arrayArgComponents[1];
}
}
}
- // Initialize browser instance..
- appCore.setWebShellWindow(window);
-
// Manually hook up session and global history for the first browser
// so that we don't have to load global history before bringing up a
// window.
// Wire up session and global history before any possible
// progress notifications for back/forward button updating
webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"]
.createInstance(Components.interfaces.nsISHistory);
var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
@@ -1429,20 +1414,16 @@ function BrowserShutdown()
window.XULBrowserWindow = null;
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem).treeOwner
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIXULWindow)
.XULBrowserWindow = null;
window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = null;
-
- // Close the app core.
- if (appCore)
- appCore.close();
}
#ifdef XP_MACOSX
// nonBrowserWindowStartup(), nonBrowserWindowDelayedStartup(), and
// nonBrowserWindowShutdown() are used for non-browser windows in
// macBrowserOverlay
function nonBrowserWindowStartup()
{