Bug 923331 - Remove disablehistory attr from first browser tab (r=gavin)

This commit is contained in:
Bill McCloskey 2013-10-17 08:38:59 -07:00
parent 7502f19df7
commit 529cc8d35c
4 changed files with 10 additions and 25 deletions

View File

@ -778,27 +778,6 @@ var gBrowserInit = {
window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow =
new nsBrowserAccess(); new nsBrowserAccess();
// 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
gBrowser.webNavigation.sessionHistory = Cc["@mozilla.org/browser/shistory;1"].
createInstance(Ci.nsISHistory);
Services.obs.addObserver(gBrowser.browsers[0], "browser:purge-session-history", false);
// remove the disablehistory attribute so the browser cleans up, as
// though it had done this work itself
gBrowser.browsers[0].removeAttribute("disablehistory");
// enable global history
try {
if (!gMultiProcessBrowser)
gBrowser.docShell.useGlobalHistory = true;
} catch(ex) {
Cu.reportError("Places database may be locked: " + ex);
}
// hook up UI through progress listener // hook up UI through progress listener
gBrowser.addProgressListener(window.XULBrowserWindow); gBrowser.addProgressListener(window.XULBrowserWindow);
gBrowser.addTabsProgressListener(window.TabsProgressListener); gBrowser.addTabsProgressListener(window.TabsProgressListener);

View File

@ -1028,7 +1028,7 @@
<splitter id="sidebar-splitter" class="chromeclass-extrachrome sidebar-splitter" hidden="true"/> <splitter id="sidebar-splitter" class="chromeclass-extrachrome sidebar-splitter" hidden="true"/>
<vbox id="appcontent" flex="1"> <vbox id="appcontent" flex="1">
<tabbrowser id="content" disablehistory="true" <tabbrowser id="content"
flex="1" contenttooltip="aHTMLTooltip" flex="1" contenttooltip="aHTMLTooltip"
tabcontainer="tabbrowser-tabs" tabcontainer="tabbrowser-tabs"
contentcontextmenu="contentAreaContextMenu" contentcontextmenu="contentAreaContextMenu"

View File

@ -34,7 +34,7 @@
<xul:hbox flex="1" class="browserSidebarContainer"> <xul:hbox flex="1" class="browserSidebarContainer">
<xul:vbox flex="1" class="browserContainer"> <xul:vbox flex="1" class="browserContainer">
<xul:stack flex="1" class="browserStack" anonid="browserStack"> <xul:stack flex="1" class="browserStack" anonid="browserStack">
<xul:browser anonid="initialBrowser" type="content-primary" message="true" disablehistory="true" <xul:browser anonid="initialBrowser" type="content-primary" message="true"
xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,selectpopup"/> xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,selectpopup"/>
</xul:stack> </xul:stack>
</xul:vbox> </xul:vbox>

View File

@ -685,8 +685,14 @@
Components.classes["@mozilla.org/browser/shistory;1"] Components.classes["@mozilla.org/browser/shistory;1"]
.createInstance(Components.interfaces.nsISHistory); .createInstance(Components.interfaces.nsISHistory);
// enable global history if we weren't told otherwise // enable global history if we weren't told otherwise
if (!this.hasAttribute("disableglobalhistory")) if (!this.hasAttribute("disableglobalhistory") && !this.isRemoteBrowser) {
this.docShell.useGlobalHistory = true; try {
this.docShell.useGlobalHistory = true;
} catch(ex) {
// This can occur if the Places database is locked
Components.utils.reportError("Error enabling browser global history: " + ex);
}
}
} }
} }
catch (e) { catch (e) {