[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.
This commit is contained in:
Raymond Hill 2025-04-25 19:26:16 -04:00
parent a56e13156f
commit ef9709fb07
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -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;
};