summaryrefslogtreecommitdiffstats
path: root/dom/base/nsContentPolicy.cpp
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2019-08-08 16:44:51 +0300
committerwin7-7 <win7-7@users.noreply.github.com>2019-08-08 16:44:51 +0300
commitdeae241f5e3db8f9b86b98933291b9a30e28db22 (patch)
tree150ec42d7352ffd8d61dafb4397d89bcaa396d5e /dom/base/nsContentPolicy.cpp
parent5a957202b70a0b11078b0cffa8967b63baff5661 (diff)
downloadUXP-deae241f5e3db8f9b86b98933291b9a30e28db22.tar
UXP-deae241f5e3db8f9b86b98933291b9a30e28db22.tar.gz
UXP-deae241f5e3db8f9b86b98933291b9a30e28db22.tar.lz
UXP-deae241f5e3db8f9b86b98933291b9a30e28db22.tar.xz
UXP-deae241f5e3db8f9b86b98933291b9a30e28db22.zip
Convert dom/base/nsImageLoadingContent.cpp to use AsyncOpen2 and followups along with it (1445670 and 1373780 part 2 and 3)
Convert dom/base/nsImageLoadingContent.cpp to use AsyncOpen2 and followups along with it (1445670 and 1373780 part 2 and 3)
Diffstat (limited to 'dom/base/nsContentPolicy.cpp')
-rw-r--r--dom/base/nsContentPolicy.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/dom/base/nsContentPolicy.cpp b/dom/base/nsContentPolicy.cpp
index 5511b9086..534466103 100644
--- a/dom/base/nsContentPolicy.cpp
+++ b/dom/base/nsContentPolicy.cpp
@@ -22,6 +22,7 @@
#include "nsIDOMWindow.h"
#include "nsITabChild.h"
#include "nsIContent.h"
+#include "nsIImageLoadingContent.h"
#include "nsILoadContext.h"
#include "nsCOMArray.h"
#include "nsContentUtils.h"
@@ -145,6 +146,16 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
decision);
if (NS_SUCCEEDED(rv) && NS_CP_REJECTED(*decision)) {
+ // If we are blocking an image, we have to let the
+ // ImageLoadingContent know that we blocked the load.
+ if (externalType == nsIContentPolicy::TYPE_IMAGE ||
+ externalType == nsIContentPolicy::TYPE_IMAGESET) {
+ nsCOMPtr<nsIImageLoadingContent> img =
+ do_QueryInterface(requestingContext);
+ if (img) {
+ img->SetBlockedRequest(*decision);
+ }
+ }
/* policy says no, no point continuing to check */
return NS_OK;
}
@@ -193,6 +204,16 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
decision);
if (NS_SUCCEEDED(rv) && NS_CP_REJECTED(*decision)) {
+ // If we are blocking an image, we have to let the
+ // ImageLoadingContent know that we blocked the load.
+ if (externalType == nsIContentPolicy::TYPE_IMAGE ||
+ externalType == nsIContentPolicy::TYPE_IMAGESET) {
+ nsCOMPtr<nsIImageLoadingContent> img =
+ do_QueryInterface(requestingContext);
+ if (img) {
+ img->SetBlockedRequest(*decision);
+ }
+ }
/* policy says no, no point continuing to check */
return NS_OK;
}