зеркало из https://github.com/mozilla/gecko-dev.git
Bug 909218 - add defaultLoadFlags to nsILoadGroup and have the docShell set them. r=mayhemer
This commit is contained in:
Родитель
94e78bfd55
Коммит
40f61430b5
|
@ -5379,6 +5379,14 @@ NS_IMETHODIMP
|
||||||
nsDocShell::SetDefaultLoadFlags(uint32_t aDefaultLoadFlags)
|
nsDocShell::SetDefaultLoadFlags(uint32_t aDefaultLoadFlags)
|
||||||
{
|
{
|
||||||
mDefaultLoadFlags = aDefaultLoadFlags;
|
mDefaultLoadFlags = aDefaultLoadFlags;
|
||||||
|
|
||||||
|
// Tell the load group to set these flags all requests in the group
|
||||||
|
if (mLoadGroup) {
|
||||||
|
mLoadGroup->SetDefaultLoadFlags(aDefaultLoadFlags);
|
||||||
|
} else {
|
||||||
|
NS_WARNING("nsDocShell::SetDefaultLoadFlags has no loadGroup to propagate the flags to");
|
||||||
|
}
|
||||||
|
|
||||||
// Recursively tell all of our children. We *do not* skip
|
// Recursively tell all of our children. We *do not* skip
|
||||||
// <iframe mozbrowser> children - if someone sticks custom flags in this
|
// <iframe mozbrowser> children - if someone sticks custom flags in this
|
||||||
// docShell then they too get the same flags.
|
// docShell then they too get the same flags.
|
||||||
|
|
|
@ -356,7 +356,8 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default load flags (as defined in nsIRequest) that will be set on all
|
* Default load flags (as defined in nsIRequest) that will be set on all
|
||||||
* requests made by this docShell and propagated to all child docShells.
|
* requests made by this docShell and propagated to all child docShells and
|
||||||
|
* to nsILoadGroup::defaultLoadFlags for the docShell's loadGroup.
|
||||||
* Default is no flags. Once set, only future requests initiated by the
|
* Default is no flags. Once set, only future requests initiated by the
|
||||||
* docShell are affected, so in general, these flags should be set before
|
* docShell are affected, so in general, these flags should be set before
|
||||||
* the docShell loads any content.
|
* the docShell loads any content.
|
||||||
|
|
|
@ -10,10 +10,12 @@ interface nsIRequestObserver;
|
||||||
interface nsIInterfaceRequestor;
|
interface nsIInterfaceRequestor;
|
||||||
interface nsILoadGroupConnectionInfo;
|
interface nsILoadGroupConnectionInfo;
|
||||||
|
|
||||||
|
typedef unsigned long nsLoadFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A load group maintains a collection of nsIRequest objects.
|
* A load group maintains a collection of nsIRequest objects.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(19501006-46e3-4634-b97d-26eff894b4d3)]
|
[scriptable, uuid(afb57ac2-bce5-4ee3-bb34-385089a9ba5c)]
|
||||||
interface nsILoadGroup : nsIRequest
|
interface nsILoadGroup : nsIRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -78,6 +80,19 @@ interface nsILoadGroup : nsIRequest
|
||||||
* connection blocking, and per-tab connection grouping
|
* connection blocking, and per-tab connection grouping
|
||||||
*/
|
*/
|
||||||
readonly attribute nsILoadGroupConnectionInfo connectionInfo;
|
readonly attribute nsILoadGroupConnectionInfo connectionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The set of load flags that will be added to all new requests added to
|
||||||
|
* this group. Any existing requests in the load group are not modified,
|
||||||
|
* so it is expected these flags will be added before requests are added
|
||||||
|
* to the group - typically via nsIDocShell::defaultLoadFlags on a new
|
||||||
|
* docShell.
|
||||||
|
* Note that these flags are *not* added to the default request for the
|
||||||
|
* load group; it is expected the default request will already have these
|
||||||
|
* flags (again, courtesy of setting nsIDocShell::defaultLoadFlags before
|
||||||
|
* the docShell has created the default request.)
|
||||||
|
*/
|
||||||
|
attribute nsLoadFlags defaultLoadFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
|
|
@ -115,6 +115,7 @@ RescheduleRequests(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||||
nsLoadGroup::nsLoadGroup(nsISupports* outer)
|
nsLoadGroup::nsLoadGroup(nsISupports* outer)
|
||||||
: mForegroundCount(0)
|
: mForegroundCount(0)
|
||||||
, mLoadFlags(LOAD_NORMAL)
|
, mLoadFlags(LOAD_NORMAL)
|
||||||
|
, mDefaultLoadFlags(0)
|
||||||
, mStatus(NS_OK)
|
, mStatus(NS_OK)
|
||||||
, mPriority(PRIORITY_NORMAL)
|
, mPriority(PRIORITY_NORMAL)
|
||||||
, mIsCanceling(false)
|
, mIsCanceling(false)
|
||||||
|
@ -859,6 +860,21 @@ nsLoadGroup::AdjustPriority(int32_t aDelta)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsLoadGroup::GetDefaultLoadFlags(uint32_t *aFlags)
|
||||||
|
{
|
||||||
|
*aFlags = mDefaultLoadFlags;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsLoadGroup::SetDefaultLoadFlags(uint32_t aFlags)
|
||||||
|
{
|
||||||
|
mDefaultLoadFlags = aFlags;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1039,6 +1055,9 @@ nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& outFlags
|
||||||
VALIDATE_ONCE_PER_SESSION |
|
VALIDATE_ONCE_PER_SESSION |
|
||||||
VALIDATE_NEVER));
|
VALIDATE_NEVER));
|
||||||
|
|
||||||
|
// ... and force the default flags.
|
||||||
|
flags |= mDefaultLoadFlags;
|
||||||
|
|
||||||
if (flags != oldFlags)
|
if (flags != oldFlags)
|
||||||
rv = aRequest->SetLoadFlags(flags);
|
rv = aRequest->SetLoadFlags(flags);
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ private:
|
||||||
protected:
|
protected:
|
||||||
uint32_t mForegroundCount;
|
uint32_t mForegroundCount;
|
||||||
uint32_t mLoadFlags;
|
uint32_t mLoadFlags;
|
||||||
|
uint32_t mDefaultLoadFlags;
|
||||||
|
|
||||||
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
|
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
|
||||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче