Bug 1129795 - Convert rest of docshell/ to Gecko style. r=mccr8

This commit is contained in:
Birunthan Mohanathas 2015-05-06 10:57:23 -07:00
parent 746490cb68
commit 73dc47d4b2
27 changed files with 676 additions and 770 deletions

View File

@ -11,7 +11,8 @@ namespace mozilla {
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor) NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase) LoadContext::LoadContext(nsIPrincipal* aPrincipal,
nsILoadContext* aOptionalBase)
: mTopFrameElement(nullptr) : mTopFrameElement(nullptr)
, mNestedFrameId(0) , mNestedFrameId(0)
, mIsContent(true) , mIsContent(true)
@ -22,17 +23,18 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase
#endif #endif
{ {
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId))); MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED( MOZ_ALWAYS_TRUE(
aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement))); NS_SUCCEEDED(aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
if (!aOptionalBase) { if (!aOptionalBase) {
return; return;
} }
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent))); MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED( MOZ_ALWAYS_TRUE(
aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing))); NS_SUCCEEDED(aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs))); MOZ_ALWAYS_TRUE(
NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -53,7 +53,8 @@ public:
#ifdef DEBUG #ifdef DEBUG
, mIsNotNull(aToCopy.mIsNotNull) , mIsNotNull(aToCopy.mIsNotNull)
#endif #endif
{} {
}
// AppId/inBrowser arguments override those in SerializedLoadContext provided // AppId/inBrowser arguments override those in SerializedLoadContext provided
// by child process. // by child process.
@ -70,7 +71,8 @@ public:
#ifdef DEBUG #ifdef DEBUG
, mIsNotNull(aToCopy.mIsNotNull) , mIsNotNull(aToCopy.mIsNotNull)
#endif #endif
{} {
}
LoadContext(dom::Element* aTopFrameElement, LoadContext(dom::Element* aTopFrameElement,
uint32_t aAppId, uint32_t aAppId,
@ -88,7 +90,8 @@ public:
#ifdef DEBUG #ifdef DEBUG
, mIsNotNull(true) , mIsNotNull(true)
#endif #endif
{} {
}
// Constructor taking reserved appId for the safebrowsing cookie. // Constructor taking reserved appId for the safebrowsing cookie.
explicit LoadContext(uint32_t aAppId) explicit LoadContext(uint32_t aAppId)
@ -102,7 +105,8 @@ public:
#ifdef DEBUG #ifdef DEBUG
, mIsNotNull(true) , mIsNotNull(true)
#endif #endif
{} {
}
// Constructor for creating a LoadContext with a given principal's appId and // Constructor for creating a LoadContext with a given principal's appId and
// browser flag. // browser flag.
@ -127,4 +131,3 @@ private:
} // namespace mozilla } // namespace mozilla
#endif // LoadContext_h #endif // LoadContext_h

View File

@ -77,4 +77,3 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
} }
} // namespace IPC } // namespace IPC

View File

@ -72,11 +72,11 @@ struct ParamTraits<SerializedLoadContext>
static bool Read(const Message* aMsg, void** aIter, paramType* aResult) static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{ {
if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) || if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) ||
!ReadParam(aMsg, aIter, &aResult->mIsContent) || !ReadParam(aMsg, aIter, &aResult->mIsContent) ||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) || !ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
!ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) || !ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) ||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) || !ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
!ReadParam(aMsg, aIter, &aResult->mAppId) || !ReadParam(aMsg, aIter, &aResult->mAppId) ||
!ReadParam(aMsg, aIter, &aResult->mIsInBrowserElement)) { !ReadParam(aMsg, aIter, &aResult->mIsInBrowserElement)) {
return false; return false;
} }
@ -88,4 +88,3 @@ struct ParamTraits<SerializedLoadContext>
} // namespace IPC } // namespace IPC
#endif // SerializedLoadContext_h #endif // SerializedLoadContext_h

View File

@ -26,10 +26,6 @@
using namespace mozilla; using namespace mozilla;
//*****************************************************************************
//*** nsDSURIContentListener: Object Management
//*****************************************************************************
nsDSURIContentListener::nsDSURIContentListener(nsDocShell* aDocShell) nsDSURIContentListener::nsDSURIContentListener(nsDocShell* aDocShell)
: mDocShell(aDocShell) : mDocShell(aDocShell)
, mExistingJPEGRequest(nullptr) , mExistingJPEGRequest(nullptr)
@ -50,10 +46,6 @@ nsDSURIContentListener::Init()
return rv; return rv;
} }
//*****************************************************************************
// nsDSURIContentListener::nsISupports
//*****************************************************************************
NS_IMPL_ADDREF(nsDSURIContentListener) NS_IMPL_ADDREF(nsDSURIContentListener)
NS_IMPL_RELEASE(nsDSURIContentListener) NS_IMPL_RELEASE(nsDSURIContentListener)
@ -63,16 +55,11 @@ NS_INTERFACE_MAP_BEGIN(nsDSURIContentListener)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
//*****************************************************************************
// nsDSURIContentListener::nsIURIContentListener
//*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsDSURIContentListener::OnStartURIOpen(nsIURI* aURI, bool* aAbortOpen) nsDSURIContentListener::OnStartURIOpen(nsIURI* aURI, bool* aAbortOpen)
{ {
// If mDocShell is null here, that means someone's starting a load // If mDocShell is null here, that means someone's starting a load in our
// in our docshell after it's already been destroyed. Don't let // docshell after it's already been destroyed. Don't let that happen.
// that happen.
if (!mDocShell) { if (!mDocShell) {
*aAbortOpen = true; *aAbortOpen = true;
return NS_OK; return NS_OK;
@ -188,17 +175,16 @@ nsDSURIContentListener::IsPreferred(const char* aContentType,
aDesiredContentType, aDesiredContentType,
aCanHandle); aCanHandle);
} }
// we used to return false here if we didn't have a parent properly // we used to return false here if we didn't have a parent properly registered
// registered at the top of the docshell hierarchy to dictate what // at the top of the docshell hierarchy to dictate what content types this
// content types this docshell should be a preferred handler for. But // docshell should be a preferred handler for. But this really makes it hard
// this really makes it hard for developers using iframe or browser tags // for developers using iframe or browser tags because then they need to make
// because then they need to make sure they implement // sure they implement nsIURIContentListener otherwise all link clicks would
// nsIURIContentListener otherwise all link clicks would get sent to // get sent to another window because we said we weren't the preferred handler
// another window because we said we weren't the preferred handler type. // type. I'm going to change the default now... if we can handle the content,
// I'm going to change the default now...if we can handle the content, // and someone didn't EXPLICITLY set a nsIURIContentListener at the top of our
// and someone didn't EXPLICITLY set a nsIURIContentListener at the top // docshell chain, then we'll now always attempt to process the content
// of our docshell chain, then we'll now always attempt to process the // ourselves...
// content ourselves...
return CanHandleContent(aContentType, true, aDesiredContentType, aCanHandle); return CanHandleContent(aContentType, true, aDesiredContentType, aCanHandle);
} }

View File

@ -970,7 +970,8 @@ nsDefaultURIFixup::KeywordURIFixup(const nsACString& aURIString,
// If we're at the end of the string or this is the first slash, // If we're at the end of the string or this is the first slash,
// check if the thing before the slash looks like ipv4: // check if the thing before the slash looks like ipv4:
if ((iter.size_forward() == 1 || (lastSlashLoc == uint32_t(kNotFound) && *iter == '/')) && if ((iter.size_forward() == 1 ||
(lastSlashLoc == uint32_t(kNotFound) && *iter == '/')) &&
// Need 2 or 3 dots + only digits // Need 2 or 3 dots + only digits
(foundDots == 2 || foundDots == 3) && (foundDots == 2 || foundDots == 3) &&
// and they should be all that came before now: // and they should be all that came before now:

View File

@ -712,7 +712,8 @@ SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
nsPingListener* pingListener = nsPingListener* pingListener =
new nsPingListener(info->requireSameHost, aContent, loadGroup); new nsPingListener(info->requireSameHost, aContent, loadGroup);
nsCOMPtr<nsINetworkInterceptController> interceptController = do_QueryInterface(info->docShell); nsCOMPtr<nsINetworkInterceptController> interceptController =
do_QueryInterface(info->docShell);
pingListener->SetInterceptController(interceptController); pingListener->SetInterceptController(interceptController);
nsCOMPtr<nsIStreamListener> listener(pingListener); nsCOMPtr<nsIStreamListener> listener(pingListener);
@ -845,10 +846,6 @@ DecreasePrivateDocShellCount()
} }
} }
//*****************************************************************************
//*** nsDocShell: Object Management
//*****************************************************************************
static uint64_t gDocshellIDCounter = 0; static uint64_t gDocshellIDCounter = 0;
nsDocShell::nsDocShell() nsDocShell::nsDocShell()
@ -1032,10 +1029,6 @@ nsDocShell::DestroyChildren()
nsDocLoader::DestroyChildren(); nsDocLoader::DestroyChildren();
} }
//*****************************************************************************
// nsDocShell::nsISupports
//*****************************************************************************
NS_IMPL_ADDREF_INHERITED(nsDocShell, nsDocLoader) NS_IMPL_ADDREF_INHERITED(nsDocShell, nsDocLoader)
NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader) NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
@ -1061,9 +1054,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController) NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
NS_INTERFACE_MAP_END_INHERITING(nsDocLoader) NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
///*****************************************************************************
// nsDocShell::nsIInterfaceRequestor
//*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::GetInterface(const nsIID& aIID, void** aSink) nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
{ {
@ -1361,9 +1351,6 @@ nsDocShell::ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType)
return docShellLoadType; return docShellLoadType;
} }
//*****************************************************************************
// nsDocShell::nsIDocShell
//*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::LoadURI(nsIURI* aURI, nsDocShell::LoadURI(nsIURI* aURI,
nsIDocShellLoadInfo* aLoadInfo, nsIDocShellLoadInfo* aLoadInfo,
@ -2610,14 +2597,16 @@ nsDocShell::SetAllowContentRetargeting(bool aAllowContentRetargeting)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::GetAllowContentRetargetingOnChildren(bool* aAllowContentRetargetingOnChildren) nsDocShell::GetAllowContentRetargetingOnChildren(
bool* aAllowContentRetargetingOnChildren)
{ {
*aAllowContentRetargetingOnChildren = mAllowContentRetargetingOnChildren; *aAllowContentRetargetingOnChildren = mAllowContentRetargetingOnChildren;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::SetAllowContentRetargetingOnChildren(bool aAllowContentRetargetingOnChildren) nsDocShell::SetAllowContentRetargetingOnChildren(
bool aAllowContentRetargetingOnChildren)
{ {
mAllowContentRetargetingOnChildren = aAllowContentRetargetingOnChildren; mAllowContentRetargetingOnChildren = aAllowContentRetargetingOnChildren;
return NS_OK; return NS_OK;
@ -3489,7 +3478,8 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) { if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
SetAllowWindowControl(value); SetAllowWindowControl(value);
} }
SetAllowContentRetargeting(parentAsDocShell->GetAllowContentRetargetingOnChildren()); SetAllowContentRetargeting(
parentAsDocShell->GetAllowContentRetargetingOnChildren());
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) { if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) {
SetIsActive(value); SetIsActive(value);
} }
@ -5611,6 +5601,7 @@ nsDocShell::GetSessionHistory(nsISHistory** aSessionHistory)
//***************************************************************************** //*****************************************************************************
// nsDocShell::nsIWebPageDescriptor // nsDocShell::nsIWebPageDescriptor
//***************************************************************************** //*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::LoadPage(nsISupports* aPageDescriptor, uint32_t aDisplayType) nsDocShell::LoadPage(nsISupports* aPageDescriptor, uint32_t aDisplayType)
{ {
@ -7174,7 +7165,7 @@ nsDocShell::RefreshURIFromQueue()
timer->InitWithCallback(refreshInfo, delay, nsITimer::TYPE_ONE_SHOT); timer->InitWithCallback(refreshInfo, delay, nsITimer::TYPE_ONE_SHOT);
} }
} }
} // while }
return NS_OK; return NS_OK;
} }
@ -7821,20 +7812,19 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED) && aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED) &&
(isTopFrame || UseErrorPages())) { (isTopFrame || UseErrorPages())) {
DisplayLoadError(aStatus, url, nullptr, aChannel); DisplayLoadError(aStatus, url, nullptr, aChannel);
} } else if (aStatus == NS_ERROR_NET_TIMEOUT ||
else if (aStatus == NS_ERROR_NET_TIMEOUT || aStatus == NS_ERROR_REDIRECT_LOOP ||
aStatus == NS_ERROR_REDIRECT_LOOP || aStatus == NS_ERROR_UNKNOWN_SOCKET_TYPE ||
aStatus == NS_ERROR_UNKNOWN_SOCKET_TYPE || aStatus == NS_ERROR_NET_INTERRUPT ||
aStatus == NS_ERROR_NET_INTERRUPT || aStatus == NS_ERROR_NET_RESET ||
aStatus == NS_ERROR_NET_RESET || aStatus == NS_ERROR_OFFLINE ||
aStatus == NS_ERROR_OFFLINE || aStatus == NS_ERROR_MALWARE_URI ||
aStatus == NS_ERROR_MALWARE_URI || aStatus == NS_ERROR_PHISHING_URI ||
aStatus == NS_ERROR_PHISHING_URI || aStatus == NS_ERROR_UNWANTED_URI ||
aStatus == NS_ERROR_UNWANTED_URI || aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE ||
aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE || aStatus == NS_ERROR_REMOTE_XUL ||
aStatus == NS_ERROR_REMOTE_XUL || aStatus == NS_ERROR_OFFLINE ||
aStatus == NS_ERROR_OFFLINE || NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
// Errors to be shown for any frame // Errors to be shown for any frame
DisplayLoadError(aStatus, url, nullptr, aChannel); DisplayLoadError(aStatus, url, nullptr, aChannel);
} else if (aStatus == NS_ERROR_DOCUMENT_NOT_CACHED) { } else if (aStatus == NS_ERROR_DOCUMENT_NOT_CACHED) {
@ -7846,8 +7836,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
} }
DisplayLoadError(aStatus, url, nullptr, aChannel); DisplayLoadError(aStatus, url, nullptr, aChannel);
} }
} } else if (url && NS_SUCCEEDED(aStatus)) {
else if (url && NS_SUCCEEDED(aStatus)) {
// If we have a host // If we have a host
mozilla::net::PredictorLearnRedirect(url, aChannel, this); mozilla::net::PredictorLearnRedirect(url, aChannel, this);
} }
@ -8001,9 +7990,9 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
blankDoc->SetSandboxFlags(mSandboxFlags); blankDoc->SetSandboxFlags(mSandboxFlags);
// create a content viewer for us and the new document // create a content viewer for us and the new document
docFactory->CreateInstanceForDocument(NS_ISUPPORTS_CAST(nsIDocShell*, this), docFactory->CreateInstanceForDocument(
blankDoc, "view", NS_ISUPPORTS_CAST(nsIDocShell*, this), blankDoc, "view",
getter_AddRefs(viewer)); getter_AddRefs(viewer));
// hook 'em up // hook 'em up
if (viewer) { if (viewer) {
@ -8405,8 +8394,8 @@ class MOZ_STACK_CLASS PresentationEventForgetter
{ {
public: public:
explicit PresentationEventForgetter( explicit PresentationEventForgetter(
nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>& nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>&
aRestorePresentationEvent) aRestorePresentationEvent)
: mRestorePresentationEvent(aRestorePresentationEvent) : mRestorePresentationEvent(aRestorePresentationEvent)
, mEvent(aRestorePresentationEvent.get()) , mEvent(aRestorePresentationEvent.get())
{ {
@ -8785,7 +8774,8 @@ nsDocShell::RestoreFromHistory()
childShell->GetAllowDNSPrefetch(&allowDNSPrefetch); childShell->GetAllowDNSPrefetch(&allowDNSPrefetch);
bool allowContentRetargeting = childShell->GetAllowContentRetargeting(); bool allowContentRetargeting = childShell->GetAllowContentRetargeting();
bool allowContentRetargetingOnChildren = childShell->GetAllowContentRetargetingOnChildren(); bool allowContentRetargetingOnChildren =
childShell->GetAllowContentRetargetingOnChildren();
uint32_t defaultLoadFlags; uint32_t defaultLoadFlags;
childShell->GetDefaultLoadFlags(&defaultLoadFlags); childShell->GetDefaultLoadFlags(&defaultLoadFlags);
@ -8804,7 +8794,8 @@ nsDocShell::RestoreFromHistory()
childShell->SetAllowMedia(allowMedia); childShell->SetAllowMedia(allowMedia);
childShell->SetAllowDNSPrefetch(allowDNSPrefetch); childShell->SetAllowDNSPrefetch(allowDNSPrefetch);
childShell->SetAllowContentRetargeting(allowContentRetargeting); childShell->SetAllowContentRetargeting(allowContentRetargeting);
childShell->SetAllowContentRetargetingOnChildren(allowContentRetargetingOnChildren); childShell->SetAllowContentRetargetingOnChildren(
allowContentRetargetingOnChildren);
childShell->SetDefaultLoadFlags(defaultLoadFlags); childShell->SetDefaultLoadFlags(defaultLoadFlags);
rv = childShell->BeginRestore(nullptr, false); rv = childShell->BeginRestore(nullptr, false);
@ -9085,8 +9076,9 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
aOpenedChannel->SetLoadFlags(loadFlags); aOpenedChannel->SetLoadFlags(loadFlags);
mLoadGroup->AddRequest(aRequest, nullptr); mLoadGroup->AddRequest(aRequest, nullptr);
if (currentLoadGroup) if (currentLoadGroup) {
currentLoadGroup->RemoveRequest(aRequest, nullptr, NS_BINDING_RETARGETED); currentLoadGroup->RemoveRequest(aRequest, nullptr, NS_BINDING_RETARGETED);
}
// Update the notification callbacks, so that progress and // Update the notification callbacks, so that progress and
// status information are sent to the right docshell... // status information are sent to the right docshell...
@ -9405,6 +9397,7 @@ nsDocShell::CheckLoadingPermissions()
//***************************************************************************** //*****************************************************************************
// nsDocShell: Site Loading // nsDocShell: Site Loading
//***************************************************************************** //*****************************************************************************
namespace { namespace {
#ifdef MOZ_PLACES #ifdef MOZ_PLACES
@ -9515,7 +9508,8 @@ public:
} }
} }
NS_IMETHOD Run() NS_IMETHOD
Run()
{ {
return mDocShell->InternalLoad(mURI, mReferrer, return mDocShell->InternalLoad(mURI, mReferrer,
mReferrerPolicy, mReferrerPolicy,
@ -11222,7 +11216,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
updateSHistory = false; updateSHistory = false;
updateGHistory = false; // XXX Why global history too? updateGHistory = false; // XXX Why global history too?
} }
} // rootSH }
// Check if the url to be loaded is the same as the one already loaded. // Check if the url to be loaded is the same as the one already loaded.
if (mCurrentURI) { if (mCurrentURI) {
@ -11823,9 +11817,9 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
nsCOMPtr<nsISHEntry> child; nsCOMPtr<nsISHEntry> child;
shContainer->GetChildAt(i, getter_AddRefs(child)); shContainer->GetChildAt(i, getter_AddRefs(child));
shContainer->RemoveChild(child); shContainer->RemoveChild(child);
} // for }
entry->AbandonBFCacheEntry(); entry->AbandonBFCacheEntry();
} // shContainer }
} }
// Create a new entry if necessary. // Create a new entry if necessary.
@ -12166,7 +12160,8 @@ nsDocShell::WalkHistoryEntries(nsISHEntry* aRootEntry,
if (aRootShell) { if (aRootShell) {
// Walk the children of aRootShell and see if one of them // Walk the children of aRootShell and see if one of them
// has srcChild as a SHEntry. // has srcChild as a SHEntry.
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(aRootShell->mChildList); nsTObserverArray<nsDocLoader*>::ForwardIterator iter(
aRootShell->mChildList);
while (iter.HasMore()) { while (iter.HasMore()) {
nsDocShell* child = static_cast<nsDocShell*>(iter.GetNext()); nsDocShell* child = static_cast<nsDocShell*>(iter.GetNext());
@ -12939,10 +12934,6 @@ nsDocShell::SetLayoutHistoryState(nsILayoutHistoryState* aLayoutHistoryState)
return NS_OK; return NS_OK;
} }
//*****************************************************************************
//*** nsRefreshTimer: Object Management
//*****************************************************************************
nsRefreshTimer::nsRefreshTimer() nsRefreshTimer::nsRefreshTimer()
: mDelay(0), mRepeat(false), mMetaRefresh(false) : mDelay(0), mRepeat(false), mMetaRefresh(false)
{ {
@ -12952,10 +12943,6 @@ nsRefreshTimer::~nsRefreshTimer()
{ {
} }
//*****************************************************************************
// nsRefreshTimer::nsISupports
//*****************************************************************************
NS_IMPL_ADDREF(nsRefreshTimer) NS_IMPL_ADDREF(nsRefreshTimer)
NS_IMPL_RELEASE(nsRefreshTimer) NS_IMPL_RELEASE(nsRefreshTimer)
@ -12964,9 +12951,6 @@ NS_INTERFACE_MAP_BEGIN(nsRefreshTimer)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback) NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_END_THREADSAFE NS_INTERFACE_MAP_END_THREADSAFE
///*****************************************************************************
// nsRefreshTimer::nsITimerCallback
//******************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsRefreshTimer::Notify(nsITimer* aTimer) nsRefreshTimer::Notify(nsITimer* aTimer)
{ {
@ -12981,9 +12965,6 @@ nsRefreshTimer::Notify(nsITimer* aTimer)
return NS_OK; return NS_OK;
} }
//*****************************************************************************
// nsDocShell::InterfaceRequestorProxy
//*****************************************************************************
nsDocShell::InterfaceRequestorProxy::InterfaceRequestorProxy( nsDocShell::InterfaceRequestorProxy::InterfaceRequestorProxy(
nsIInterfaceRequestor* aRequestor) nsIInterfaceRequestor* aRequestor)
{ {
@ -13022,8 +13003,9 @@ nsDocShell::SetBaseUrlForWyciwyg(nsIContentViewer* aContentViewer)
nsCOMPtr<nsIURI> baseURI; nsCOMPtr<nsIURI> baseURI;
nsresult rv = NS_ERROR_NOT_AVAILABLE; nsresult rv = NS_ERROR_NOT_AVAILABLE;
if (sURIFixup) if (sURIFixup) {
rv = sURIFixup->CreateExposableURI(mCurrentURI, getter_AddRefs(baseURI)); rv = sURIFixup->CreateExposableURI(mCurrentURI, getter_AddRefs(baseURI));
}
// Get the current document and set the base uri // Get the current document and set the base uri
if (baseURI) { if (baseURI) {
@ -13069,6 +13051,7 @@ nsDocShell::GetAuthPrompt(uint32_t aPromptReason, const nsIID& aIID,
//***************************************************************************** //*****************************************************************************
// nsDocShell::nsILoadContext // nsDocShell::nsILoadContext
//***************************************************************************** //*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow) nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow)
{ {
@ -13321,8 +13304,6 @@ nsDocShell::SelectNone(void)
return DoCommand("cmd_selectNone"); return DoCommand("cmd_selectNone");
} }
//----------------------------------------------------------------------
// link handling // link handling
class OnLinkClickEvent : public nsRunnable class OnLinkClickEvent : public nsRunnable
@ -13382,8 +13363,6 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
{ {
} }
//----------------------------------------
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::OnLinkClick(nsIContent* aContent, nsDocShell::OnLinkClick(nsIContent* aContent,
nsIURI* aURI, nsIURI* aURI,
@ -13934,7 +13913,6 @@ nsDocShell::GetURLSearchParams()
class JavascriptTimelineMarker : public TimelineMarker class JavascriptTimelineMarker : public TimelineMarker
{ {
public: public:
JavascriptTimelineMarker(nsDocShell* aDocShell, const char* aName, JavascriptTimelineMarker(nsDocShell* aDocShell, const char* aName,
const char* aReason) const char* aReason)
: TimelineMarker(aDocShell, aName, TRACING_INTERVAL_START, : TimelineMarker(aDocShell, aName, TRACING_INTERVAL_START,
@ -13949,7 +13927,7 @@ public:
}; };
void void
nsDocShell::NotifyJSRunToCompletionStart(const char *aReason) nsDocShell::NotifyJSRunToCompletionStart(const char* aReason)
{ {
bool timelineOn = nsIDocShell::GetRecordProfileTimelineMarkers(); bool timelineOn = nsIDocShell::GetRecordProfileTimelineMarkers();
@ -14009,7 +13987,8 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aShouldIntercept) nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
bool* aShouldIntercept)
{ {
*aShouldIntercept = false; *aShouldIntercept = false;
if (mSandboxFlags) { if (mSandboxFlags) {
@ -14017,7 +13996,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aSho
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager(); nsCOMPtr<nsIServiceWorkerManager> swm = services::GetServiceWorkerManager();
if (!swm) { if (!swm) {
return NS_OK; return NS_OK;
} }
@ -14037,7 +14016,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aSho
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel) nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel)
{ {
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager(); nsCOMPtr<nsIServiceWorkerManager> swm = services::GetServiceWorkerManager();
if (!swm) { if (!swm) {
aChannel->Cancel(); aChannel->Cancel();
return NS_OK; return NS_OK;

View File

@ -89,9 +89,6 @@ class nsIURILoader;
class nsIWebBrowserFind; class nsIWebBrowserFind;
class nsIWidget; class nsIWidget;
/* load commands were moved to nsIDocShell.h */
/* load types were moved to nsDocShellLoadTypes.h */
/* internally used ViewMode types */ /* internally used ViewMode types */
enum ViewMode enum ViewMode
{ {
@ -99,10 +96,6 @@ enum ViewMode
viewSource = 0x1 viewSource = 0x1
}; };
//*****************************************************************************
//*** nsRefreshTimer
//*****************************************************************************
class nsRefreshTimer : public nsITimerCallback class nsRefreshTimer : public nsITimerCallback
{ {
public: public:
@ -130,10 +123,6 @@ enum eCharsetReloadState
eCharsetReloadStopOrigional eCharsetReloadStopOrigional
}; };
//*****************************************************************************
//*** nsDocShell
//*****************************************************************************
class nsDocShell final class nsDocShell final
: public nsDocLoader : public nsDocLoader
, public nsIDocShell , public nsIDocShell
@ -159,7 +148,7 @@ class nsDocShell final
public: public:
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsDocShell) MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsDocShell)
// Object Management
nsDocShell(); nsDocShell();
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
@ -186,7 +175,8 @@ public:
NS_DECL_NSINETWORKINTERCEPTCONTROLLER NS_DECL_NSINETWORKINTERCEPTCONTROLLER
NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager()) NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager())
NS_IMETHOD Stop() override { NS_IMETHOD Stop() override
{
// Need this here because otherwise nsIWebNavigation::Stop // Need this here because otherwise nsIWebNavigation::Stop
// overrides the docloader's Stop() // overrides the docloader's Stop()
return nsDocLoader::Stop(); return nsDocLoader::Stop();
@ -219,7 +209,7 @@ public:
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType); nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType);
uint32_t ConvertDocShellLoadInfoToLoadType( uint32_t ConvertDocShellLoadInfoToLoadType(
nsDocShellInfoLoadType aDocShellLoadType); nsDocShellInfoLoadType aDocShellLoadType);
// Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods // Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods
// are shared with nsIDocShell (appID, etc.) and can't be declared twice. // are shared with nsIDocShell (appID, etc.) and can't be declared twice.
@ -237,10 +227,10 @@ public:
// Restores a cached presentation from history (mLSHE). // Restores a cached presentation from history (mLSHE).
// This method swaps out the content viewer and simulates loads for // This method swaps out the content viewer and simulates loads for
// subframes. It then simulates the completion of the toplevel load. // subframes. It then simulates the completion of the toplevel load.
nsresult RestoreFromHistory(); nsresult RestoreFromHistory();
// Perform a URI load from a refresh timer. This is just like the // Perform a URI load from a refresh timer. This is just like the
// ForceRefreshURI method on nsIRefreshURI, but makes sure to take // ForceRefreshURI method on nsIRefreshURI, but makes sure to take
// the timer involved out of mRefreshURIList if it's there. // the timer involved out of mRefreshURIList if it's there.
// aTimer must not be null. // aTimer must not be null.
@ -269,8 +259,7 @@ public:
// Add new profile timeline markers to this docShell. This will only add // Add new profile timeline markers to this docShell. This will only add
// markers if the docShell is currently recording profile timeline markers. // markers if the docShell is currently recording profile timeline markers.
// See nsIDocShell::recordProfileTimelineMarkers // See nsIDocShell::recordProfileTimelineMarkers
void AddProfileTimelineMarker(const char* aName, void AddProfileTimelineMarker(const char* aName, TracingMetadata aMetaData);
TracingMetadata aMetaData);
void AddProfileTimelineMarker(mozilla::UniquePtr<TimelineMarker>&& aMarker); void AddProfileTimelineMarker(mozilla::UniquePtr<TimelineMarker>&& aMarker);
// Global counter for how many docShells are currently recording profile // Global counter for how many docShells are currently recording profile
@ -283,13 +272,12 @@ public:
bool aInPrivateBrowsing); bool aInPrivateBrowsing);
protected: protected:
// Object Management
virtual ~nsDocShell(); virtual ~nsDocShell();
virtual void DestroyChildren() override; virtual void DestroyChildren() override;
// Content Viewer Management // Content Viewer Management
nsresult EnsureContentViewer(); nsresult EnsureContentViewer();
// aPrincipal can be passed in if the caller wants. If null is // aPrincipal can be passed in if the caller wants. If null is
// passed in, the about:blank principal will end up being used. // passed in, the about:blank principal will end up being used.
nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal, nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
nsIURI* aBaseURI, nsIURI* aBaseURI,
@ -307,16 +295,16 @@ protected:
nsresult GetEldestPresContext(nsPresContext** aPresContext); nsresult GetEldestPresContext(nsPresContext** aPresContext);
// Get the principal that we'll set on the channel if we're inheriting. If // Get the principal that we'll set on the channel if we're inheriting. If
// aConsiderCurrentDocument is true, we try to use the current document if // aConsiderCurrentDocument is true, we try to use the current document if
// at all possible. If that fails, we fall back on the parent document. // at all possible. If that fails, we fall back on the parent document.
// If that fails too, we force creation of a content viewer and use the // If that fails too, we force creation of a content viewer and use the
// resulting principal. If aConsiderCurrentDocument is false, we just look // resulting principal. If aConsiderCurrentDocument is false, we just look
// at the parent. // at the parent.
nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument); nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument);
// Actually open a channel and perform a URI load. Note: whatever owner is // Actually open a channel and perform a URI load. Note: whatever owner is
// passed to this function will be set on the channel. Callers who wish to // passed to this function will be set on the channel. Callers who wish to
// not have an owner on the channel should just pass null. // not have an owner on the channel should just pass null.
// If aSrcdoc is not void, the load will be considered as a srcdoc load, // If aSrcdoc is not void, the load will be considered as a srcdoc load,
// and the contents of aSrcdoc will be loaded instead of aURI. // and the contents of aSrcdoc will be loaded instead of aURI.
@ -361,7 +349,7 @@ protected:
// In this case it is the caller's responsibility to ensure // In this case it is the caller's responsibility to ensure
// FireOnLocationChange is called. // FireOnLocationChange is called.
// In all other cases false is returned. // In all other cases false is returned.
// Either aChannel or aOwner must be null. If aChannel is // Either aChannel or aOwner must be null. If aChannel is
// present, the owner should be gotten from it. // present, the owner should be gotten from it.
// If OnNewURI calls AddToSessionHistory, it will pass its // If OnNewURI calls AddToSessionHistory, it will pass its
// aCloneSHChildren argument as aCloneChildren. // aCloneSHChildren argument as aCloneChildren.
@ -376,10 +364,10 @@ protected:
// Session History // Session History
bool ShouldAddToSessionHistory(nsIURI* aURI); bool ShouldAddToSessionHistory(nsIURI* aURI);
// Either aChannel or aOwner must be null. If aChannel is // Either aChannel or aOwner must be null. If aChannel is
// present, the owner should be gotten from it. // present, the owner should be gotten from it.
// If aCloneChildren is true, then our current session history's // If aCloneChildren is true, then our current session history's
// children will be cloned onto the new entry. This should be // children will be cloned onto the new entry. This should be
// used when we aren't actually changing the document while adding // used when we aren't actually changing the document while adding
// the new session history entry. // the new session history entry.
nsresult AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel, nsresult AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
@ -399,7 +387,7 @@ protected:
// Clone a session history tree for subframe navigation. // Clone a session history tree for subframe navigation.
// The tree rooted at |aSrcEntry| will be cloned into |aDestEntry|, except // The tree rooted at |aSrcEntry| will be cloned into |aDestEntry|, except
// for the entry with id |aCloneID|, which will be replaced with // for the entry with id |aCloneID|, which will be replaced with
// |aReplaceEntry|. |aSrcShell| is a (possibly null) docshell which // |aReplaceEntry|. |aSrcShell| is a (possibly null) docshell which
// corresponds to |aSrcEntry| via its mLSHE or mOHE pointers, and will // corresponds to |aSrcEntry| via its mLSHE or mOHE pointers, and will
// have that pointer updated to point to the cloned history entry. // have that pointer updated to point to the cloned history entry.
// If aCloneChildren is true then the children of the entry with id // If aCloneChildren is true then the children of the entry with id
@ -430,7 +418,7 @@ protected:
void SwapHistoryEntries(nsISHEntry* aOldEntry, nsISHEntry* aNewEntry); void SwapHistoryEntries(nsISHEntry* aOldEntry, nsISHEntry* aNewEntry);
// Call this method to swap in a new history entry to m[OL]SHE, rather than // Call this method to swap in a new history entry to m[OL]SHE, rather than
// setting it directly. This completes the navigation in all docshells // setting it directly. This completes the navigation in all docshells
// in the case of a subframe navigation. // in the case of a subframe navigation.
void SetHistoryEntry(nsCOMPtr<nsISHEntry>* aPtr, nsISHEntry* aEntry); void SetHistoryEntry(nsCOMPtr<nsISHEntry>* aPtr, nsISHEntry* aEntry);
@ -448,7 +436,7 @@ protected:
void* aData); void* aData);
// For each child of aRootEntry, find the corresponding docshell which is // For each child of aRootEntry, find the corresponding docshell which is
// a child of aRootShell, and call aCallback. The opaque pointer aData // a child of aRootShell, and call aCallback. The opaque pointer aData
// is passed to the callback. // is passed to the callback.
static nsresult WalkHistoryEntries(nsISHEntry* aRootEntry, static nsresult WalkHistoryEntries(nsISHEntry* aRootEntry,
nsDocShell* aRootShell, nsDocShell* aRootShell,
@ -477,7 +465,7 @@ protected:
* channel. * channel.
* *
* This method first checks the channel's property bag to see if previous * This method first checks the channel's property bag to see if previous
* info has been saved. If not, it gives back the referrer of the channel. * info has been saved. If not, it gives back the referrer of the channel.
* *
* @param aChannel * @param aChannel
* The channel we are transitioning to * The channel we are transitioning to
@ -506,7 +494,7 @@ protected:
uint32_t aChannelRedirectFlags); uint32_t aChannelRedirectFlags);
/** /**
* Helper function for adding a URI visit using IHistory. If IHistory is * Helper function for adding a URI visit using IHistory. If IHistory is
* not available, the method tries nsIGlobalHistory2. * not available, the method tries nsIGlobalHistory2.
* *
* The IHistory API maintains chains of visits, tracking both HTTP referrers * The IHistory API maintains chains of visits, tracking both HTTP referrers
@ -514,7 +502,7 @@ protected:
* the previous URI in the chain. * the previous URI in the chain.
* *
* Visits can be saved either during a redirect or when the request has * Visits can be saved either during a redirect or when the request has
* reached its final destination. The previous URI in the visit may be * reached its final destination. The previous URI in the visit may be
* from another redirect or it may be the referrer. * from another redirect or it may be the referrer.
* *
* @pre aURI is not null. * @pre aURI is not null.
@ -583,13 +571,13 @@ protected:
nsresult aResult); nsresult aResult);
// Sets the current document's current state object to the given SHEntry's // Sets the current document's current state object to the given SHEntry's
// state object. The current state object is eventually given to the page // state object. The current state object is eventually given to the page
// in the PopState event. // in the PopState event.
nsresult SetDocCurrentStateObj(nsISHEntry* aShEntry); nsresult SetDocCurrentStateObj(nsISHEntry* aShEntry);
nsresult CheckLoadingPermissions(); nsresult CheckLoadingPermissions();
// Security checks to prevent frameset spoofing. See comments at // Security checks to prevent frameset spoofing. See comments at
// implementation sites. // implementation sites.
static bool CanAccessItem(nsIDocShellTreeItem* aTargetItem, static bool CanAccessItem(nsIDocShellTreeItem* aTargetItem,
nsIDocShellTreeItem* aAccessingItem, nsIDocShellTreeItem* aAccessingItem,
@ -610,33 +598,33 @@ protected:
// in session history. // in session history.
// mContentViewer points to the current content viewer associated with // mContentViewer points to the current content viewer associated with
// this docshell. When loading a new document, the content viewer is // this docshell. When loading a new document, the content viewer is
// either destroyed or stored into a session history entry. To make sure // either destroyed or stored into a session history entry. To make sure
// that destruction happens in a controlled fashion, a given content viewer // that destruction happens in a controlled fashion, a given content viewer
// is always owned in exactly one of these ways: // is always owned in exactly one of these ways:
// 1) The content viewer is active and owned by a docshell's // 1) The content viewer is active and owned by a docshell's
// mContentViewer. // mContentViewer.
// 2) The content viewer is still being displayed while we begin loading // 2) The content viewer is still being displayed while we begin loading
// a new document. The content viewer is owned by the _new_ // a new document. The content viewer is owned by the _new_
// content viewer's mPreviousViewer, and has a pointer to the // content viewer's mPreviousViewer, and has a pointer to the
// nsISHEntry where it will eventually be stored. The content viewer // nsISHEntry where it will eventually be stored. The content viewer
// has been close()d by the docshell, which detaches the document from // has been close()d by the docshell, which detaches the document from
// the window object. // the window object.
// 3) The content viewer is cached in session history. The nsISHEntry // 3) The content viewer is cached in session history. The nsISHEntry
// has the only owning reference to the content viewer. The viewer // has the only owning reference to the content viewer. The viewer
// has released its nsISHEntry pointer to prevent circular ownership. // has released its nsISHEntry pointer to prevent circular ownership.
// //
// When restoring a content viewer from session history, open() is called // When restoring a content viewer from session history, open() is called
// to reattach the document to the window object. The content viewer is // to reattach the document to the window object. The content viewer is
// then placed into mContentViewer and removed from the history entry. // then placed into mContentViewer and removed from the history entry.
// (mContentViewer is put into session history as described above, if // (mContentViewer is put into session history as described above, if
// applicable). // applicable).
// Determines whether we can safely cache the current mContentViewer in // Determines whether we can safely cache the current mContentViewer in
// session history. This checks a number of factors such as cache policy, // session history. This checks a number of factors such as cache policy,
// pending requests, and unload handlers. // pending requests, and unload handlers.
// |aLoadType| should be the load type that will replace the current // |aLoadType| should be the load type that will replace the current
// presentation. |aNewRequest| should be the request for the document to // presentation. |aNewRequest| should be the request for the document to
// be loaded in place of the current document, or null if such a request // be loaded in place of the current document, or null if such a request
// has not been created yet. |aNewDocument| should be the document that will // has not been created yet. |aNewDocument| should be the document that will
// replace the current document. // replace the current document.
@ -662,7 +650,7 @@ protected:
int32_t* aHeight); int32_t* aHeight);
// Call this when a URI load is handed to us (via OnLinkClick or // Call this when a URI load is handed to us (via OnLinkClick or
// InternalLoad). This makes sure that we're not inside unload, or that if // InternalLoad). This makes sure that we're not inside unload, or that if
// we are it's still OK to load this URI. // we are it's still OK to load this URI.
bool IsOKToLoadURI(nsIURI* aURI); bool IsOKToLoadURI(nsIURI* aURI);
@ -680,7 +668,7 @@ protected:
bool ShouldBlockLoadingForBackButton(); bool ShouldBlockLoadingForBackButton();
// Convenience method for getting our parent docshell. Can return null // Convenience method for getting our parent docshell. Can return null
already_AddRefed<nsDocShell> GetParentDocshell(); already_AddRefed<nsDocShell> GetParentDocshell();
// Check if we have an app redirect registered for the URI and redirect if // Check if we have an app redirect registered for the URI and redirect if
@ -788,7 +776,7 @@ protected:
nsCOMPtr<nsISHEntry> mLSHE; nsCOMPtr<nsISHEntry> mLSHE;
// Holds a weak pointer to a RestorePresentationEvent object if any that // Holds a weak pointer to a RestorePresentationEvent object if any that
// holds a weak pointer back to us. We use this pointer to possibly revoke // holds a weak pointer back to us. We use this pointer to possibly revoke
// the event whenever necessary. // the event whenever necessary.
nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent; nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
@ -801,9 +789,9 @@ protected:
// Secure browser UI object // Secure browser UI object
nsCOMPtr<nsISecureBrowserUI> mSecurityUI; nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
// The URI we're currently loading. This is only relevant during the // The URI we're currently loading. This is only relevant during the
// firing of a pagehide/unload. The caller of FirePageHideNotification() // firing of a pagehide/unload. The caller of FirePageHideNotification()
// is responsible for setting it and unsetting it. It may be null if the // is responsible for setting it and unsetting it. It may be null if the
// pagehide/unload is happening for some reason other than just loading a // pagehide/unload is happening for some reason other than just loading a
// new URI. // new URI.
nsCOMPtr<nsIURI> mLoadingURI; nsCOMPtr<nsIURI> mLoadingURI;
@ -824,11 +812,11 @@ protected:
nsCOMPtr<nsIChannel> mMixedContentChannel; nsCOMPtr<nsIChannel> mMixedContentChannel;
// WEAK REFERENCES BELOW HERE. // WEAK REFERENCES BELOW HERE.
// Note these are intentionally not addrefd. Doing so will create a cycle. // Note these are intentionally not addrefd. Doing so will create a cycle.
// For that reasons don't use nsCOMPtr. // For that reasons don't use nsCOMPtr.
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
mozilla::dom::EventTarget* mChromeEventHandler; //Weak Reference mozilla::dom::EventTarget* mChromeEventHandler; // Weak Reference
eCharsetReloadState mCharsetReloadState; eCharsetReloadState mCharsetReloadState;
@ -842,7 +830,7 @@ protected:
int32_t mMarginWidth; int32_t mMarginWidth;
int32_t mMarginHeight; int32_t mMarginHeight;
// This can either be a content docshell or a chrome docshell. After // This can either be a content docshell or a chrome docshell. After
// Create() is called, the type is not expected to change. // Create() is called, the type is not expected to change.
int32_t mItemType; int32_t mItemType;
@ -910,7 +898,7 @@ protected:
void RecomputeCanExecuteScripts(); void RecomputeCanExecuteScripts();
// This boolean is set to true right before we fire pagehide and generally // This boolean is set to true right before we fire pagehide and generally
// unset when we embed a new content viewer. While it's true no navigation // unset when we embed a new content viewer. While it's true no navigation
// is allowed in this docshell. // is allowed in this docshell.
bool mFiredUnloadEvent; bool mFiredUnloadEvent;
@ -957,7 +945,7 @@ protected:
FrameType mFrameType; FrameType mFrameType;
// We only expect mOwnOrContainingAppId to be something other than // We only expect mOwnOrContainingAppId to be something other than
// UNKNOWN_APP_ID if mFrameType != eFrameTypeRegular. For vanilla iframes // UNKNOWN_APP_ID if mFrameType != eFrameTypeRegular. For vanilla iframes
// inside an app, we'll retrieve the containing app-id by walking up the // inside an app, we'll retrieve the containing app-id by walking up the
// docshell hierarchy. // docshell hierarchy.
// //

View File

@ -58,7 +58,6 @@ protected:
// Backup for the corresponding nsIHTMLDocument's editing state while // Backup for the corresponding nsIHTMLDocument's editing state while
// the editor is detached. // the editor is detached.
nsIHTMLDocument::EditingState mDetachedEditingState; nsIHTMLDocument::EditingState mDetachedEditingState;
}; };
#endif // nsDocShellEditorData_h__ #endif // nsDocShellEditorData_h__

View File

@ -89,7 +89,6 @@ public:
protected: protected:
virtual nsresult BuildArrayRecursive(nsIDocShellTreeItem* aItem, virtual nsresult BuildArrayRecursive(nsIDocShellTreeItem* aItem,
nsTArray<nsWeakPtr>& aItemArray); nsTArray<nsWeakPtr>& aItemArray);
}; };
class nsDocShellBackwardsEnumerator : public nsDocShellEnumerator class nsDocShellBackwardsEnumerator : public nsDocShellEnumerator

View File

@ -4,7 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Local Includes
#include "nsDocShellLoadInfo.h" #include "nsDocShellLoadInfo.h"
#include "nsISHEntry.h" #include "nsISHEntry.h"
#include "nsIInputStream.h" #include "nsIInputStream.h"
@ -12,10 +11,6 @@
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "mozilla/net/ReferrerPolicy.h" #include "mozilla/net/ReferrerPolicy.h"
//*****************************************************************************
//*** nsDocShellLoadInfo: Object Management
//*****************************************************************************
nsDocShellLoadInfo::nsDocShellLoadInfo() nsDocShellLoadInfo::nsDocShellLoadInfo()
: mInheritOwner(false) : mInheritOwner(false)
, mOwnerIsExplicit(false) , mOwnerIsExplicit(false)
@ -30,10 +25,6 @@ nsDocShellLoadInfo::~nsDocShellLoadInfo()
{ {
} }
//*****************************************************************************
// nsDocShellLoadInfo::nsISupports
//*****************************************************************************
NS_IMPL_ADDREF(nsDocShellLoadInfo) NS_IMPL_ADDREF(nsDocShellLoadInfo)
NS_IMPL_RELEASE(nsDocShellLoadInfo) NS_IMPL_RELEASE(nsDocShellLoadInfo)
@ -42,10 +33,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo)
NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo) NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
//*****************************************************************************
// nsDocShellLoadInfo::nsIDocShellLoadInfo
//*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer) nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer)
{ {

View File

@ -27,8 +27,8 @@
* above 0xffff (e.g. LOAD_FLAGS_BYPASS_CLASSIFIER), since MAKE_LOAD_TYPE would * above 0xffff (e.g. LOAD_FLAGS_BYPASS_CLASSIFIER), since MAKE_LOAD_TYPE would
* just shift them out anyway. * just shift them out anyway.
*/ */
#define EXTRA_LOAD_FLAGS (LOAD_FLAGS_FIRST_LOAD | \ #define EXTRA_LOAD_FLAGS (LOAD_FLAGS_FIRST_LOAD | \
LOAD_FLAGS_ALLOW_POPUPS | \ LOAD_FLAGS_ALLOW_POPUPS | \
0xffff0000) 0xffff0000)
/* load types are legal combinations of load commands and flags /* load types are legal combinations of load commands and flags
@ -65,7 +65,8 @@ enum LoadType
* Docshell. Instead, Docshell triggers the load itself when a * Docshell. Instead, Docshell triggers the load itself when a
* consumer-triggered load failed. * consumer-triggered load failed.
*/ */
LOAD_ERROR_PAGE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, LOAD_FLAGS_ERROR_PAGE) LOAD_ERROR_PAGE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL,
LOAD_FLAGS_ERROR_PAGE)
// NOTE: Adding a new value? Remember to update IsValidLoadType! // NOTE: Adding a new value? Remember to update IsValidLoadType!
}; };

View File

@ -17,10 +17,6 @@ nsTransferableHookData::~nsTransferableHookData()
{ {
} }
//*****************************************************************************
// nsIClipboardDragDropHookList
//*****************************************************************************
NS_IMPL_ISUPPORTS(nsTransferableHookData, nsIClipboardDragDropHookList) NS_IMPL_ISUPPORTS(nsTransferableHookData, nsIClipboardDragDropHookList)
NS_IMETHODIMP NS_IMETHODIMP

View File

@ -12,14 +12,8 @@
#include "nsIURI.h" #include "nsIURI.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
////////////////////////////////////////////////////////////////////////////////
//// nsDownloadHistory
NS_IMPL_ISUPPORTS(nsDownloadHistory, nsIDownloadHistory) NS_IMPL_ISUPPORTS(nsDownloadHistory, nsIDownloadHistory)
////////////////////////////////////////////////////////////////////////////////
//// nsIDownloadHistory
NS_IMETHODIMP NS_IMETHODIMP
nsDownloadHistory::AddDownload(nsIURI* aSource, nsDownloadHistory::AddDownload(nsIURI* aSource,
nsIURI* aReferrer, nsIURI* aReferrer,
@ -42,8 +36,7 @@ nsDownloadHistory::AddDownload(nsIURI* aSource,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (!visited) { if (!visited) {
nsCOMPtr<nsIObserverService> os = nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
mozilla::services::GetObserverService();
if (os) { if (os) {
os->NotifyObservers(aSource, NS_LINK_VISITED_EVENT_TOPIC, nullptr); os->NotifyObservers(aSource, NS_LINK_VISITED_EVENT_TOPIC, nullptr);
} }

View File

@ -14,7 +14,6 @@ class nsIDocShell;
class nsIInputStream; class nsIInputStream;
class nsIRequest; class nsIRequest;
// Interface ID for nsILinkHandler
#define NS_ILINKHANDLER_IID \ #define NS_ILINKHANDLER_IID \
{ 0xceb9aade, 0x43da, 0x4f1a, \ { 0xceb9aade, 0x43da, 0x4f1a, \
{ 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } } { 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } }

View File

@ -9,20 +9,16 @@
#include "nsISupports.h" #include "nsISupports.h"
#include "nsCharsetSource.h" #include "nsCharsetSource.h"
// Interface ID for nsIWebShellServices
/* 0c628af0-5638-4703-8f99-ed6134c9de18 */ /* 0c628af0-5638-4703-8f99-ed6134c9de18 */
#define NS_IWEB_SHELL_SERVICES_IID \ #define NS_IWEB_SHELL_SERVICES_IID \
{ 0x0c628af0, 0x5638, 0x4703, {0x8f, 0x99, 0xed, 0x61, 0x34, 0xc9, 0xde, 0x18} } { 0x0c628af0, 0x5638, 0x4703, {0x8f, 0x99, 0xed, 0x61, 0x34, 0xc9, 0xde, 0x18} }
//----------------------------------------------------------------------
class nsIWebShellServices : public nsISupports class nsIWebShellServices : public nsISupports
{ {
public: public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWEB_SHELL_SERVICES_IID) NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWEB_SHELL_SERVICES_IID)
NS_IMETHOD ReloadDocument(const char* aCharset = nullptr , NS_IMETHOD ReloadDocument(const char* aCharset = nullptr,
int32_t aSource = kCharsetUninitialized) = 0; int32_t aSource = kCharsetUninitialized) = 0;
NS_IMETHOD StopDocumentLoad(void) = 0; NS_IMETHOD StopDocumentLoad(void) = 0;
}; };

View File

@ -14,7 +14,6 @@
class nsCString; class nsCString;
// Class ID for webnavigationinfo
#define NS_WEBNAVIGATION_INFO_CID \ #define NS_WEBNAVIGATION_INFO_CID \
{ 0xf30bc0a2, 0x958b, 0x4287,{0xbf, 0x62, 0xce, 0x38, 0xba, 0x0c, 0x81, 0x1e}} { 0xf30bc0a2, 0x958b, 0x4287,{0xbf, 0x62, 0xce, 0x38, 0xba, 0x0c, 0x81, 0x1e}}

View File

@ -7,8 +7,7 @@
#ifndef nsDocShellCID_h__ #ifndef nsDocShellCID_h__
#define nsDocShellCID_h__ #define nsDocShellCID_h__
#define NS_GLOBALHISTORY2_CONTRACTID \ #define NS_GLOBALHISTORY2_CONTRACTID "@mozilla.org/browser/global-history;2"
"@mozilla.org/browser/global-history;2"
/** /**
* A contract for a service that will track download history. This can be * A contract for a service that will track download history. This can be
@ -17,16 +16,14 @@
* *
* @implements nsIDownloadHistory * @implements nsIDownloadHistory
*/ */
#define NS_DOWNLOADHISTORY_CONTRACTID \ #define NS_DOWNLOADHISTORY_CONTRACTID "@mozilla.org/browser/download-history;1"
"@mozilla.org/browser/download-history;1"
/** /**
* A contract that can be used to get a service that provides * A contract that can be used to get a service that provides
* meta-information about nsIWebNavigation objects' capabilities. * meta-information about nsIWebNavigation objects' capabilities.
* @implements nsIWebNavigationInfo * @implements nsIWebNavigationInfo
*/ */
#define NS_WEBNAVIGATION_INFO_CONTRACTID \ #define NS_WEBNAVIGATION_INFO_CONTRACTID "@mozilla.org/webnavigation-info;1"
"@mozilla.org/webnavigation-info;1"
/** /**
* Class and contract ID for the docshell. This is the container for a web * Class and contract ID for the docshell. This is the container for a web
@ -34,9 +31,9 @@
* exact ones keep changing; if they stabilize somewhat that will get * exact ones keep changing; if they stabilize somewhat that will get
* documented. * documented.
*/ */
#define NS_DOCSHELL_CID \ #define NS_DOCSHELL_CID \
{ 0xf1eac762, 0x87e9, 0x11d3, \ { 0xf1eac762, 0x87e9, 0x11d3, \
{ 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
#define NS_DOCSHELL_CONTRACTID "@mozilla.org/docshell/html;1" #define NS_DOCSHELL_CONTRACTID "@mozilla.org/docshell/html;1"
/** /**
@ -51,7 +48,8 @@
* *
* @implements nsIExternalURLHandlerService * @implements nsIExternalURLHandlerService
*/ */
#define NS_EXTERNALURLHANDLERSERVICE_CONTRACTID "@mozilla.org/uriloader/external-url-handler-service;1" #define NS_EXTERNALURLHANDLERSERVICE_CONTRACTID \
"@mozilla.org/uriloader/external-url-handler-service;1"
/** /**
* An observer service topic that can be listened to to catch creation * An observer service topic that can be listened to to catch creation

View File

@ -23,7 +23,7 @@
#include "nsLocalHandlerApp.h" #include "nsLocalHandlerApp.h"
#ifdef MOZ_ENABLE_DBUS #ifdef MOZ_ENABLE_DBUS
#include "nsDBusHandlerApp.h" #include "nsDBusHandlerApp.h"
#endif #endif
#if defined(MOZ_WIDGET_ANDROID) #if defined(MOZ_WIDGET_ANDROID)
#include "nsExternalSharingAppService.h" #include "nsExternalSharingAppService.h"
#include "nsExternalURLHandlerService.h" #include "nsExternalURLHandlerService.h"
@ -81,7 +81,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsOfflineCacheUpdate)
NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t) NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t)
#ifdef MOZ_ENABLE_DBUS #ifdef MOZ_ENABLE_DBUS
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp)
#endif #endif
#if defined(MOZ_WIDGET_ANDROID) #if defined(MOZ_WIDGET_ANDROID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalSharingAppService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalSharingAppService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalURLHandlerService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalURLHandlerService)
@ -120,7 +120,6 @@ NS_DEFINE_NAMED_CID(NS_SHISTORY_CID);
NS_DEFINE_NAMED_CID(NS_SHISTORY_INTERNAL_CID); NS_DEFINE_NAMED_CID(NS_SHISTORY_INTERNAL_CID);
NS_DEFINE_NAMED_CID(NS_DOWNLOADHISTORY_CID); NS_DEFINE_NAMED_CID(NS_DOWNLOADHISTORY_CID);
const mozilla::Module::CIDEntry kDocShellCIDs[] = { const mozilla::Module::CIDEntry kDocShellCIDs[] = {
{ &kNS_DOCSHELL_CID, false, nullptr, nsDocShellConstructor }, { &kNS_DOCSHELL_CID, false, nullptr, nsDocShellConstructor },
{ &kNS_DEFAULTURIFIXUP_CID, false, nullptr, nsDefaultURIFixupConstructor }, { &kNS_DEFAULTURIFIXUP_CID, false, nullptr, nsDefaultURIFixupConstructor },

View File

@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Local Includes
#include "nsSHEntry.h" #include "nsSHEntry.h"
#include "nsIDocShellLoadInfo.h" #include "nsIDocShellLoadInfo.h"
#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeItem.h"
@ -22,13 +21,9 @@ namespace dom = mozilla::dom;
static uint32_t gEntryID = 0; static uint32_t gEntryID = 0;
//*****************************************************************************
//*** nsSHEntry: Object Management
//*****************************************************************************
nsSHEntry::nsSHEntry() nsSHEntry::nsSHEntry()
: mReferrerPolicy(mozilla::net::RP_Default) : mShared(new nsSHEntryShared())
, mReferrerPolicy(mozilla::net::RP_Default)
, mLoadType(0) , mLoadType(0)
, mID(gEntryID++) , mID(gEntryID++)
, mScrollPositionX(0) , mScrollPositionX(0)
@ -37,26 +32,25 @@ nsSHEntry::nsSHEntry()
, mURIWasModified(false) , mURIWasModified(false)
, mIsSrcdocEntry(false) , mIsSrcdocEntry(false)
{ {
mShared = new nsSHEntryShared();
} }
nsSHEntry::nsSHEntry(const nsSHEntry &other) nsSHEntry::nsSHEntry(const nsSHEntry& aOther)
: mShared(other.mShared) : mShared(aOther.mShared)
, mURI(other.mURI) , mURI(aOther.mURI)
, mReferrerURI(other.mReferrerURI) , mReferrerURI(aOther.mReferrerURI)
, mReferrerPolicy(other.mReferrerPolicy) , mReferrerPolicy(aOther.mReferrerPolicy)
, mTitle(other.mTitle) , mTitle(aOther.mTitle)
, mPostData(other.mPostData) , mPostData(aOther.mPostData)
, mLoadType(0) // XXX why not copy? , mLoadType(0) // XXX why not copy?
, mID(other.mID) , mID(aOther.mID)
, mScrollPositionX(0) // XXX why not copy? , mScrollPositionX(0) // XXX why not copy?
, mScrollPositionY(0) // XXX why not copy? , mScrollPositionY(0) // XXX why not copy?
, mParent(other.mParent) , mParent(aOther.mParent)
, mURIWasModified(other.mURIWasModified) , mURIWasModified(aOther.mURIWasModified)
, mStateData(other.mStateData) , mStateData(aOther.mStateData)
, mIsSrcdocEntry(other.mIsSrcdocEntry) , mIsSrcdocEntry(aOther.mIsSrcdocEntry)
, mSrcdocData(other.mSrcdocData) , mSrcdocData(aOther.mSrcdocData)
, mBaseURI(other.mBaseURI) , mBaseURI(aOther.mBaseURI)
{ {
} }
@ -75,88 +69,90 @@ nsSHEntry::~nsSHEntry()
mChildren.EnumerateForwards(ClearParentPtr, nullptr); mChildren.EnumerateForwards(ClearParentPtr, nullptr);
} }
//*****************************************************************************
// nsSHEntry: nsISupports
//*****************************************************************************
NS_IMPL_ISUPPORTS(nsSHEntry, nsISHContainer, nsISHEntry, nsISHEntryInternal) NS_IMPL_ISUPPORTS(nsSHEntry, nsISHContainer, nsISHEntry, nsISHEntryInternal)
//***************************************************************************** NS_IMETHODIMP
// nsSHEntry: nsISHEntry nsSHEntry::SetScrollPosition(int32_t aX, int32_t aY)
//*****************************************************************************
NS_IMETHODIMP nsSHEntry::SetScrollPosition(int32_t x, int32_t y)
{ {
mScrollPositionX = x; mScrollPositionX = aX;
mScrollPositionY = y; mScrollPositionY = aY;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetScrollPosition(int32_t *x, int32_t *y) NS_IMETHODIMP
nsSHEntry::GetScrollPosition(int32_t* aX, int32_t* aY)
{ {
*x = mScrollPositionX; *aX = mScrollPositionX;
*y = mScrollPositionY; *aY = mScrollPositionY;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetURIWasModified(bool* aOut) NS_IMETHODIMP
nsSHEntry::GetURIWasModified(bool* aOut)
{ {
*aOut = mURIWasModified; *aOut = mURIWasModified;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetURIWasModified(bool aIn) NS_IMETHODIMP
nsSHEntry::SetURIWasModified(bool aIn)
{ {
mURIWasModified = aIn; mURIWasModified = aIn;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetURI(nsIURI** aURI) NS_IMETHODIMP
nsSHEntry::GetURI(nsIURI** aURI)
{ {
*aURI = mURI; *aURI = mURI;
NS_IF_ADDREF(*aURI); NS_IF_ADDREF(*aURI);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetURI(nsIURI* aURI) NS_IMETHODIMP
nsSHEntry::SetURI(nsIURI* aURI)
{ {
mURI = aURI; mURI = aURI;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetReferrerURI(nsIURI **aReferrerURI) NS_IMETHODIMP
nsSHEntry::GetReferrerURI(nsIURI** aReferrerURI)
{ {
*aReferrerURI = mReferrerURI; *aReferrerURI = mReferrerURI;
NS_IF_ADDREF(*aReferrerURI); NS_IF_ADDREF(*aReferrerURI);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetReferrerURI(nsIURI *aReferrerURI) NS_IMETHODIMP
nsSHEntry::SetReferrerURI(nsIURI* aReferrerURI)
{ {
mReferrerURI = aReferrerURI; mReferrerURI = aReferrerURI;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetReferrerPolicy(uint32_t *aReferrerPolicy) NS_IMETHODIMP
nsSHEntry::GetReferrerPolicy(uint32_t* aReferrerPolicy)
{ {
*aReferrerPolicy = mReferrerPolicy; *aReferrerPolicy = mReferrerPolicy;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetReferrerPolicy(uint32_t aReferrerPolicy) NS_IMETHODIMP
nsSHEntry::SetReferrerPolicy(uint32_t aReferrerPolicy)
{ {
mReferrerPolicy = aReferrerPolicy; mReferrerPolicy = aReferrerPolicy;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetContentViewer(nsIContentViewer *aViewer) nsSHEntry::SetContentViewer(nsIContentViewer* aViewer)
{ {
return mShared->SetContentViewer(aViewer); return mShared->SetContentViewer(aViewer);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetContentViewer(nsIContentViewer **aResult) nsSHEntry::GetContentViewer(nsIContentViewer** aResult)
{ {
*aResult = mShared->mContentViewer; *aResult = mShared->mContentViewer;
NS_IF_ADDREF(*aResult); NS_IF_ADDREF(*aResult);
@ -164,15 +160,15 @@ nsSHEntry::GetContentViewer(nsIContentViewer **aResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetAnyContentViewer(nsISHEntry **aOwnerEntry, nsSHEntry::GetAnyContentViewer(nsISHEntry** aOwnerEntry,
nsIContentViewer **aResult) nsIContentViewer** aResult)
{ {
// Find a content viewer in the root node or any of its children, // Find a content viewer in the root node or any of its children,
// assuming that there is only one content viewer total in any one // assuming that there is only one content viewer total in any one
// nsSHEntry tree // nsSHEntry tree
GetContentViewer(aResult); GetContentViewer(aResult);
if (*aResult) { if (*aResult) {
#ifdef DEBUG_PAGE_CACHE #ifdef DEBUG_PAGE_CACHE
printf("Found content viewer\n"); printf("Found content viewer\n");
#endif #endif
*aOwnerEntry = this; *aOwnerEntry = this;
@ -203,124 +199,142 @@ nsSHEntry::SetSticky(bool aSticky)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetSticky(bool *aSticky) nsSHEntry::GetSticky(bool* aSticky)
{ {
*aSticky = mShared->mSticky; *aSticky = mShared->mSticky;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetTitle(char16_t** aTitle) NS_IMETHODIMP
nsSHEntry::GetTitle(char16_t** aTitle)
{ {
// Check for empty title... // Check for empty title...
if (mTitle.IsEmpty() && mURI) { if (mTitle.IsEmpty() && mURI) {
// Default title is the URL. // Default title is the URL.
nsAutoCString spec; nsAutoCString spec;
if (NS_SUCCEEDED(mURI->GetSpec(spec))) if (NS_SUCCEEDED(mURI->GetSpec(spec))) {
AppendUTF8toUTF16(spec, mTitle); AppendUTF8toUTF16(spec, mTitle);
}
} }
*aTitle = ToNewUnicode(mTitle); *aTitle = ToNewUnicode(mTitle);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetTitle(const nsAString &aTitle) NS_IMETHODIMP
nsSHEntry::SetTitle(const nsAString& aTitle)
{ {
mTitle = aTitle; mTitle = aTitle;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetPostData(nsIInputStream** aResult) NS_IMETHODIMP
nsSHEntry::GetPostData(nsIInputStream** aResult)
{ {
*aResult = mPostData; *aResult = mPostData;
NS_IF_ADDREF(*aResult); NS_IF_ADDREF(*aResult);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetPostData(nsIInputStream* aPostData) NS_IMETHODIMP
nsSHEntry::SetPostData(nsIInputStream* aPostData)
{ {
mPostData = aPostData; mPostData = aPostData;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetLayoutHistoryState(nsILayoutHistoryState** aResult) NS_IMETHODIMP
nsSHEntry::GetLayoutHistoryState(nsILayoutHistoryState** aResult)
{ {
*aResult = mShared->mLayoutHistoryState; *aResult = mShared->mLayoutHistoryState;
NS_IF_ADDREF(*aResult); NS_IF_ADDREF(*aResult);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetLayoutHistoryState(nsILayoutHistoryState* aState) NS_IMETHODIMP
nsSHEntry::SetLayoutHistoryState(nsILayoutHistoryState* aState)
{ {
mShared->mLayoutHistoryState = aState; mShared->mLayoutHistoryState = aState;
if (mShared->mLayoutHistoryState) { if (mShared->mLayoutHistoryState) {
mShared->mLayoutHistoryState-> mShared->mLayoutHistoryState->SetScrollPositionOnly(
SetScrollPositionOnly(!mShared->mSaveLayoutState); !mShared->mSaveLayoutState);
} }
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetLoadType(uint32_t * aResult) NS_IMETHODIMP
nsSHEntry::GetLoadType(uint32_t* aResult)
{ {
*aResult = mLoadType; *aResult = mLoadType;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetLoadType(uint32_t aLoadType) NS_IMETHODIMP
nsSHEntry::SetLoadType(uint32_t aLoadType)
{ {
mLoadType = aLoadType; mLoadType = aLoadType;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetID(uint32_t * aResult) NS_IMETHODIMP
nsSHEntry::GetID(uint32_t* aResult)
{ {
*aResult = mID; *aResult = mID;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetID(uint32_t aID) NS_IMETHODIMP
nsSHEntry::SetID(uint32_t aID)
{ {
mID = aID; mID = aID;
return NS_OK; return NS_OK;
} }
nsSHEntryShared* nsSHEntry::GetSharedState() nsSHEntryShared*
nsSHEntry::GetSharedState()
{ {
return mShared; return mShared;
} }
NS_IMETHODIMP nsSHEntry::GetIsSubFrame(bool * aFlag) NS_IMETHODIMP
nsSHEntry::GetIsSubFrame(bool* aFlag)
{ {
*aFlag = mShared->mIsFrameNavigation; *aFlag = mShared->mIsFrameNavigation;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetIsSubFrame(bool aFlag) NS_IMETHODIMP
nsSHEntry::SetIsSubFrame(bool aFlag)
{ {
mShared->mIsFrameNavigation = aFlag; mShared->mIsFrameNavigation = aFlag;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetCacheKey(nsISupports** aResult) NS_IMETHODIMP
nsSHEntry::GetCacheKey(nsISupports** aResult)
{ {
*aResult = mShared->mCacheKey; *aResult = mShared->mCacheKey;
NS_IF_ADDREF(*aResult); NS_IF_ADDREF(*aResult);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetCacheKey(nsISupports* aCacheKey) NS_IMETHODIMP
nsSHEntry::SetCacheKey(nsISupports* aCacheKey)
{ {
mShared->mCacheKey = aCacheKey; mShared->mCacheKey = aCacheKey;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetSaveLayoutStateFlag(bool * aFlag) NS_IMETHODIMP
nsSHEntry::GetSaveLayoutStateFlag(bool* aFlag)
{ {
*aFlag = mShared->mSaveLayoutState; *aFlag = mShared->mSaveLayoutState;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetSaveLayoutStateFlag(bool aFlag) NS_IMETHODIMP
nsSHEntry::SetSaveLayoutStateFlag(bool aFlag)
{ {
mShared->mSaveLayoutState = aFlag; mShared->mSaveLayoutState = aFlag;
if (mShared->mLayoutHistoryState) { if (mShared->mLayoutHistoryState) {
@ -330,44 +344,48 @@ NS_IMETHODIMP nsSHEntry::SetSaveLayoutStateFlag(bool aFlag)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetExpirationStatus(bool * aFlag) NS_IMETHODIMP
nsSHEntry::GetExpirationStatus(bool* aFlag)
{ {
*aFlag = mShared->mExpired; *aFlag = mShared->mExpired;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetExpirationStatus(bool aFlag) NS_IMETHODIMP
nsSHEntry::SetExpirationStatus(bool aFlag)
{ {
mShared->mExpired = aFlag; mShared->mExpired = aFlag;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::GetContentType(nsACString& aContentType) NS_IMETHODIMP
nsSHEntry::GetContentType(nsACString& aContentType)
{ {
aContentType = mShared->mContentType; aContentType = mShared->mContentType;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsSHEntry::SetContentType(const nsACString& aContentType) NS_IMETHODIMP
nsSHEntry::SetContentType(const nsACString& aContentType)
{ {
mShared->mContentType = aContentType; mShared->mContentType = aContentType;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle, nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
nsIInputStream * aInputStream, nsIInputStream* aInputStream,
nsILayoutHistoryState * aLayoutHistoryState, nsILayoutHistoryState* aLayoutHistoryState,
nsISupports * aCacheKey, const nsACString& aContentType, nsISupports* aCacheKey, const nsACString& aContentType,
nsISupports* aOwner, nsISupports* aOwner, uint64_t aDocShellID,
uint64_t aDocShellID, bool aDynamicCreation) bool aDynamicCreation)
{ {
mURI = aURI; mURI = aURI;
mTitle = aTitle; mTitle = aTitle;
mPostData = aInputStream; mPostData = aInputStream;
// Set the LoadType by default to loadHistory during creation // Set the LoadType by default to loadHistory during creation
mLoadType = (uint32_t) nsIDocShellLoadInfo::loadHistory; mLoadType = (uint32_t)nsIDocShellLoadInfo::loadHistory;
mShared->mCacheKey = aCacheKey; mShared->mCacheKey = aCacheKey;
mShared->mContentType = aContentType; mShared->mContentType = aContentType;
@ -375,7 +393,7 @@ nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
mShared->mDocShellID = aDocShellID; mShared->mDocShellID = aDocShellID;
mShared->mDynamicallyCreated = aDynamicCreation; mShared->mDynamicallyCreated = aDynamicCreation;
// By default all entries are set false for subframe flag. // By default all entries are set false for subframe flag.
// nsDocShell::CloneAndReplace() which creates entries for // nsDocShell::CloneAndReplace() which creates entries for
// all subframe navigations, sets the flag to true. // all subframe navigations, sets the flag to true.
mShared->mIsFrameNavigation = false; mShared->mIsFrameNavigation = false;
@ -384,7 +402,7 @@ nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
mShared->mSaveLayoutState = true; mShared->mSaveLayoutState = true;
mShared->mLayoutHistoryState = aLayoutHistoryState; mShared->mLayoutHistoryState = aLayoutHistoryState;
//By default the page is not expired // By default the page is not expired
mShared->mExpired = false; mShared->mExpired = false;
mIsSrcdocEntry = false; mIsSrcdocEntry = false;
@ -394,7 +412,7 @@ nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::Clone(nsISHEntry ** aResult) nsSHEntry::Clone(nsISHEntry** aResult)
{ {
*aResult = new nsSHEntry(*this); *aResult = new nsSHEntry(*this);
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
@ -402,7 +420,7 @@ nsSHEntry::Clone(nsISHEntry ** aResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetParent(nsISHEntry ** aResult) nsSHEntry::GetParent(nsISHEntry** aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);
*aResult = mParent; *aResult = mParent;
@ -411,7 +429,7 @@ nsSHEntry::GetParent(nsISHEntry ** aResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetParent(nsISHEntry * aParent) nsSHEntry::SetParent(nsISHEntry* aParent)
{ {
/* parent not Addrefed on purpose to avoid cyclic reference /* parent not Addrefed on purpose to avoid cyclic reference
* Null parent is OK * Null parent is OK
@ -423,49 +441,49 @@ nsSHEntry::SetParent(nsISHEntry * aParent)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetWindowState(nsISupports *aState) nsSHEntry::SetWindowState(nsISupports* aState)
{ {
mShared->mWindowState = aState; mShared->mWindowState = aState;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetWindowState(nsISupports **aState) nsSHEntry::GetWindowState(nsISupports** aState)
{ {
NS_IF_ADDREF(*aState = mShared->mWindowState); NS_IF_ADDREF(*aState = mShared->mWindowState);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetViewerBounds(const nsIntRect &aBounds) nsSHEntry::SetViewerBounds(const nsIntRect& aBounds)
{ {
mShared->mViewerBounds = aBounds; mShared->mViewerBounds = aBounds;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetViewerBounds(nsIntRect &aBounds) nsSHEntry::GetViewerBounds(nsIntRect& aBounds)
{ {
aBounds = mShared->mViewerBounds; aBounds = mShared->mViewerBounds;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetOwner(nsISupports **aOwner) nsSHEntry::GetOwner(nsISupports** aOwner)
{ {
NS_IF_ADDREF(*aOwner = mShared->mOwner); NS_IF_ADDREF(*aOwner = mShared->mOwner);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetOwner(nsISupports *aOwner) nsSHEntry::SetOwner(nsISupports* aOwner)
{ {
mShared->mOwner = aOwner; mShared->mOwner = aOwner;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetBFCacheEntry(nsIBFCacheEntry **aEntry) nsSHEntry::GetBFCacheEntry(nsIBFCacheEntry** aEntry)
{ {
NS_ENSURE_ARG_POINTER(aEntry); NS_ENSURE_ARG_POINTER(aEntry);
NS_IF_ADDREF(*aEntry = mShared); NS_IF_ADDREF(*aEntry = mShared);
@ -473,18 +491,18 @@ nsSHEntry::GetBFCacheEntry(nsIBFCacheEntry **aEntry)
} }
bool bool
nsSHEntry::HasBFCacheEntry(nsIBFCacheEntry *aEntry) nsSHEntry::HasBFCacheEntry(nsIBFCacheEntry* aEntry)
{ {
return static_cast<nsIBFCacheEntry*>(mShared) == aEntry; return static_cast<nsIBFCacheEntry*>(mShared) == aEntry;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::AdoptBFCacheEntry(nsISHEntry *aEntry) nsSHEntry::AdoptBFCacheEntry(nsISHEntry* aEntry)
{ {
nsCOMPtr<nsISHEntryInternal> shEntry = do_QueryInterface(aEntry); nsCOMPtr<nsISHEntryInternal> shEntry = do_QueryInterface(aEntry);
NS_ENSURE_STATE(shEntry); NS_ENSURE_STATE(shEntry);
nsSHEntryShared *shared = shEntry->GetSharedState(); nsSHEntryShared* shared = shEntry->GetSharedState();
NS_ENSURE_STATE(shared); NS_ENSURE_STATE(shared);
mShared = shared; mShared = shared;
@ -492,11 +510,11 @@ nsSHEntry::AdoptBFCacheEntry(nsISHEntry *aEntry)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SharesDocumentWith(nsISHEntry *aEntry, bool *aOut) nsSHEntry::SharesDocumentWith(nsISHEntry* aEntry, bool* aOut)
{ {
NS_ENSURE_ARG_POINTER(aOut); NS_ENSURE_ARG_POINTER(aOut);
nsCOMPtr<nsISHEntryInternal> internal = do_QueryInterface(aEntry); nsCOMPtr<nsISHEntryInternal> internal = do_QueryInterface(aEntry);
NS_ENSURE_STATE(internal); NS_ENSURE_STATE(internal);
*aOut = mShared == internal->GetSharedState(); *aOut = mShared == internal->GetSharedState();
@ -518,14 +536,14 @@ nsSHEntry::GetIsSrcdocEntry(bool* aIsSrcdocEntry)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetSrcdocData(nsAString &aSrcdocData) nsSHEntry::GetSrcdocData(nsAString& aSrcdocData)
{ {
aSrcdocData = mSrcdocData; aSrcdocData = mSrcdocData;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetSrcdocData(const nsAString &aSrcdocData) nsSHEntry::SetSrcdocData(const nsAString& aSrcdocData)
{ {
mSrcdocData = aSrcdocData; mSrcdocData = aSrcdocData;
mIsSrcdocEntry = true; mIsSrcdocEntry = true;
@ -533,7 +551,7 @@ nsSHEntry::SetSrcdocData(const nsAString &aSrcdocData)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetBaseURI(nsIURI **aBaseURI) nsSHEntry::GetBaseURI(nsIURI** aBaseURI)
{ {
*aBaseURI = mBaseURI; *aBaseURI = mBaseURI;
NS_IF_ADDREF(*aBaseURI); NS_IF_ADDREF(*aBaseURI);
@ -541,25 +559,21 @@ nsSHEntry::GetBaseURI(nsIURI **aBaseURI)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetBaseURI(nsIURI *aBaseURI) nsSHEntry::SetBaseURI(nsIURI* aBaseURI)
{ {
mBaseURI = aBaseURI; mBaseURI = aBaseURI;
return NS_OK; return NS_OK;
} }
//***************************************************************************** NS_IMETHODIMP
// nsSHEntry: nsISHContainer nsSHEntry::GetChildCount(int32_t* aCount)
//*****************************************************************************
NS_IMETHODIMP
nsSHEntry::GetChildCount(int32_t * aCount)
{ {
*aCount = mChildren.Count(); *aCount = mChildren.Count();
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset) nsSHEntry::AddChild(nsISHEntry* aChild, int32_t aOffset)
{ {
if (aChild) { if (aChild) {
NS_ENSURE_SUCCESS(aChild->SetParent(this), NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(aChild->SetParent(this), NS_ERROR_FAILURE);
@ -579,7 +593,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
// //
// Assert that aOffset will not be so high as to grow us a lot. // Assert that aOffset will not be so high as to grow us a lot.
// //
NS_ASSERTION(aOffset < (mChildren.Count()+1023), "Large frames array!\n"); NS_ASSERTION(aOffset < (mChildren.Count() + 1023), "Large frames array!\n");
bool newChildIsDyn = false; bool newChildIsDyn = false;
if (aChild) { if (aChild) {
@ -634,7 +648,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
} }
} }
} }
if (dynEntry) { if (dynEntry) {
nsCOMArray<nsISHEntry> tmp; nsCOMArray<nsISHEntry> tmp;
tmp.SetCount(aOffset - dynEntryIndex + 1); tmp.SetCount(aOffset - dynEntryIndex + 1);
@ -642,7 +656,6 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
NS_ASSERTION(mChildren[aOffset + 1] == dynEntry, "Whaat?"); NS_ASSERTION(mChildren[aOffset + 1] == dynEntry, "Whaat?");
} }
} }
// Make sure there isn't anything at aOffset. // Make sure there isn't anything at aOffset.
if (aOffset < mChildren.Count()) { if (aOffset < mChildren.Count()) {
@ -664,7 +677,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, int32_t aOffset)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::RemoveChild(nsISHEntry * aChild) nsSHEntry::RemoveChild(nsISHEntry* aChild)
{ {
NS_ENSURE_TRUE(aChild, NS_ERROR_FAILURE); NS_ENSURE_TRUE(aChild, NS_ERROR_FAILURE);
bool childRemoved = false; bool childRemoved = false;
@ -692,7 +705,7 @@ nsSHEntry::RemoveChild(nsISHEntry * aChild)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetChildAt(int32_t aIndex, nsISHEntry ** aResult) nsSHEntry::GetChildAt(int32_t aIndex, nsISHEntry** aResult)
{ {
if (aIndex >= 0 && aIndex < mChildren.Count()) { if (aIndex >= 0 && aIndex < mChildren.Count()) {
*aResult = mChildren[aIndex]; *aResult = mChildren[aIndex];
@ -727,7 +740,7 @@ nsSHEntry::ReplaceChild(nsISHEntry* aNewEntry)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::AddChildShell(nsIDocShellTreeItem *aShell) nsSHEntry::AddChildShell(nsIDocShellTreeItem* aShell)
{ {
NS_ASSERTION(aShell, "Null child shell added to history entry"); NS_ASSERTION(aShell, "Null child shell added to history entry");
mShared->mChildShells.AppendObject(aShell); mShared->mChildShells.AppendObject(aShell);
@ -735,7 +748,7 @@ nsSHEntry::AddChildShell(nsIDocShellTreeItem *aShell)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::ChildShellAt(int32_t aIndex, nsIDocShellTreeItem **aShell) nsSHEntry::ChildShellAt(int32_t aIndex, nsIDocShellTreeItem** aShell)
{ {
NS_IF_ADDREF(*aShell = mShared->mChildShells.SafeObjectAt(aIndex)); NS_IF_ADDREF(*aShell = mShared->mChildShells.SafeObjectAt(aIndex));
return NS_OK; return NS_OK;
@ -749,14 +762,14 @@ nsSHEntry::ClearChildShells()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetRefreshURIList(nsISupportsArray **aList) nsSHEntry::GetRefreshURIList(nsISupportsArray** aList)
{ {
NS_IF_ADDREF(*aList = mShared->mRefreshURIList); NS_IF_ADDREF(*aList = mShared->mRefreshURIList);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetRefreshURIList(nsISupportsArray *aList) nsSHEntry::SetRefreshURIList(nsISupportsArray* aList)
{ {
mShared->mRefreshURIList = aList; mShared->mRefreshURIList = aList;
return NS_OK; return NS_OK;
@ -804,7 +817,7 @@ nsSHEntry::HasDetachedEditor()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetStateData(nsIStructuredCloneContainer **aContainer) nsSHEntry::GetStateData(nsIStructuredCloneContainer** aContainer)
{ {
NS_ENSURE_ARG_POINTER(aContainer); NS_ENSURE_ARG_POINTER(aContainer);
NS_IF_ADDREF(*aContainer = mStateData); NS_IF_ADDREF(*aContainer = mStateData);
@ -812,7 +825,7 @@ nsSHEntry::GetStateData(nsIStructuredCloneContainer **aContainer)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::SetStateData(nsIStructuredCloneContainer *aContainer) nsSHEntry::SetStateData(nsIStructuredCloneContainer* aContainer)
{ {
mStateData = aContainer; mStateData = aContainer;
return NS_OK; return NS_OK;
@ -855,9 +868,8 @@ nsSHEntry::SetDocshellID(uint64_t aID)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHEntry::GetLastTouched(uint32_t *aLastTouched) nsSHEntry::GetLastTouched(uint32_t* aLastTouched)
{ {
*aLastTouched = mShared->mLastTouched; *aLastTouched = mShared->mLastTouched;
return NS_OK; return NS_OK;

View File

@ -26,9 +26,9 @@ class nsSHEntry final : public nsISHEntry,
public nsISHContainer, public nsISHContainer,
public nsISHEntryInternal public nsISHEntryInternal
{ {
public: public:
nsSHEntry(); nsSHEntry();
nsSHEntry(const nsSHEntry &other); nsSHEntry(const nsSHEntry& aOther);
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSISHENTRY NS_DECL_NSISHENTRY
@ -39,7 +39,7 @@ public:
static nsresult Startup(); static nsresult Startup();
static void Shutdown(); static void Shutdown();
private: private:
~nsSHEntry(); ~nsSHEntry();
@ -48,22 +48,22 @@ private:
nsRefPtr<nsSHEntryShared> mShared; nsRefPtr<nsSHEntryShared> mShared;
// See nsSHEntry.idl for comments on these members. // See nsSHEntry.idl for comments on these members.
nsCOMPtr<nsIURI> mURI; nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIURI> mReferrerURI; nsCOMPtr<nsIURI> mReferrerURI;
uint32_t mReferrerPolicy; uint32_t mReferrerPolicy;
nsString mTitle; nsString mTitle;
nsCOMPtr<nsIInputStream> mPostData; nsCOMPtr<nsIInputStream> mPostData;
uint32_t mLoadType; uint32_t mLoadType;
uint32_t mID; uint32_t mID;
int32_t mScrollPositionX; int32_t mScrollPositionX;
int32_t mScrollPositionY; int32_t mScrollPositionY;
nsISHEntry* mParent; nsISHEntry* mParent;
nsCOMArray<nsISHEntry> mChildren; nsCOMArray<nsISHEntry> mChildren;
bool mURIWasModified; bool mURIWasModified;
nsCOMPtr<nsIStructuredCloneContainer> mStateData; nsCOMPtr<nsIStructuredCloneContainer> mStateData;
bool mIsSrcdocEntry; bool mIsSrcdocEntry;
nsString mSrcdocData; nsString mSrcdocData;
nsCOMPtr<nsIURI> mBaseURI; nsCOMPtr<nsIURI> mBaseURI;
}; };
#endif /* nsSHEntry_h */ #endif /* nsSHEntry_h */

View File

@ -29,10 +29,11 @@ uint64_t gSHEntrySharedID = 0;
#define CONTENT_VIEWER_TIMEOUT_SECONDS "browser.sessionhistory.contentViewerTimeout" #define CONTENT_VIEWER_TIMEOUT_SECONDS "browser.sessionhistory.contentViewerTimeout"
// Default this to time out unused content viewers after 30 minutes // Default this to time out unused content viewers after 30 minutes
#define CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT (30*60) #define CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT (30 * 60)
typedef nsExpirationTracker<nsSHEntryShared, 3> HistoryTrackerBase; typedef nsExpirationTracker<nsSHEntryShared, 3> HistoryTrackerBase;
class HistoryTracker final : public HistoryTrackerBase { class HistoryTracker final : public HistoryTrackerBase
{
public: public:
explicit HistoryTracker(uint32_t aTimeout) explicit HistoryTracker(uint32_t aTimeout)
: HistoryTrackerBase(1000 * aTimeout / 2) : HistoryTrackerBase(1000 * aTimeout / 2)
@ -40,13 +41,14 @@ public:
} }
protected: protected:
virtual void NotifyExpired(nsSHEntryShared *aObj) { virtual void NotifyExpired(nsSHEntryShared* aObj)
{
RemoveObject(aObj); RemoveObject(aObj);
aObj->Expire(); aObj->Expire();
} }
}; };
static HistoryTracker *gHistoryTracker = nullptr; static HistoryTracker* gHistoryTracker = nullptr;
void void
nsSHEntryShared::EnsureHistoryTracker() nsSHEntryShared::EnsureHistoryTracker()
@ -88,10 +90,9 @@ nsSHEntryShared::~nsSHEntryShared()
if (gHistoryTracker) { if (gHistoryTracker) {
// Check that we're not still on track to expire. We shouldn't be, because // Check that we're not still on track to expire. We shouldn't be, because
// we just removed ourselves! // we just removed ourselves!
nsExpirationTracker<nsSHEntryShared, 3>::Iterator nsExpirationTracker<nsSHEntryShared, 3>::Iterator iterator(gHistoryTracker);
iterator(gHistoryTracker);
nsSHEntryShared *elem; nsSHEntryShared* elem;
while ((elem = iterator.Next()) != nullptr) { while ((elem = iterator.Next()) != nullptr) {
NS_ASSERTION(elem != this, "Found dead entry still in the tracker!"); NS_ASSERTION(elem != this, "Found dead entry still in the tracker!");
} }
@ -106,7 +107,7 @@ nsSHEntryShared::~nsSHEntryShared()
NS_IMPL_ISUPPORTS(nsSHEntryShared, nsIBFCacheEntry, nsIMutationObserver) NS_IMPL_ISUPPORTS(nsSHEntryShared, nsIBFCacheEntry, nsIMutationObserver)
already_AddRefed<nsSHEntryShared> already_AddRefed<nsSHEntryShared>
nsSHEntryShared::Duplicate(nsSHEntryShared *aEntry) nsSHEntryShared::Duplicate(nsSHEntryShared* aEntry)
{ {
nsRefPtr<nsSHEntryShared> newEntry = new nsSHEntryShared(); nsRefPtr<nsSHEntryShared> newEntry = new nsSHEntryShared();
@ -124,7 +125,8 @@ nsSHEntryShared::Duplicate(nsSHEntryShared *aEntry)
return newEntry.forget(); return newEntry.forget();
} }
void nsSHEntryShared::RemoveFromExpirationTracker() void
nsSHEntryShared::RemoveFromExpirationTracker()
{ {
if (gHistoryTracker && GetExpirationState()->IsTracked()) { if (gHistoryTracker && GetExpirationState()->IsTracked()) {
gHistoryTracker->RemoveObject(this); gHistoryTracker->RemoveObject(this);
@ -197,7 +199,7 @@ nsSHEntryShared::Expire()
} }
nsresult nsresult
nsSHEntryShared::SetContentViewer(nsIContentViewer *aViewer) nsSHEntryShared::SetContentViewer(nsIContentViewer* aViewer)
{ {
NS_PRECONDITION(!aViewer || !mContentViewer, NS_PRECONDITION(!aViewer || !mContentViewer,
"SHEntryShared already contains viewer"); "SHEntryShared already contains viewer");
@ -229,8 +231,7 @@ nsSHEntryShared::SetContentViewer(nsIContentViewer *aViewer)
nsresult nsresult
nsSHEntryShared::RemoveFromBFCacheSync() nsSHEntryShared::RemoveFromBFCacheSync()
{ {
NS_ASSERTION(mContentViewer && mDocument, NS_ASSERTION(mContentViewer && mDocument, "we're not in the bfcache!");
"we're not in the bfcache!");
nsCOMPtr<nsIContentViewer> viewer = mContentViewer; nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
DropPresentationState(); DropPresentationState();
@ -249,9 +250,10 @@ class DestroyViewerEvent : public nsRunnable
{ {
public: public:
DestroyViewerEvent(nsIContentViewer* aViewer, nsIDocument* aDocument) DestroyViewerEvent(nsIContentViewer* aViewer, nsIDocument* aDocument)
: mViewer(aViewer), : mViewer(aViewer)
mDocument(aDocument) , mDocument(aDocument)
{} {
}
NS_IMETHOD Run() NS_IMETHOD Run()
{ {
@ -268,14 +270,12 @@ public:
nsresult nsresult
nsSHEntryShared::RemoveFromBFCacheAsync() nsSHEntryShared::RemoveFromBFCacheAsync()
{ {
NS_ASSERTION(mContentViewer && mDocument, NS_ASSERTION(mContentViewer && mDocument, "we're not in the bfcache!");
"we're not in the bfcache!");
// Release the reference to the contentviewer asynchronously so that the // Release the reference to the contentviewer asynchronously so that the
// document doesn't get nuked mid-mutation. // document doesn't get nuked mid-mutation.
nsCOMPtr<nsIRunnable> evt = nsCOMPtr<nsIRunnable> evt = new DestroyViewerEvent(mContentViewer, mDocument);
new DestroyViewerEvent(mContentViewer, mDocument);
nsresult rv = NS_DispatchToCurrentThread(evt); nsresult rv = NS_DispatchToCurrentThread(evt);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("failed to dispatch DestroyViewerEvent"); NS_WARNING("failed to dispatch DestroyViewerEvent");
@ -293,16 +293,12 @@ nsSHEntryShared::RemoveFromBFCacheAsync()
} }
nsresult nsresult
nsSHEntryShared::GetID(uint64_t *aID) nsSHEntryShared::GetID(uint64_t* aID)
{ {
*aID = mID; *aID = mID;
return NS_OK; return NS_OK;
} }
//*****************************************************************************
// nsSHEntryShared: nsIMutationObserver
//*****************************************************************************
void void
nsSHEntryShared::NodeWillBeDestroyed(const nsINode* aNode) nsSHEntryShared::NodeWillBeDestroyed(const nsINode* aNode)
{ {
@ -372,6 +368,6 @@ nsSHEntryShared::ContentRemoved(nsIDocument* aDocument,
} }
void void
nsSHEntryShared::ParentChainChanged(nsIContent *aContent) nsSHEntryShared::ParentChainChanged(nsIContent* aContent)
{ {
} }

View File

@ -30,64 +30,65 @@ class nsISupportsArray;
// back/forward cache. // back/forward cache.
// //
// nsSHEntryShared is the vehicle for this sharing. // nsSHEntryShared is the vehicle for this sharing.
class nsSHEntryShared final : public nsIBFCacheEntry, class nsSHEntryShared final
public nsIMutationObserver : public nsIBFCacheEntry
, public nsIMutationObserver
{ {
public: public:
static void EnsureHistoryTracker(); static void EnsureHistoryTracker();
static void Shutdown(); static void Shutdown();
nsSHEntryShared(); nsSHEntryShared();
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIMUTATIONOBSERVER NS_DECL_NSIMUTATIONOBSERVER
NS_DECL_NSIBFCACHEENTRY NS_DECL_NSIBFCACHEENTRY
private: private:
~nsSHEntryShared(); ~nsSHEntryShared();
friend class nsSHEntry; friend class nsSHEntry;
friend class HistoryTracker; friend class HistoryTracker;
friend class nsExpirationTracker<nsSHEntryShared, 3>; friend class nsExpirationTracker<nsSHEntryShared, 3>;
nsExpirationState *GetExpirationState() { return &mExpirationState; } nsExpirationState *GetExpirationState() { return &mExpirationState; }
static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared *aEntry); static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared* aEntry);
void RemoveFromExpirationTracker(); void RemoveFromExpirationTracker();
void Expire(); void Expire();
nsresult SyncPresentationState(); nsresult SyncPresentationState();
void DropPresentationState(); void DropPresentationState();
nsresult SetContentViewer(nsIContentViewer *aViewer); nsresult SetContentViewer(nsIContentViewer* aViewer);
// See nsISHEntry.idl for an explanation of these members. // See nsISHEntry.idl for an explanation of these members.
// These members are copied by nsSHEntryShared::Duplicate(). If you add a // These members are copied by nsSHEntryShared::Duplicate(). If you add a
// member here, be sure to update the Duplicate() implementation. // member here, be sure to update the Duplicate() implementation.
uint64_t mDocShellID; uint64_t mDocShellID;
nsCOMArray<nsIDocShellTreeItem> mChildShells; nsCOMArray<nsIDocShellTreeItem> mChildShells;
nsCOMPtr<nsISupports> mOwner; nsCOMPtr<nsISupports> mOwner;
nsCString mContentType; nsCString mContentType;
bool mIsFrameNavigation; bool mIsFrameNavigation;
bool mSaveLayoutState; bool mSaveLayoutState;
bool mSticky; bool mSticky;
bool mDynamicallyCreated; bool mDynamicallyCreated;
nsCOMPtr<nsISupports> mCacheKey; nsCOMPtr<nsISupports> mCacheKey;
uint32_t mLastTouched; uint32_t mLastTouched;
// These members aren't copied by nsSHEntryShared::Duplicate() because // These members aren't copied by nsSHEntryShared::Duplicate() because
// they're specific to a particular content viewer. // they're specific to a particular content viewer.
uint64_t mID; uint64_t mID;
nsCOMPtr<nsIContentViewer> mContentViewer; nsCOMPtr<nsIContentViewer> mContentViewer;
nsCOMPtr<nsIDocument> mDocument; nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState; nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
bool mExpired; bool mExpired;
nsCOMPtr<nsISupports> mWindowState; nsCOMPtr<nsISupports> mWindowState;
nsIntRect mViewerBounds; nsIntRect mViewerBounds;
nsCOMPtr<nsISupportsArray> mRefreshURIList; nsCOMPtr<nsISupportsArray> mRefreshURIList;
nsExpirationState mExpirationState; nsExpirationState mExpirationState;
nsAutoPtr<nsDocShellEditorData> mEditorData; nsAutoPtr<nsDocShellEditorData> mEditorData;
}; };
#endif #endif

View File

@ -4,80 +4,66 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Local Includes
#include "nsSHTransaction.h" #include "nsSHTransaction.h"
#include "nsISHEntry.h" #include "nsISHEntry.h"
//***************************************************************************** nsSHTransaction::nsSHTransaction()
//*** nsSHTransaction: Object Management : mPersist(true)
//***************************************************************************** , mPrev(nullptr)
nsSHTransaction::nsSHTransaction() : mPersist(true), mPrev(nullptr)
{ {
} }
nsSHTransaction::~nsSHTransaction() nsSHTransaction::~nsSHTransaction()
{ {
} }
//*****************************************************************************
// nsSHTransaction: nsISupports
//*****************************************************************************
NS_IMPL_ADDREF(nsSHTransaction) NS_IMPL_ADDREF(nsSHTransaction)
NS_IMPL_RELEASE(nsSHTransaction) NS_IMPL_RELEASE(nsSHTransaction)
NS_INTERFACE_MAP_BEGIN(nsSHTransaction) NS_INTERFACE_MAP_BEGIN(nsSHTransaction)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction)
NS_INTERFACE_MAP_ENTRY(nsISHTransaction) NS_INTERFACE_MAP_ENTRY(nsISHTransaction)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
//*****************************************************************************
// nsSHTransaction: nsISHTransaction
//*****************************************************************************
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::Create(nsISHEntry* aSHEntry, nsISHTransaction* aPrev) nsSHTransaction::Create(nsISHEntry* aSHEntry, nsISHTransaction* aPrev)
{ {
SetSHEntry(aSHEntry); SetSHEntry(aSHEntry);
if(aPrev) if (aPrev) {
aPrev->SetNext(this); aPrev->SetNext(this);
}
SetPrev(aPrev); SetPrev(aPrev);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::GetSHEntry(nsISHEntry ** aResult) nsSHTransaction::GetSHEntry(nsISHEntry** aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);
*aResult = mSHEntry; *aResult = mSHEntry;
NS_IF_ADDREF(*aResult); NS_IF_ADDREF(*aResult);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::SetSHEntry(nsISHEntry * aSHEntry) nsSHTransaction::SetSHEntry(nsISHEntry* aSHEntry)
{ {
mSHEntry = aSHEntry; mSHEntry = aSHEntry;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::GetNext(nsISHTransaction * * aResult) nsSHTransaction::GetNext(nsISHTransaction** aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);
*aResult = mNext; *aResult = mNext;
NS_IF_ADDREF(*aResult); NS_IF_ADDREF(*aResult);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::SetNext(nsISHTransaction * aNext) nsSHTransaction::SetNext(nsISHTransaction* aNext)
{ {
if (aNext) { if (aNext) {
NS_ENSURE_SUCCESS(aNext->SetPrev(this), NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(aNext->SetPrev(this), NS_ERROR_FAILURE);
@ -88,34 +74,34 @@ nsSHTransaction::SetNext(nsISHTransaction * aNext)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::SetPrev(nsISHTransaction * aPrev) nsSHTransaction::SetPrev(nsISHTransaction* aPrev)
{ {
/* This is weak reference to parent. Do not Addref it */ /* This is weak reference to parent. Do not Addref it */
mPrev = aPrev; mPrev = aPrev;
return NS_OK; return NS_OK;
} }
nsresult nsresult
nsSHTransaction::GetPrev(nsISHTransaction ** aResult) nsSHTransaction::GetPrev(nsISHTransaction** aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);
*aResult = mPrev; *aResult = mPrev;
NS_IF_ADDREF(*aResult); NS_IF_ADDREF(*aResult);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::SetPersist(bool aPersist) nsSHTransaction::SetPersist(bool aPersist)
{ {
mPersist = aPersist; mPersist = aPersist;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSHTransaction::GetPersist(bool* aPersist) nsSHTransaction::GetPersist(bool* aPersist)
{ {
NS_ENSURE_ARG_POINTER(aPersist); NS_ENSURE_ARG_POINTER(aPersist);
*aPersist = mPersist; *aPersist = mPersist;
return NS_OK; return NS_OK;
} }

View File

@ -15,25 +15,23 @@
class nsISHEntry; class nsISHEntry;
class nsSHTransaction: public nsISHTransaction class nsSHTransaction : public nsISHTransaction
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSISHTRANSACTION NS_DECL_NSISHTRANSACTION
nsSHTransaction(); nsSHTransaction();
protected: protected:
virtual ~nsSHTransaction(); virtual ~nsSHTransaction();
protected: protected:
bool mPersist; bool mPersist;
nsISHTransaction * mPrev; // Weak Reference nsISHTransaction* mPrev; // Weak Reference
nsCOMPtr<nsISHTransaction> mNext; nsCOMPtr<nsISHTransaction> mNext;
nsCOMPtr<nsISHEntry> mSHEntry; nsCOMPtr<nsISHEntry> mSHEntry;
}; };
#endif /* nsSHTransaction_h */
#endif /* nsSHTransaction_h */

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,7 @@
#ifndef nsSHistory_h #ifndef nsSHistory_h
#define nsSHistory_h #define nsSHistory_h
// Helper Classes
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
//Interfaces Needed
#include "nsISHistory.h" #include "nsISHistory.h"
#include "nsISHistoryInternal.h" #include "nsISHistoryInternal.h"
#include "nsIWebNavigation.h" #include "nsIWebNavigation.h"
@ -18,7 +15,6 @@
#include "nsTObserverArray.h" #include "nsTObserverArray.h"
#include "nsWeakPtr.h" #include "nsWeakPtr.h"
// Needed to maintain global list of all SHistory objects
#include "prclist.h" #include "prclist.h"
class nsIDocShell; class nsIDocShell;
@ -34,7 +30,6 @@ class nsSHistory final : public PRCList,
{ {
public: public:
nsSHistory(); nsSHistory();
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSISHISTORY NS_DECL_NSISHISTORY
NS_DECL_NSISHISTORYINTERNAL NS_DECL_NSISHISTORYINTERNAL
@ -56,15 +51,18 @@ protected:
friend class nsSHEnumerator; friend class nsSHEnumerator;
friend class nsSHistoryObserver; friend class nsSHistoryObserver;
// Could become part of nsIWebNavigation // Could become part of nsIWebNavigation
NS_IMETHOD GetTransactionAtIndex(int32_t aIndex, nsISHTransaction ** aResult); NS_IMETHOD GetTransactionAtIndex(int32_t aIndex, nsISHTransaction** aResult);
nsresult CompareFrames(nsISHEntry * prevEntry, nsISHEntry * nextEntry, nsIDocShell * rootDocShell, long aLoadType, bool * aIsFrameFound); nsresult CompareFrames(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
nsresult InitiateLoad(nsISHEntry * aFrameEntry, nsIDocShell * aFrameDS, long aLoadType); nsIDocShell* aRootDocShell, long aLoadType,
bool* aIsFrameFound);
nsresult InitiateLoad(nsISHEntry* aFrameEntry, nsIDocShell* aFrameDS,
long aLoadType);
NS_IMETHOD LoadEntry(int32_t aIndex, long aLoadType, uint32_t histCmd); NS_IMETHOD LoadEntry(int32_t aIndex, long aLoadType, uint32_t aHistCmd);
#ifdef DEBUG #ifdef DEBUG
nsresult PrintHistory(); nsresult PrintHistory();
#endif #endif
// Evict content viewers in this window which don't lie in the "safe" range // Evict content viewers in this window which don't lie in the "safe" range
@ -79,7 +77,9 @@ protected:
void RemoveDynEntries(int32_t aOldIndex, int32_t aNewIndex); void RemoveDynEntries(int32_t aOldIndex, int32_t aNewIndex);
nsresult LoadNextPossibleEntry(int32_t aNewIndex, long aLoadType, uint32_t aHistCmd); nsresult LoadNextPossibleEntry(int32_t aNewIndex, long aLoadType,
uint32_t aHistCmd);
protected: protected:
// aIndex is the index of the transaction which may be removed. // aIndex is the index of the transaction which may be removed.
// If aKeepNext is true, aIndex is compared to aIndex + 1, // If aKeepNext is true, aIndex is compared to aIndex + 1,
@ -93,29 +93,27 @@ protected:
// Session History listeners // Session History listeners
nsAutoTObserverArray<nsWeakPtr, 2> mListeners; nsAutoTObserverArray<nsWeakPtr, 2> mListeners;
// Weak reference. Do not refcount this. // Weak reference. Do not refcount this.
nsIDocShell * mRootDocShell; nsIDocShell* mRootDocShell;
// Max viewers allowed total, across all SHistory objects // Max viewers allowed total, across all SHistory objects
static int32_t sHistoryMaxTotalViewers; static int32_t sHistoryMaxTotalViewers;
}; };
//*****************************************************************************
//*** nsSHEnumerator: Object Management
//*****************************************************************************
class nsSHEnumerator : public nsISimpleEnumerator class nsSHEnumerator : public nsISimpleEnumerator
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR NS_DECL_NSISIMPLEENUMERATOR
explicit nsSHEnumerator(nsSHistory * aHistory); explicit nsSHEnumerator(nsSHistory* aHistory);
protected: protected:
friend class nsSHistory; friend class nsSHistory;
virtual ~nsSHEnumerator(); virtual ~nsSHEnumerator();
private: private:
int32_t mIndex; int32_t mIndex;
nsSHistory * mSHistory; nsSHistory* mSHistory;
}; };
#endif /* nsSHistory */ #endif /* nsSHistory */