Backed out changeset d2133d001fca (
bug 971697)
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -48,17 +48,16 @@
#include "nsEventDispatcher.h"
#include "nsISHistory.h"
#include "nsISHistoryInternal.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIXULWindow.h"
#include "nsIEditor.h"
#include "nsIMozBrowserFrame.h"
#include "nsIPermissionManager.h"
-#include "nsISHistory.h"
#include "nsLayoutUtils.h"
#include "nsView.h"
#include "nsAsyncDOMEvent.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
@@ -1669,28 +1668,16 @@ nsFrameLoader::MaybeCreateDocShell()
// but it must be called to make sure things are properly
// initialized.
if (NS_FAILED(base_win->Create()) || !win_private) {
// Do not call Destroy() here. See bug 472312.
NS_WARNING("Something wrong when creating the docshell for a frameloader!");
return NS_ERROR_FAILURE;
}
- if (mIsTopLevelContent &&
- mOwnerContent->IsXUL(nsGkAtoms::browser) &&
- !mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory)) {
- nsresult rv;
- nsCOMPtr<nsISHistory> sessionHistory =
- do_CreateInstance(NS_SHISTORY_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
- webNav->SetSessionHistory(sessionHistory);
- }
-
EnsureMessageManager();
if (OwnerIsAppFrame()) {
// You can't be both an app and a browser frame.
MOZ_ASSERT(!OwnerIsBrowserFrame());
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
MOZ_ASSERT(ownApp);
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -284,17 +284,16 @@ GK_ATOM(dfn, "dfn")
GK_ATOM(dialog, "dialog")
GK_ATOM(difference, "difference")
GK_ATOM(digit, "digit")
GK_ATOM(dir, "dir")
GK_ATOM(dirAutoSetBy, "dirAutoSetBy")
GK_ATOM(directionality, "directionality")
GK_ATOM(disableOutputEscaping, "disable-output-escaping")
GK_ATOM(disabled, "disabled")
-GK_ATOM(disablehistory, "disablehistory")
GK_ATOM(display, "display")
GK_ATOM(distinct, "distinct")
GK_ATOM(div, "div")
GK_ATOM(dl, "dl")
GK_ATOM(doctypePublic, "doctype-public")
GK_ATOM(doctypeSystem, "doctype-system")
GK_ATOM(document, "document")
GK_ATOM(download, "download")
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -743,25 +743,24 @@
<!-- This is managed by the tabbrowser -->
<field name="lastURI">null</field>
<field name="mDestroyed">false</field>
<constructor>
<![CDATA[
try {
- // At this point we expect |this.docShell| to always be non-null.
- // |webNavigation.sessionHistory| will have been set by the frame
- // loader when creating the docShell as long as this xul:browser
- // doesn't have the 'disablehistory' attribute set.
- if (this.webNavigation.sessionHistory) {
+ if (this.docShell && !this.hasAttribute("disablehistory")) {
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.addObserver(this, "browser:purge-session-history", false);
-
+ // wire up session history
+ this.webNavigation.sessionHistory =
+ Components.classes["@mozilla.org/browser/shistory;1"]
+ .createInstance(Components.interfaces.nsISHistory);
// enable global history if we weren't told otherwise
if (!this.hasAttribute("disableglobalhistory") && !this.isRemoteBrowser) {
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);
}
@@ -794,17 +793,17 @@
we are removed from a tabbrowser. This will be explicitly called by tabbrowser -->
<method name="destroy">
<body>
<![CDATA[
if (this.mDestroyed)
return;
this.mDestroyed = true;
- if (this.webNavigation.sessionHistory) {
+ if (!this.hasAttribute("disablehistory")) {
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
try {
os.removeObserver(this, "browser:purge-session-history");
} catch (ex) {
// It's not clear why this sometimes throws an exception.
}
}