mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1132808 - HttpBaseChannel::GetPrincipal should return URI prinicipal r=ckerschb r=sicking
This commit is contained in:
parent
b419bff773
commit
7382cd4d4e
@ -1908,13 +1908,9 @@ HttpBaseChannel::GetEntityID(nsACString& aEntityID)
|
||||
}
|
||||
|
||||
nsIPrincipal *
|
||||
HttpBaseChannel::GetPrincipal(bool requireAppId)
|
||||
HttpBaseChannel::GetURIPrincipal()
|
||||
{
|
||||
if (mPrincipal) {
|
||||
if (requireAppId && mPrincipal->GetUnknownAppId()) {
|
||||
LOG(("HttpBaseChannel::GetPrincipal: No app id [this=%p]", this));
|
||||
return nullptr;
|
||||
}
|
||||
return mPrincipal;
|
||||
}
|
||||
|
||||
@ -1922,24 +1918,18 @@ HttpBaseChannel::GetPrincipal(bool requireAppId)
|
||||
nsContentUtils::GetSecurityManager();
|
||||
|
||||
if (!securityManager) {
|
||||
LOG(("HttpBaseChannel::GetPrincipal: No security manager [this=%p]",
|
||||
LOG(("HttpBaseChannel::GetURIPrincipal: No security manager [this=%p]",
|
||||
this));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
securityManager->GetChannelResultPrincipal(this, getter_AddRefs(mPrincipal));
|
||||
securityManager->GetChannelURIPrincipal(this, getter_AddRefs(mPrincipal));
|
||||
if (!mPrincipal) {
|
||||
LOG(("HttpBaseChannel::GetPrincipal: No channel principal [this=%p]",
|
||||
LOG(("HttpBaseChannel::GetURIPrincipal: No channel principal [this=%p]",
|
||||
this));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// principals with unknown app ids do not work with the permission manager
|
||||
if (requireAppId && mPrincipal->GetUnknownAppId()) {
|
||||
LOG(("HttpBaseChannel::GetPrincipal: No app id [this=%p]", this));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mPrincipal;
|
||||
}
|
||||
|
||||
@ -2244,7 +2234,7 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
|
||||
// Add our own principal to the redirect information on the new channel. If
|
||||
// the redirect is vetoed, then newChannel->AsyncOpen won't be called.
|
||||
// However, the new channel's redirect chain will still be complete.
|
||||
nsCOMPtr<nsIPrincipal> principal = GetPrincipal(false);
|
||||
nsCOMPtr<nsIPrincipal> principal = GetURIPrincipal();
|
||||
httpInternal->AddRedirect(principal);
|
||||
}
|
||||
|
||||
|
@ -289,10 +289,8 @@ protected:
|
||||
// Checks whether or not aURI and mOriginalURI share the same domain.
|
||||
bool SameOriginWithOriginalUri(nsIURI *aURI);
|
||||
|
||||
// GetPrincipal
|
||||
// Returns the channel principal. If requireAppId is true, then returns
|
||||
// null if the principal has unknown appId.
|
||||
nsIPrincipal *GetPrincipal(bool requireAppId);
|
||||
// GetPrincipal Returns the channel's URI principal.
|
||||
nsIPrincipal *GetURIPrincipal();
|
||||
|
||||
// Returns true if this channel should intercept the network request and prepare
|
||||
// for a possible synthesized response instead.
|
||||
|
@ -4863,7 +4863,6 @@ nsHttpChannel::BeginConnect()
|
||||
if (mLoadFlags & LOAD_CLASSIFY_URI) {
|
||||
nsCOMPtr<nsIURIClassifier> classifier = do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID);
|
||||
if (classifier) {
|
||||
nsCOMPtr<nsIPrincipal> principal = GetPrincipal(false);
|
||||
bool tp = false;
|
||||
channelClassifier->ShouldEnableTrackingProtection(this, &tp);
|
||||
// We skip speculative connections by setting mLocalBlocklist only
|
||||
@ -4872,6 +4871,7 @@ nsHttpChannel::BeginConnect()
|
||||
// since no network events will be received while the
|
||||
// nsChannelClassifier is in progress. See bug 1122691.
|
||||
if (tp) {
|
||||
nsCOMPtr<nsIPrincipal> principal = GetURIPrincipal();
|
||||
nsresult response = NS_OK;
|
||||
classifier->ClassifyLocal(principal, tp, &response);
|
||||
if (NS_FAILED(response)) {
|
||||
|
Loading…
Reference in New Issue
Block a user