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
Родитель 1c8872b6c4
Коммит e174a94605
27 изменённых файлов: 676 добавлений и 770 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -970,7 +970,8 @@ nsDefaultURIFixup::KeywordURIFixup(const nsACString& aURIString,
// 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:
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
(foundDots == 2 || foundDots == 3) &&
// and they should be all that came before now:

Просмотреть файл

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

Просмотреть файл

@ -89,9 +89,6 @@ class nsIURILoader;
class nsIWebBrowserFind;
class nsIWidget;
/* load commands were moved to nsIDocShell.h */
/* load types were moved to nsDocShellLoadTypes.h */
/* internally used ViewMode types */
enum ViewMode
{
@ -99,10 +96,6 @@ enum ViewMode
viewSource = 0x1
};
//*****************************************************************************
//*** nsRefreshTimer
//*****************************************************************************
class nsRefreshTimer : public nsITimerCallback
{
public:
@ -130,10 +123,6 @@ enum eCharsetReloadState
eCharsetReloadStopOrigional
};
//*****************************************************************************
//*** nsDocShell
//*****************************************************************************
class nsDocShell final
: public nsDocLoader
, public nsIDocShell
@ -159,7 +148,7 @@ class nsDocShell final
public:
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsDocShell)
// Object Management
nsDocShell();
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
@ -186,7 +175,8 @@ public:
NS_DECL_NSINETWORKINTERCEPTCONTROLLER
NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager())
NS_IMETHOD Stop() override {
NS_IMETHOD Stop() override
{
// Need this here because otherwise nsIWebNavigation::Stop
// overrides the docloader's Stop()
return nsDocLoader::Stop();
@ -219,7 +209,7 @@ public:
nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType);
uint32_t ConvertDocShellLoadInfoToLoadType(
nsDocShellInfoLoadType aDocShellLoadType);
nsDocShellInfoLoadType aDocShellLoadType);
// Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods
// are shared with nsIDocShell (appID, etc.) and can't be declared twice.
@ -237,10 +227,10 @@ public:
// Restores a cached presentation from history (mLSHE).
// 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();
// 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
// the timer involved out of mRefreshURIList if it's there.
// aTimer must not be null.
@ -269,8 +259,7 @@ public:
// Add new profile timeline markers to this docShell. This will only add
// markers if the docShell is currently recording profile timeline markers.
// See nsIDocShell::recordProfileTimelineMarkers
void AddProfileTimelineMarker(const char* aName,
TracingMetadata aMetaData);
void AddProfileTimelineMarker(const char* aName, TracingMetadata aMetaData);
void AddProfileTimelineMarker(mozilla::UniquePtr<TimelineMarker>&& aMarker);
// Global counter for how many docShells are currently recording profile
@ -283,13 +272,12 @@ public:
bool aInPrivateBrowsing);
protected:
// Object Management
virtual ~nsDocShell();
virtual void DestroyChildren() override;
// Content Viewer Management
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.
nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
nsIURI* aBaseURI,
@ -307,16 +295,16 @@ protected:
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
// 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
// resulting principal. If aConsiderCurrentDocument is false, we just look
// resulting principal. If aConsiderCurrentDocument is false, we just look
// at the parent.
nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument);
// 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
// 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
// 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,
// 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
// FireOnLocationChange is called.
// 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.
// If OnNewURI calls AddToSessionHistory, it will pass its
// aCloneSHChildren argument as aCloneChildren.
@ -376,10 +364,10 @@ protected:
// Session History
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.
// 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
// the new session history entry.
nsresult AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
@ -399,7 +387,7 @@ protected:
// Clone a session history tree for subframe navigation.
// The tree rooted at |aSrcEntry| will be cloned into |aDestEntry|, except
// 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
// have that pointer updated to point to the cloned history entry.
// If aCloneChildren is true then the children of the entry with id
@ -430,7 +418,7 @@ protected:
void SwapHistoryEntries(nsISHEntry* aOldEntry, nsISHEntry* aNewEntry);
// 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.
void SetHistoryEntry(nsCOMPtr<nsISHEntry>* aPtr, nsISHEntry* aEntry);
@ -448,7 +436,7 @@ protected:
void* aData);
// 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.
static nsresult WalkHistoryEntries(nsISHEntry* aRootEntry,
nsDocShell* aRootShell,
@ -477,7 +465,7 @@ protected:
* channel.
*
* 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
* The channel we are transitioning to
@ -506,7 +494,7 @@ protected:
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.
*
* The IHistory API maintains chains of visits, tracking both HTTP referrers
@ -514,7 +502,7 @@ protected:
* the previous URI in the chain.
*
* 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.
*
* @pre aURI is not null.
@ -583,13 +571,13 @@ protected:
nsresult aResult);
// 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.
nsresult SetDocCurrentStateObj(nsISHEntry* aShEntry);
nsresult CheckLoadingPermissions();
// Security checks to prevent frameset spoofing. See comments at
// Security checks to prevent frameset spoofing. See comments at
// implementation sites.
static bool CanAccessItem(nsIDocShellTreeItem* aTargetItem,
nsIDocShellTreeItem* aAccessingItem,
@ -610,33 +598,33 @@ protected:
// in session history.
// mContentViewer points to the current content viewer associated with
// this docshell. When loading a new document, the content viewer is
// either destroyed or stored into a session history entry. To make sure
// this docshell. When loading a new document, the content viewer is
// either destroyed or stored into a session history entry. To make sure
// that destruction happens in a controlled fashion, a given content viewer
// is always owned in exactly one of these ways:
// 1) The content viewer is active and owned by a docshell's
// mContentViewer.
// 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
// 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
// the window object.
// 3) The content viewer is cached in session history. The nsISHEntry
// has the only owning reference to the content viewer. The viewer
// 3) The content viewer is cached in session history. The nsISHEntry
// has the only owning reference to the content viewer. The viewer
// has released its nsISHEntry pointer to prevent circular ownership.
//
// 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.
// (mContentViewer is put into session history as described above, if
// applicable).
// 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.
// |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
// has not been created yet. |aNewDocument| should be the document that will
// replace the current document.
@ -662,7 +650,7 @@ protected:
int32_t* aHeight);
// 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.
bool IsOKToLoadURI(nsIURI* aURI);
@ -680,7 +668,7 @@ protected:
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();
// Check if we have an app redirect registered for the URI and redirect if
@ -788,7 +776,7 @@ protected:
nsCOMPtr<nsISHEntry> mLSHE;
// 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.
nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
@ -801,9 +789,9 @@ protected:
// Secure browser UI object
nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
// The URI we're currently loading. This is only relevant during the
// firing of a pagehide/unload. The caller of FirePageHideNotification()
// is responsible for setting it and unsetting it. It may be null if the
// The URI we're currently loading. This is only relevant during the
// firing of a pagehide/unload. The caller of FirePageHideNotification()
// 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
// new URI.
nsCOMPtr<nsIURI> mLoadingURI;
@ -824,11 +812,11 @@ protected:
nsCOMPtr<nsIChannel> mMixedContentChannel;
// 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.
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
mozilla::dom::EventTarget* mChromeEventHandler; //Weak Reference
mozilla::dom::EventTarget* mChromeEventHandler; // Weak Reference
eCharsetReloadState mCharsetReloadState;
@ -842,7 +830,7 @@ protected:
int32_t mMarginWidth;
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.
int32_t mItemType;
@ -910,7 +898,7 @@ protected:
void RecomputeCanExecuteScripts();
// 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.
bool mFiredUnloadEvent;
@ -957,7 +945,7 @@ protected:
FrameType mFrameType;
// 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
// docshell hierarchy.
//

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -4,7 +4,6 @@
* 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/. */
// Local Includes
#include "nsDocShellLoadInfo.h"
#include "nsISHEntry.h"
#include "nsIInputStream.h"
@ -12,10 +11,6 @@
#include "nsIDocShell.h"
#include "mozilla/net/ReferrerPolicy.h"
//*****************************************************************************
//*** nsDocShellLoadInfo: Object Management
//*****************************************************************************
nsDocShellLoadInfo::nsDocShellLoadInfo()
: mInheritOwner(false)
, mOwnerIsExplicit(false)
@ -30,10 +25,6 @@ nsDocShellLoadInfo::~nsDocShellLoadInfo()
{
}
//*****************************************************************************
// nsDocShellLoadInfo::nsISupports
//*****************************************************************************
NS_IMPL_ADDREF(nsDocShellLoadInfo)
NS_IMPL_RELEASE(nsDocShellLoadInfo)
@ -42,10 +33,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo)
NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo)
NS_INTERFACE_MAP_END
//*****************************************************************************
// nsDocShellLoadInfo::nsIDocShellLoadInfo
//*****************************************************************************
NS_IMETHODIMP
nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer)
{

Просмотреть файл

@ -27,8 +27,8 @@
* above 0xffff (e.g. LOAD_FLAGS_BYPASS_CLASSIFIER), since MAKE_LOAD_TYPE would
* just shift them out anyway.
*/
#define EXTRA_LOAD_FLAGS (LOAD_FLAGS_FIRST_LOAD | \
LOAD_FLAGS_ALLOW_POPUPS | \
#define EXTRA_LOAD_FLAGS (LOAD_FLAGS_FIRST_LOAD | \
LOAD_FLAGS_ALLOW_POPUPS | \
0xffff0000)
/* 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
* 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!
};

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -9,20 +9,16 @@
#include "nsISupports.h"
#include "nsCharsetSource.h"
// Interface ID for nsIWebShellServices
/* 0c628af0-5638-4703-8f99-ed6134c9de18 */
#define NS_IWEB_SHELL_SERVICES_IID \
{ 0x0c628af0, 0x5638, 0x4703, {0x8f, 0x99, 0xed, 0x61, 0x34, 0xc9, 0xde, 0x18} }
//----------------------------------------------------------------------
class nsIWebShellServices : public nsISupports
{
public:
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;
NS_IMETHOD StopDocumentLoad(void) = 0;
};

Просмотреть файл

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

Просмотреть файл

@ -7,8 +7,7 @@
#ifndef nsDocShellCID_h__
#define nsDocShellCID_h__
#define NS_GLOBALHISTORY2_CONTRACTID \
"@mozilla.org/browser/global-history;2"
#define NS_GLOBALHISTORY2_CONTRACTID "@mozilla.org/browser/global-history;2"
/**
* A contract for a service that will track download history. This can be
@ -17,16 +16,14 @@
*
* @implements nsIDownloadHistory
*/
#define NS_DOWNLOADHISTORY_CONTRACTID \
"@mozilla.org/browser/download-history;1"
#define NS_DOWNLOADHISTORY_CONTRACTID "@mozilla.org/browser/download-history;1"
/**
* A contract that can be used to get a service that provides
* meta-information about nsIWebNavigation objects' capabilities.
* @implements nsIWebNavigationInfo
*/
#define NS_WEBNAVIGATION_INFO_CONTRACTID \
"@mozilla.org/webnavigation-info;1"
#define NS_WEBNAVIGATION_INFO_CONTRACTID "@mozilla.org/webnavigation-info;1"
/**
* 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
* documented.
*/
#define NS_DOCSHELL_CID \
{ 0xf1eac762, 0x87e9, 0x11d3, \
{ 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
#define NS_DOCSHELL_CID \
{ 0xf1eac762, 0x87e9, 0x11d3, \
{ 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
#define NS_DOCSHELL_CONTRACTID "@mozilla.org/docshell/html;1"
/**
@ -51,7 +48,8 @@
*
* @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

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsLocalHandlerApp.h"
#ifdef MOZ_ENABLE_DBUS
#include "nsDBusHandlerApp.h"
#endif
#endif
#if defined(MOZ_WIDGET_ANDROID)
#include "nsExternalSharingAppService.h"
#include "nsExternalURLHandlerService.h"
@ -81,7 +81,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsOfflineCacheUpdate)
NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t)
#ifdef MOZ_ENABLE_DBUS
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp)
#endif
#endif
#if defined(MOZ_WIDGET_ANDROID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalSharingAppService)
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_DOWNLOADHISTORY_CID);
const mozilla::Module::CIDEntry kDocShellCIDs[] = {
{ &kNS_DOCSHELL_CID, false, nullptr, nsDocShellConstructor },
{ &kNS_DEFAULTURIFIXUP_CID, false, nullptr, nsDefaultURIFixupConstructor },

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -4,80 +4,66 @@
* 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/. */
// Local Includes
#include "nsSHTransaction.h"
#include "nsISHEntry.h"
//*****************************************************************************
//*** nsSHTransaction: Object Management
//*****************************************************************************
nsSHTransaction::nsSHTransaction() : mPersist(true), mPrev(nullptr)
nsSHTransaction::nsSHTransaction()
: mPersist(true)
, mPrev(nullptr)
{
}
nsSHTransaction::~nsSHTransaction()
{
}
//*****************************************************************************
// nsSHTransaction: nsISupports
//*****************************************************************************
NS_IMPL_ADDREF(nsSHTransaction)
NS_IMPL_RELEASE(nsSHTransaction)
NS_INTERFACE_MAP_BEGIN(nsSHTransaction)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction)
NS_INTERFACE_MAP_ENTRY(nsISHTransaction)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHTransaction)
NS_INTERFACE_MAP_ENTRY(nsISHTransaction)
NS_INTERFACE_MAP_END
//*****************************************************************************
// nsSHTransaction: nsISHTransaction
//*****************************************************************************
NS_IMETHODIMP
nsSHTransaction::Create(nsISHEntry* aSHEntry, nsISHTransaction* aPrev)
{
SetSHEntry(aSHEntry);
if(aPrev)
aPrev->SetNext(this);
SetSHEntry(aSHEntry);
if (aPrev) {
aPrev->SetNext(this);
}
SetPrev(aPrev);
return NS_OK;
SetPrev(aPrev);
return NS_OK;
}
NS_IMETHODIMP
nsSHTransaction::GetSHEntry(nsISHEntry ** aResult)
nsSHTransaction::GetSHEntry(nsISHEntry** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mSHEntry;
NS_IF_ADDREF(*aResult);
return NS_OK;
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mSHEntry;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsSHTransaction::SetSHEntry(nsISHEntry * aSHEntry)
nsSHTransaction::SetSHEntry(nsISHEntry* aSHEntry)
{
mSHEntry = aSHEntry;
return NS_OK;
mSHEntry = aSHEntry;
return NS_OK;
}
NS_IMETHODIMP
nsSHTransaction::GetNext(nsISHTransaction * * aResult)
nsSHTransaction::GetNext(nsISHTransaction** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mNext;
NS_IF_ADDREF(*aResult);
return NS_OK;
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mNext;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsSHTransaction::SetNext(nsISHTransaction * aNext)
nsSHTransaction::SetNext(nsISHTransaction* aNext)
{
if (aNext) {
NS_ENSURE_SUCCESS(aNext->SetPrev(this), NS_ERROR_FAILURE);
@ -88,34 +74,34 @@ nsSHTransaction::SetNext(nsISHTransaction * aNext)
}
NS_IMETHODIMP
nsSHTransaction::SetPrev(nsISHTransaction * aPrev)
nsSHTransaction::SetPrev(nsISHTransaction* aPrev)
{
/* This is weak reference to parent. Do not Addref it */
mPrev = aPrev;
return NS_OK;
/* This is weak reference to parent. Do not Addref it */
mPrev = aPrev;
return NS_OK;
}
nsresult
nsSHTransaction::GetPrev(nsISHTransaction ** aResult)
nsSHTransaction::GetPrev(nsISHTransaction** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mPrev;
NS_IF_ADDREF(*aResult);
return NS_OK;
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mPrev;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsSHTransaction::SetPersist(bool aPersist)
{
mPersist = aPersist;
return NS_OK;
mPersist = aPersist;
return NS_OK;
}
NS_IMETHODIMP
nsSHTransaction::GetPersist(bool* aPersist)
{
NS_ENSURE_ARG_POINTER(aPersist);
NS_ENSURE_ARG_POINTER(aPersist);
*aPersist = mPersist;
return NS_OK;
*aPersist = mPersist;
return NS_OK;
}

Просмотреть файл

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

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

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