Bug 1514340 - Part 1: Add the nsISecurityEventSink::OnContentBlockingEvent() helper method; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D16051
This commit is contained in:
Ehsan Akhgari 2019-01-06 15:59:20 -05:00
Родитель 46e587fc36
Коммит 5d7e383969
3 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -5145,7 +5145,7 @@ void nsGlobalWindowOuter::NotifyContentBlockingState(unsigned aState,
return;
}
eventSink->OnSecurityChange(aChannel, state);
eventSink->OnContentBlockingEvent(aChannel, state);
}
// static

Просмотреть файл

@ -19,6 +19,15 @@ interface nsISecurityEventSink : nsISupports
*/
void onSecurityChange(in nsISupports i_Context, in unsigned long state);
/**
* Fired when a content blocking event occurs during the time
* when a document is alive. This interface should be called
* by Gecko to notify nsIWebProgressListeners that there is a
* new content blocking event. Content blocking events are in
* nsIWebProgressListeners.idl.
*/
void onContentBlockingEvent(in nsISupports i_Context, in unsigned long event);
};

Просмотреть файл

@ -1412,6 +1412,25 @@ NS_IMETHODIMP nsDocLoader::OnSecurityChange(nsISupports* aContext,
return NS_OK;
}
NS_IMETHODIMP nsDocLoader::OnContentBlockingEvent(nsISupports* aContext,
uint32_t aEvent) {
//
// Fire progress notifications out to any registered nsIWebProgressListeners.
//
nsCOMPtr<nsIRequest> request = do_QueryInterface(aContext);
nsIWebProgress* webProgress = static_cast<nsIWebProgress*>(this);
NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_SECURITY,
listener->OnSecurityChange(webProgress, request, aEvent););
// Pass the notification up to the parent...
if (mParent) {
mParent->OnContentBlockingEvent(aContext, aEvent);
}
return NS_OK;
}
/*
* Implementation of nsISupportsPriority methods...
*