From ef9709fb072588cd92101154503da82148429021 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 25 Apr 2025 19:26:16 -0400 Subject: [PATCH] [mv3] Safari does not support resource type `object` Need to filter out DNR rules with `object`, otherwise this causes a failure when adding the rules dynamically. --- platform/mv3/safari/ext-compat.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/mv3/safari/ext-compat.js b/platform/mv3/safari/ext-compat.js index c7f02984d..c2940e0c9 100644 --- a/platform/mv3/safari/ext-compat.js +++ b/platform/mv3/safari/ext-compat.js @@ -33,6 +33,16 @@ const nativeDNR = webext.declarativeNetRequest; const isSupportedRule = r => { if ( r.action?.responseHeaders ) { return false; } if ( r.condition?.tabIds !== undefined ) { return false; } + if ( r.condition?.resourceTypes?.includes('object') ) { + if ( r.condition.resourceTypes.length === 1 ) { return false; } + const i = r.condition.resourceTypes.indexOf('object'); + r.condition.resourceTypes.splice(i, 1); + } + if ( r.condition?.excludedResourceTypes?.includes('object') ) { + if ( r.condition.excludedResourceTypes.length === 1 ) { return false; } + const i = r.condition.excludedResourceTypes.indexOf('object'); + r.condition.excludedResourceTypes.splice(i, 1); + } return true; };