Bug 1654257 - change isImage filter to detect images with wrong MIME. r=bomsy
authorcolin_czb <colin.cazabet@gmail.com>
Thu, 30 Sep 2021 15:56:14 +0000
changeset 593835 9b8d6651d55063c53ce68e114678592b1d66b483
parent 593834 26c136e9503990f8ad0003a3f57150101a164f9f
child 593836 355ed0fa92c3026c842e1990bbf9df48b297001e
push id38835
push userncsoregi@mozilla.com
push dateThu, 30 Sep 2021 21:50:26 +0000
treeherdermozilla-central@45cb924ad91f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbomsy
bugs1654257
milestone94.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1654257 - change isImage filter to detect images with wrong MIME. r=bomsy Differential Revision: https://phabricator.services.mozilla.com/D126620
devtools/client/netmonitor/src/utils/filter-predicates.js
--- a/devtools/client/netmonitor/src/utils/filter-predicates.js
+++ b/devtools/client/netmonitor/src/utils/filter-predicates.js
@@ -48,18 +48,24 @@ function isFont({ url, mimeType }) {
     (mimeType && (mimeType.includes("font/") || mimeType.includes("/font"))) ||
     url.includes(".eot") ||
     url.includes(".ttf") ||
     url.includes(".otf") ||
     url.includes(".woff")
   );
 }
 
-function isImage({ mimeType }) {
-  return mimeType && mimeType.includes("image/");
+function isImage({ mimeType, cause }) {
+  // We check cause.type so anything loaded via "img", "imageset", "lazy-img", etc. is in the right category
+  // When mimeType is not set to "image/", we still "detect" the image with cause.type (Bug-1654257)
+  return (
+    mimeType?.includes("image/") ||
+    cause?.type.includes("img") ||
+    cause?.type.includes("image")
+  );
 }
 
 function isMedia({ mimeType }) {
   // Not including images.
   return (
     mimeType &&
     (mimeType.includes("audio/") ||
       mimeType.includes("video/") ||