From 8dbb193bfd1200673aa62c34378441f92fe21d8e Mon Sep 17 00:00:00 2001 From: Jacob Sikorski Date: Thu, 14 Dec 2023 12:58:37 -0500 Subject: [PATCH] Fix #8561: Fix issue with stats script sending empty image sources (#8559) Fix issue with stats script sending empty image sources --- .../Scripts_Dynamic/Scripts/Paged/TrackingProtectionStats.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/Scripts/Paged/TrackingProtectionStats.js b/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/Scripts/Paged/TrackingProtectionStats.js index 4270c082ec1..f563ef6d9b8 100644 --- a/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/Scripts/Paged/TrackingProtectionStats.js +++ b/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/Scripts/Paged/TrackingProtectionStats.js @@ -120,6 +120,9 @@ window.__firefox__.execute(function($) { // If this `Image` instance fails to load, we can assume // it has been blocked. this._tpErrorHandler = $(function() { + // We don't need to send it if the src is set to "" + // (which will give us `window.location.href`) + if (this.src === window.location.href) { return } sendMessage(this.src, "image"); }); this.addEventListener("error", this._tpErrorHandler);