summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-10-22 20:43:08 +0000
committerMoonchild <moonchild@palemoon.org>2020-10-22 20:43:08 +0000
commit3b224b2b26a553e575ebee805e3cc74c8f35e4b3 (patch)
treefb30d2def4ce7f380f9a476a0fc9eb65baf2f7ad
parent33a402947c28b35c55fae782be3a45bafa97d293 (diff)
downloadUXP-3b224b2b26a553e575ebee805e3cc74c8f35e4b3.tar
UXP-3b224b2b26a553e575ebee805e3cc74c8f35e4b3.tar.gz
UXP-3b224b2b26a553e575ebee805e3cc74c8f35e4b3.tar.lz
UXP-3b224b2b26a553e575ebee805e3cc74c8f35e4b3.tar.xz
UXP-3b224b2b26a553e575ebee805e3cc74c8f35e4b3.zip
[DOM] When failing to create a channel and an image request, make sure to set
the image blocking status appropriately. This is the same status as we do for known no-data protocols and ensures we treat these two cases the same.
-rw-r--r--dom/base/nsImageLoadingContent.cpp6
-rw-r--r--layout/reftests/image/reftest.list2
-rw-r--r--layout/reftests/image/unknown-protocol-ref.html1
-rw-r--r--layout/reftests/image/unknown-protocol.html1
4 files changed, 9 insertions, 1 deletions
diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp
index 7ddc2184b..1226ef22e 100644
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -932,8 +932,12 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
MOZ_ASSERT(!req, "Shouldn't have non-null request here");
// If we don't have a current URI, we might as well store this URI so people
// know what we tried (and failed) to load.
- if (!mCurrentRequest)
+ if (!mCurrentRequest) {
mCurrentURI = aNewURI;
+ if (mImageBlockingStatus == nsIContentPolicy::ACCEPT) {
+ mImageBlockingStatus = nsIContentPolicy::REJECT_REQUEST;
+ }
+ }
FireEvent(NS_LITERAL_STRING("error"));
FireEvent(NS_LITERAL_STRING("loadend"));
diff --git a/layout/reftests/image/reftest.list b/layout/reftests/image/reftest.list
index 1a610811d..0eddb61fc 100644
--- a/layout/reftests/image/reftest.list
+++ b/layout/reftests/image/reftest.list
@@ -126,3 +126,5 @@ fuzzy(1,1) == image-orientation-background.html?90&flip image-orientation-r
== image-resize-percent-height.html image-resize-ref.html
== image-resize-percent-width.html image-resize-ref.html
+
+== unknown-protocol.html unknown-protocol-ref.html
diff --git a/layout/reftests/image/unknown-protocol-ref.html b/layout/reftests/image/unknown-protocol-ref.html
new file mode 100644
index 000000000..b5bb326ee
--- /dev/null
+++ b/layout/reftests/image/unknown-protocol-ref.html
@@ -0,0 +1 @@
+<img src="mailto://foo">
diff --git a/layout/reftests/image/unknown-protocol.html b/layout/reftests/image/unknown-protocol.html
new file mode 100644
index 000000000..ef06881b7
--- /dev/null
+++ b/layout/reftests/image/unknown-protocol.html
@@ -0,0 +1 @@
+<img src="foobar://baz">