зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1497014 - Part 1: Pass in a URI hint for all content blocking state notifications r=baku
Differential Revision: https://phabricator.services.mozilla.com/D9984 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7d9df9b0ec
Коммит
25048d2d01
|
@ -5297,6 +5297,8 @@ nsGlobalWindowOuter::NotifyContentBlockingState(unsigned aState,
|
|||
bool aBlocked,
|
||||
nsIURI* aURIHint)
|
||||
{
|
||||
MOZ_ASSERT(aURIHint);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = GetDocShell();
|
||||
if (!docShell) {
|
||||
return;
|
||||
|
@ -5326,10 +5328,8 @@ nsGlobalWindowOuter::NotifyContentBlockingState(unsigned aState,
|
|||
}
|
||||
securityUI->GetState(&state);
|
||||
nsAutoString origin;
|
||||
origin.SetIsVoid(true);
|
||||
if (aURIHint) {
|
||||
nsContentUtils::GetUTFOrigin(aURIHint, origin);
|
||||
}
|
||||
nsContentUtils::GetUTFOrigin(aURIHint, origin);
|
||||
|
||||
bool unblocked = false;
|
||||
if (aState == nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT) {
|
||||
doc->SetHasTrackingContentBlocked(aBlocked, origin);
|
||||
|
|
|
@ -1094,8 +1094,8 @@ public:
|
|||
virtual void
|
||||
NotifyContentBlockingState(unsigned aState,
|
||||
nsIChannel* aChannel,
|
||||
bool aBlocked = true,
|
||||
nsIURI* aURIHint = nullptr) = 0;
|
||||
bool aBlocked,
|
||||
nsIURI* aURIHint) = 0;
|
||||
|
||||
// WebIDL-ish APIs
|
||||
void MarkUncollectableForCCGeneration(uint32_t aGeneration)
|
||||
|
|
|
@ -923,17 +923,17 @@ nsChannelClassifier::SetBlockedContent(nsIChannel *channel,
|
|||
nsCOMPtr<nsIDocument> doc = docShell->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
unsigned state;
|
||||
if (aErrorCode == NS_ERROR_TRACKING_URI) {
|
||||
state = nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT;
|
||||
} else {
|
||||
state = nsIWebProgressListener::STATE_BLOCKED_UNSAFE_CONTENT;
|
||||
}
|
||||
pwin->NotifyContentBlockingState(state, channel);
|
||||
pwin->NotifyContentBlockingState(state, channel, true, uri);
|
||||
|
||||
// Log a warning to the web console.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
NS_ConvertUTF8toUTF16 spec(uri->GetSpecOrDefault());
|
||||
const char16_t* params[] = { spec.get() };
|
||||
const char* message = (aErrorCode == NS_ERROR_TRACKING_URI) ?
|
||||
|
|
Загрузка…
Ссылка в новой задаче