From e09c64eaf8ed32f0ab3c26138220ba8468684c2f Mon Sep 17 00:00:00 2001 From: Jacob Sikorski Date: Thu, 14 Dec 2023 12:58:37 -0500 Subject: [PATCH] Fix brave/brave-ios#8561: Fix issue with stats script sending empty image sources (brave/brave-ios#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 4270c082ec1a..f563ef6d9b87 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);