mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1069669 - Add a nsContentUtils::IsInPrivateBrowsing function. r=ehsan
This commit is contained in:
parent
2d57e241bc
commit
a7d967d228
@ -690,6 +690,11 @@ public:
|
||||
bool aIsForWindow,
|
||||
uint32_t *aArgCount, const char*** aArgNames);
|
||||
|
||||
/**
|
||||
* Returns true if this document is in a Private Browsing window.
|
||||
*/
|
||||
static bool IsInPrivateBrowsing(nsIDocument* aDoc);
|
||||
|
||||
/**
|
||||
* If aNode is not an element, return true exactly when aContent's binding
|
||||
* parent is null.
|
||||
|
@ -2923,11 +2923,13 @@ nsContentUtils::CanLoadImage(nsIURI* aURI, nsISupports* aContext,
|
||||
return NS_FAILED(rv) ? false : NS_CP_ACCEPTED(decision);
|
||||
}
|
||||
|
||||
imgLoader*
|
||||
nsContentUtils::GetImgLoaderForDocument(nsIDocument* aDoc)
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::IsInPrivateBrowsing(nsIDocument* aDoc)
|
||||
{
|
||||
if (!aDoc)
|
||||
return imgLoader::Singleton();
|
||||
if (!aDoc) {
|
||||
return false;
|
||||
}
|
||||
bool isPrivate = false;
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = aDoc->GetDocumentLoadGroup();
|
||||
nsCOMPtr<nsIInterfaceRequestor> callbacks;
|
||||
@ -2941,6 +2943,16 @@ nsContentUtils::GetImgLoaderForDocument(nsIDocument* aDoc)
|
||||
nsCOMPtr<nsIChannel> channel = aDoc->GetChannel();
|
||||
isPrivate = channel && NS_UsePrivateBrowsing(channel);
|
||||
}
|
||||
return isPrivate;
|
||||
}
|
||||
|
||||
imgLoader*
|
||||
nsContentUtils::GetImgLoaderForDocument(nsIDocument* aDoc)
|
||||
{
|
||||
if (!aDoc) {
|
||||
return imgLoader::Singleton();
|
||||
}
|
||||
bool isPrivate = IsInPrivateBrowsing(aDoc);
|
||||
return isPrivate ? imgLoader::PBSingleton() : imgLoader::Singleton();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user