зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472087 - Remove nsDocShellLoadInfo::LoadTypes; r=nika
We have 2 different LoadType enums with two different values, which have to be converted between depending on whether we're going to/from LoadInfo/nsISHEntry/etc. We should be able to just use the same enum everywhere and not have to deal with conversion, especially since we don't have any type safety around the enum. MozReview-Commit-ID: 2t9vVGLpOte
This commit is contained in:
Родитель
7bbabca468
Коммит
5e51176ffa
|
@ -709,9 +709,8 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
|||
originalURI = aLoadInfo->OriginalURI();
|
||||
aLoadInfo->GetMaybeResultPrincipalURI(resultPrincipalURI);
|
||||
loadReplace = aLoadInfo->LoadReplace();
|
||||
nsDocShellLoadInfo::nsDocShellInfoLoadType lt = aLoadInfo->LoadType();
|
||||
// Get the appropriate loadType from nsIDocShellLoadInfo type
|
||||
loadType = ConvertDocShellInfoLoadTypeToLoadType(lt);
|
||||
loadType = aLoadInfo->LoadType();
|
||||
|
||||
triggeringPrincipal = aLoadInfo->TriggeringPrincipal();
|
||||
inheritPrincipal = aLoadInfo->InheritPrincipal();
|
||||
|
@ -3715,21 +3714,19 @@ nsDocShell::GetChildSHEntry(int32_t aChildOffset, nsISHEntry** aResult)
|
|||
/* Get the parent's Load Type so that it can be set on the child too.
|
||||
* By default give a loadHistory value
|
||||
*/
|
||||
uint32_t loadType = nsDocShellLoadInfo::loadHistory;
|
||||
uint32_t loadType = LOAD_HISTORY;
|
||||
mLSHE->GetLoadType(&loadType);
|
||||
// If the user did a shift-reload on this frameset page,
|
||||
// we don't want to load the subframes from history.
|
||||
if (loadType == nsDocShellLoadInfo::loadReloadBypassCache ||
|
||||
loadType == nsDocShellLoadInfo::loadReloadBypassProxy ||
|
||||
loadType == nsDocShellLoadInfo::loadReloadBypassProxyAndCache ||
|
||||
loadType == nsDocShellLoadInfo::loadRefresh) {
|
||||
if (IsForceReloadType(loadType) ||
|
||||
loadType == LOAD_REFRESH) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* If the user pressed reload and the parent frame has expired
|
||||
* from cache, we do not want to load the child frame from history.
|
||||
*/
|
||||
if (parentExpired && (loadType == nsDocShellLoadInfo::loadReloadNormal)) {
|
||||
if (parentExpired && (loadType == LOAD_RELOAD_NORMAL)) {
|
||||
// The parent has expired. Return null.
|
||||
*aResult = nullptr;
|
||||
return rv;
|
||||
|
@ -4230,10 +4227,10 @@ nsDocShell::LoadURIWithOptions(const char16_t* aURI,
|
|||
loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
|
||||
}
|
||||
|
||||
loadInfo->SetLoadType(ConvertLoadTypeToDocShellInfoLoadType(loadType));
|
||||
loadInfo->SetLoadType(loadType);
|
||||
loadInfo->SetPostDataStream(postStream);
|
||||
loadInfo->SetReferrer(aReferringURI);
|
||||
loadInfo->SetReferrerPolicy(aReferrerPolicy);
|
||||
loadInfo->SetReferrerPolicy((mozilla::net::ReferrerPolicy)aReferrerPolicy);
|
||||
loadInfo->SetHeadersStream(aHeaderStream);
|
||||
loadInfo->SetBaseURI(aBaseURI);
|
||||
loadInfo->SetTriggeringPrincipal(aTriggeringPrincipal);
|
||||
|
@ -6211,7 +6208,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
|
|||
* we have in mind (15000 ms as defined by REFRESH_REDIRECT_TIMER).
|
||||
* Pass a REPLACE flag to LoadURI().
|
||||
*/
|
||||
loadInfo->SetLoadType(nsDocShellLoadInfo::loadNormalReplace);
|
||||
loadInfo->SetLoadType(LOAD_NORMAL_REPLACE);
|
||||
|
||||
/* for redirects we mimic HTTP, which passes the
|
||||
* original referrer
|
||||
|
@ -6222,7 +6219,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
|
|||
loadInfo->SetReferrer(internalReferrer);
|
||||
}
|
||||
} else {
|
||||
loadInfo->SetLoadType(nsDocShellLoadInfo::loadRefresh);
|
||||
loadInfo->SetLoadType(LOAD_REFRESH);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7074,7 +7071,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
|||
// onLoadHandler tries to load something different in
|
||||
// itself or one of its children, we can deal with it appropriately.
|
||||
if (mLSHE) {
|
||||
mLSHE->SetLoadType(nsDocShellLoadInfo::loadHistory);
|
||||
mLSHE->SetLoadType(LOAD_HISTORY);
|
||||
|
||||
// Clear the mLSHE reference to indicate document loading is done one
|
||||
// way or another.
|
||||
|
@ -9413,7 +9410,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
// Set up our loadinfo so it will do the load as much like we would have
|
||||
// as possible.
|
||||
loadInfo->SetReferrer(aReferrer);
|
||||
loadInfo->SetReferrerPolicy(aReferrerPolicy);
|
||||
loadInfo->SetReferrerPolicy((mozilla::net::ReferrerPolicy)aReferrerPolicy);
|
||||
loadInfo->SetSendReferrer(!(aFlags &
|
||||
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER));
|
||||
loadInfo->SetOriginalURI(aOriginalURI);
|
||||
|
@ -9425,7 +9422,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
// Explicit principal because we do not want any guesses as to what the
|
||||
// principal to inherit is: it should be aTriggeringPrincipal.
|
||||
loadInfo->SetPrincipalIsExplicit(true);
|
||||
loadInfo->SetLoadType(ConvertLoadTypeToDocShellInfoLoadType(LOAD_LINK));
|
||||
loadInfo->SetLoadType(LOAD_LINK);
|
||||
loadInfo->SetForceAllowDataURI(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI);
|
||||
|
||||
rv = win->Open(NS_ConvertUTF8toUTF16(spec),
|
||||
|
@ -10940,7 +10937,7 @@ nsDocShell::DoChannelLoad(nsIChannel* aChannel,
|
|||
|
||||
// If the user pressed shift-reload, then do not allow ServiceWorker
|
||||
// interception to occur. See step 12.1 of the SW HandleFetch algorithm.
|
||||
if (IsForceReloadType(mLoadType)) {
|
||||
if (IsForceReloading()) {
|
||||
loadFlags |= nsIChannel::LOAD_BYPASS_SERVICE_WORKER;
|
||||
}
|
||||
|
||||
|
@ -14196,3 +14193,9 @@ nsDocShell::GetColorMatrix(uint32_t* aMatrixLen, float** aMatrix)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocShell::IsForceReloading()
|
||||
{
|
||||
return IsForceReloadType(mLoadType);
|
||||
}
|
||||
|
|
|
@ -375,6 +375,10 @@ public:
|
|||
return static_cast<nsDocShell*>(aDocShell);
|
||||
}
|
||||
|
||||
// Returns true if the current load is a force reload (started by holding
|
||||
// shift while triggering reload)
|
||||
bool IsForceReloading();
|
||||
|
||||
private: // member functions
|
||||
friend class nsDSURIContentListener;
|
||||
friend class FramingChecker;
|
||||
|
|
|
@ -27,7 +27,7 @@ nsDocShellLoadInfo::nsDocShellLoadInfo()
|
|||
, mOriginalFrameSrc(false)
|
||||
, mSendReferrer(true)
|
||||
, mReferrerPolicy(mozilla::net::RP_Unset)
|
||||
, mLoadType(nsDocShellLoadInfo::loadNormal)
|
||||
, mLoadType(LOAD_NORMAL)
|
||||
, mIsSrcdocLoad(false)
|
||||
{
|
||||
}
|
||||
|
@ -156,14 +156,14 @@ nsDocShellLoadInfo::SetOriginalFrameSrc(bool aOriginalFrameSrc)
|
|||
mOriginalFrameSrc = aOriginalFrameSrc;
|
||||
}
|
||||
|
||||
nsDocShellLoadInfo::nsDocShellInfoLoadType
|
||||
uint32_t
|
||||
nsDocShellLoadInfo::LoadType() const
|
||||
{
|
||||
return mLoadType;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocShellLoadInfo::SetLoadType(nsDocShellLoadInfo::nsDocShellInfoLoadType aLoadType)
|
||||
nsDocShellLoadInfo::SetLoadType(uint32_t aLoadType)
|
||||
{
|
||||
mLoadType = aLoadType;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// Helper Classes
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsDocShellLoadTypes.h"
|
||||
|
||||
class nsIInputStream;
|
||||
class nsISHEntry;
|
||||
|
@ -19,34 +20,6 @@ class nsIDocShell;
|
|||
class nsDocShellLoadInfo
|
||||
{
|
||||
public:
|
||||
typedef uint32_t nsDocShellInfoLoadType;
|
||||
|
||||
enum LoadType: uint32_t {
|
||||
loadNormal = 0, // Normal Load
|
||||
loadNormalReplace = 1, // Normal Load but replaces current history slot
|
||||
loadHistory = 2, // Load from history
|
||||
loadReloadNormal = 3, // Reload
|
||||
loadReloadBypassCache = 4,
|
||||
loadReloadBypassProxy = 5,
|
||||
loadReloadBypassProxyAndCache = 6,
|
||||
loadLink = 7,
|
||||
loadRefresh = 8,
|
||||
loadReloadCharsetChange = 9,
|
||||
loadBypassHistory = 10,
|
||||
loadStopContent = 11,
|
||||
loadStopContentAndReplace = 12,
|
||||
loadNormalExternal = 13,
|
||||
loadNormalBypassCache = 14,
|
||||
loadNormalBypassProxy = 15,
|
||||
loadNormalBypassProxyAndCache = 16,
|
||||
loadPushState = 17, // history.pushState or replaceState
|
||||
loadReplaceBypassCache = 18,
|
||||
loadReloadMixedContent = 19,
|
||||
loadNormalAllowMixedContent = 20,
|
||||
loadReloadCharsetChangeBypassCache = 21,
|
||||
loadReloadCharsetChangeBypassProxyAndCache = 22
|
||||
};
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsDocShellLoadInfo);
|
||||
|
||||
nsDocShellLoadInfo();
|
||||
|
@ -91,9 +64,9 @@ public:
|
|||
|
||||
void SetOriginalFrameSrc(bool aOriginalFrameSrc);
|
||||
|
||||
nsDocShellInfoLoadType LoadType() const;
|
||||
uint32_t LoadType() const;
|
||||
|
||||
void SetLoadType(nsDocShellInfoLoadType aLoadType);
|
||||
void SetLoadType(uint32_t aLoadType);
|
||||
|
||||
nsISHEntry* SHEntry() const;
|
||||
|
||||
|
@ -155,7 +128,7 @@ protected:
|
|||
bool mOriginalFrameSrc;
|
||||
bool mSendReferrer;
|
||||
mozilla::net::ReferrerPolicy mReferrerPolicy;
|
||||
nsDocShellInfoLoadType mLoadType;
|
||||
uint32_t mLoadType;
|
||||
nsCOMPtr<nsISHEntry> mSHEntry;
|
||||
nsString mTarget;
|
||||
nsCOMPtr<nsIInputStream> mPostDataStream;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
* Remember to update the IsValidLoadType function below if you change this
|
||||
* enum to ensure bad flag combinations will be rejected.
|
||||
*/
|
||||
enum LoadType
|
||||
enum LoadType : uint32_t
|
||||
{
|
||||
LOAD_NORMAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_NONE),
|
||||
LOAD_NORMAL_REPLACE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY),
|
||||
|
@ -75,6 +75,18 @@ enum LoadType
|
|||
// NOTE: Adding a new value? Remember to update IsValidLoadType!
|
||||
};
|
||||
|
||||
static inline bool
|
||||
IsForceReloadType(uint32_t aLoadType) {
|
||||
switch (aLoadType) {
|
||||
case LOAD_RELOAD_BYPASS_CACHE:
|
||||
case LOAD_RELOAD_BYPASS_PROXY:
|
||||
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
|
||||
case LOAD_RELOAD_ALLOW_MIXED_CONTENT:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsValidLoadType(uint32_t aLoadType)
|
||||
{
|
||||
|
@ -108,182 +120,6 @@ IsValidLoadType(uint32_t aLoadType)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsForceReloadType(uint32_t aLoadType) {
|
||||
switch (aLoadType) {
|
||||
case LOAD_RELOAD_BYPASS_CACHE:
|
||||
case LOAD_RELOAD_BYPASS_PROXY:
|
||||
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
|
||||
case LOAD_RELOAD_ALLOW_MIXED_CONTENT:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline nsDocShellLoadInfo::nsDocShellInfoLoadType
|
||||
ConvertLoadTypeToDocShellInfoLoadType(uint32_t aLoadType)
|
||||
{
|
||||
nsDocShellLoadInfo::nsDocShellInfoLoadType docShellLoadType = nsDocShellLoadInfo::loadNormal;
|
||||
switch (aLoadType) {
|
||||
case LOAD_NORMAL:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadNormal;
|
||||
break;
|
||||
case LOAD_NORMAL_REPLACE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadNormalReplace;
|
||||
break;
|
||||
case LOAD_NORMAL_EXTERNAL:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadNormalExternal;
|
||||
break;
|
||||
case LOAD_NORMAL_BYPASS_CACHE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadNormalBypassCache;
|
||||
break;
|
||||
case LOAD_NORMAL_BYPASS_PROXY:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadNormalBypassProxy;
|
||||
break;
|
||||
case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadNormalBypassProxyAndCache;
|
||||
break;
|
||||
case LOAD_NORMAL_ALLOW_MIXED_CONTENT:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadNormalAllowMixedContent;
|
||||
break;
|
||||
case LOAD_HISTORY:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadHistory;
|
||||
break;
|
||||
case LOAD_RELOAD_NORMAL:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadNormal;
|
||||
break;
|
||||
case LOAD_RELOAD_CHARSET_CHANGE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadCharsetChange;
|
||||
break;
|
||||
case LOAD_RELOAD_CHARSET_CHANGE_BYPASS_CACHE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadCharsetChangeBypassCache;
|
||||
break;
|
||||
case LOAD_RELOAD_CHARSET_CHANGE_BYPASS_PROXY_AND_CACHE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadCharsetChangeBypassProxyAndCache;
|
||||
break;
|
||||
case LOAD_RELOAD_BYPASS_CACHE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadBypassCache;
|
||||
break;
|
||||
case LOAD_RELOAD_BYPASS_PROXY:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadBypassProxy;
|
||||
break;
|
||||
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadBypassProxyAndCache;
|
||||
break;
|
||||
case LOAD_LINK:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadLink;
|
||||
break;
|
||||
case LOAD_REFRESH:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadRefresh;
|
||||
break;
|
||||
case LOAD_BYPASS_HISTORY:
|
||||
case LOAD_ERROR_PAGE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadBypassHistory;
|
||||
break;
|
||||
case LOAD_STOP_CONTENT:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadStopContent;
|
||||
break;
|
||||
case LOAD_STOP_CONTENT_AND_REPLACE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadStopContentAndReplace;
|
||||
break;
|
||||
case LOAD_PUSHSTATE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadPushState;
|
||||
break;
|
||||
case LOAD_REPLACE_BYPASS_CACHE:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReplaceBypassCache;
|
||||
break;
|
||||
case LOAD_RELOAD_ALLOW_MIXED_CONTENT:
|
||||
docShellLoadType = nsDocShellLoadInfo::loadReloadMixedContent;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected load type value");
|
||||
}
|
||||
|
||||
return docShellLoadType;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
ConvertDocShellInfoLoadTypeToLoadType(nsDocShellLoadInfo::nsDocShellInfoLoadType aDocShellLoadType)
|
||||
{
|
||||
uint32_t loadType = LOAD_NORMAL;
|
||||
|
||||
switch (aDocShellLoadType) {
|
||||
case nsDocShellLoadInfo::loadNormal:
|
||||
loadType = LOAD_NORMAL;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadNormalReplace:
|
||||
loadType = LOAD_NORMAL_REPLACE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadNormalExternal:
|
||||
loadType = LOAD_NORMAL_EXTERNAL;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadHistory:
|
||||
loadType = LOAD_HISTORY;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadNormalBypassCache:
|
||||
loadType = LOAD_NORMAL_BYPASS_CACHE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadNormalBypassProxy:
|
||||
loadType = LOAD_NORMAL_BYPASS_PROXY;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadNormalBypassProxyAndCache:
|
||||
loadType = LOAD_NORMAL_BYPASS_PROXY_AND_CACHE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadNormalAllowMixedContent:
|
||||
loadType = LOAD_NORMAL_ALLOW_MIXED_CONTENT;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadNormal:
|
||||
loadType = LOAD_RELOAD_NORMAL;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadCharsetChange:
|
||||
loadType = LOAD_RELOAD_CHARSET_CHANGE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadCharsetChangeBypassCache:
|
||||
loadType = LOAD_RELOAD_CHARSET_CHANGE_BYPASS_CACHE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadCharsetChangeBypassProxyAndCache:
|
||||
loadType = LOAD_RELOAD_CHARSET_CHANGE_BYPASS_PROXY_AND_CACHE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadBypassCache:
|
||||
loadType = LOAD_RELOAD_BYPASS_CACHE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadBypassProxy:
|
||||
loadType = LOAD_RELOAD_BYPASS_PROXY;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadBypassProxyAndCache:
|
||||
loadType = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadLink:
|
||||
loadType = LOAD_LINK;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadRefresh:
|
||||
loadType = LOAD_REFRESH;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadBypassHistory:
|
||||
loadType = LOAD_BYPASS_HISTORY;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadStopContent:
|
||||
loadType = LOAD_STOP_CONTENT;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadStopContentAndReplace:
|
||||
loadType = LOAD_STOP_CONTENT_AND_REPLACE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadPushState:
|
||||
loadType = LOAD_PUSHSTATE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReplaceBypassCache:
|
||||
loadType = LOAD_REPLACE_BYPASS_CACHE;
|
||||
break;
|
||||
case nsDocShellLoadInfo::loadReloadMixedContent:
|
||||
loadType = LOAD_RELOAD_ALLOW_MIXED_CONTENT;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected nsDocShellLoadInfo::nsDocShellInfoLoadType value");
|
||||
}
|
||||
|
||||
return loadType;
|
||||
}
|
||||
|
||||
static inline nsDOMNavigationTiming::Type
|
||||
ConvertLoadTypeToNavigationType(uint32_t aLoadType)
|
||||
{
|
||||
|
|
|
@ -346,6 +346,17 @@ interface nsISHEntry : nsISupports
|
|||
* changed once set to a non-null value.
|
||||
*/
|
||||
[noscript] attribute nsISHistory SHistory;
|
||||
|
||||
/**
|
||||
* Sets an SHEntry to reflect that it is a history type load. as
|
||||
* nsIDocShellLoadInfo and its LoadType enum were removed, this is the
|
||||
* equivalent to doing
|
||||
*
|
||||
* shEntry.loadType = 4;
|
||||
*
|
||||
* in js, but easier to maintain and less opaque.
|
||||
*/
|
||||
void setAsHistoryLoad();
|
||||
};
|
||||
|
||||
[scriptable, uuid(bb66ac35-253b-471f-a317-3ece940f04c5)]
|
||||
|
|
|
@ -453,7 +453,7 @@ nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
|
|||
mPostData = aInputStream;
|
||||
|
||||
// Set the LoadType by default to loadHistory during creation
|
||||
mLoadType = (uint32_t)nsDocShellLoadInfo::loadHistory;
|
||||
mLoadType = LOAD_HISTORY;
|
||||
|
||||
mShared->mCacheKey = aCacheKey;
|
||||
mShared->mContentType = aContentType;
|
||||
|
@ -1011,3 +1011,11 @@ nsSHEntry::SetSHistory(nsISHistory* aSHistory)
|
|||
mShared->mSHistory = shistory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetAsHistoryLoad()
|
||||
{
|
||||
// Set the LoadType by default to loadHistory during creation
|
||||
mLoadType = LOAD_HISTORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1114,7 +1114,7 @@ nsSHistory::GoBack()
|
|||
if (!canGoBack) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
return LoadEntry(mIndex - 1, nsDocShellLoadInfo::loadHistory, HIST_CMD_BACK);
|
||||
return LoadEntry(mIndex - 1, LOAD_HISTORY, HIST_CMD_BACK);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1126,27 +1126,27 @@ nsSHistory::GoForward()
|
|||
if (!canGoForward) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
return LoadEntry(mIndex + 1, nsDocShellLoadInfo::loadHistory,
|
||||
return LoadEntry(mIndex + 1, LOAD_HISTORY,
|
||||
HIST_CMD_FORWARD);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHistory::Reload(uint32_t aReloadFlags)
|
||||
{
|
||||
nsDocShellLoadInfo::nsDocShellInfoLoadType loadType;
|
||||
uint32_t loadType;
|
||||
if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY &&
|
||||
aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE) {
|
||||
loadType = nsDocShellLoadInfo::loadReloadBypassProxyAndCache;
|
||||
loadType = LOAD_RELOAD_BYPASS_PROXY_AND_CACHE;
|
||||
} else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY) {
|
||||
loadType = nsDocShellLoadInfo::loadReloadBypassProxy;
|
||||
loadType = LOAD_RELOAD_BYPASS_PROXY;
|
||||
} else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE) {
|
||||
loadType = nsDocShellLoadInfo::loadReloadBypassCache;
|
||||
loadType = LOAD_RELOAD_BYPASS_CACHE;
|
||||
} else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE) {
|
||||
loadType = nsDocShellLoadInfo::loadReloadCharsetChange;
|
||||
loadType = LOAD_RELOAD_CHARSET_CHANGE;
|
||||
} else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_MIXED_CONTENT) {
|
||||
loadType = nsDocShellLoadInfo::loadReloadMixedContent;
|
||||
loadType = LOAD_RELOAD_ALLOW_MIXED_CONTENT;
|
||||
} else {
|
||||
loadType = nsDocShellLoadInfo::loadReloadNormal;
|
||||
loadType = LOAD_RELOAD_NORMAL;
|
||||
}
|
||||
|
||||
// We are reloading. Send Reload notifications.
|
||||
|
@ -1178,7 +1178,7 @@ nsSHistory::ReloadCurrentEntry()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
return LoadEntry(mIndex, nsDocShellLoadInfo::loadHistory, HIST_CMD_RELOAD);
|
||||
return LoadEntry(mIndex, LOAD_HISTORY, HIST_CMD_RELOAD);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1194,7 +1194,7 @@ nsSHistory::RestoreToEntryAtIndex(int32_t aIndex)
|
|||
}
|
||||
|
||||
// XXX We may want to ensure docshell is currently holding about:blank
|
||||
return InitiateLoad(nextEntry, mRootDocShell, nsDocShellLoadInfo::loadHistory);
|
||||
return InitiateLoad(nextEntry, mRootDocShell, LOAD_HISTORY);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1840,7 +1840,7 @@ nsSHistory::LoadURI(const char16_t* aURI,
|
|||
NS_IMETHODIMP
|
||||
nsSHistory::GotoIndex(int32_t aIndex)
|
||||
{
|
||||
return LoadEntry(aIndex, nsDocShellLoadInfo::loadHistory, HIST_CMD_GOTOINDEX);
|
||||
return LoadEntry(aIndex, LOAD_HISTORY, HIST_CMD_GOTOINDEX);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -237,9 +237,9 @@ Location::SetURI(nsIURI* aURI, bool aReplace)
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aReplace) {
|
||||
loadInfo->SetLoadType(nsDocShellLoadInfo::loadStopContentAndReplace);
|
||||
loadInfo->SetLoadType(LOAD_STOP_CONTENT_AND_REPLACE);
|
||||
} else {
|
||||
loadInfo->SetLoadType(nsDocShellLoadInfo::loadStopContent);
|
||||
loadInfo->SetLoadType(LOAD_STOP_CONTENT);
|
||||
}
|
||||
|
||||
// Get the incumbent script's browsing context to set as source.
|
||||
|
|
|
@ -4713,11 +4713,9 @@ nsIDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||
}
|
||||
|
||||
if (!mMaybeServiceWorkerControlled && mDocumentContainer && mScriptGlobalObject && GetChannel()) {
|
||||
uint32_t loadType;
|
||||
mDocumentContainer->GetLoadType(&loadType);
|
||||
|
||||
// If we are shift-reloaded, don't associate with a ServiceWorker.
|
||||
if (IsForceReloadType(loadType)) {
|
||||
if (mDocumentContainer->IsForceReloading()) {
|
||||
NS_WARNING("Page was shift reloaded, skipping ServiceWorker control");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ ClientNavigateOpChild::DoNavigate(const ClientNavigateOpConstructorArgs& aArgs)
|
|||
|
||||
loadInfo->SetTriggeringPrincipal(principal);
|
||||
loadInfo->SetReferrerPolicy(doc->GetReferrerPolicy());
|
||||
loadInfo->SetLoadType(nsDocShellLoadInfo::loadStopContent);
|
||||
loadInfo->SetLoadType(LOAD_STOP_CONTENT);
|
||||
loadInfo->SetSourceDocShell(docShell);
|
||||
rv = docShell->LoadURI(url, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, true);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -265,7 +265,7 @@ var ViewSourceContent = {
|
|||
shEntry.setTitle(viewSrcURL);
|
||||
let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
|
||||
shEntry.triggeringPrincipal = systemPrincipal;
|
||||
shEntry.loadType = 2; /* nsDocShellLoadInfo::loadHistory */
|
||||
shEntry.setAsHistoryLoad();
|
||||
shEntry.cacheKey = shEntrySource.cacheKey;
|
||||
docShell.QueryInterface(Ci.nsIWebNavigation)
|
||||
.sessionHistory
|
||||
|
|
|
@ -343,7 +343,7 @@ var SessionHistoryInternal = {
|
|||
shEntry.setTitle(entry.title || entry.url);
|
||||
if (entry.subframe)
|
||||
shEntry.setIsSubFrame(entry.subframe || false);
|
||||
shEntry.loadType = 2; /* nsDocShellLoadInfo::loadHistory */
|
||||
shEntry.setAsHistoryLoad();
|
||||
if (entry.contentType)
|
||||
shEntry.contentType = entry.contentType;
|
||||
if (entry.referrer) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче