Rename `urltransform` to `uritransform`

Related commit:
https://github.com/uBlockOrigin/uAssets/commit/20312c2178

To work around incompatibity with `urltransform` in 1.53.0.
With this commit support for `urltransform` is dropped in
favor of `uritransform`. Since `uritransform` won't be parsed
by older versions of uBO, the change in syntax for `urltransform`
between 1.53.0 and 1.54.0 will no longer cause issue.
This commit is contained in:
Raymond Hill 2023-12-08 10:07:11 -05:00
parent 01ce24eea2
commit cdc5e89f52
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 9 additions and 9 deletions

View File

@ -273,7 +273,7 @@ export const nodeTypeFromOptionName = new Map([
[ 'shide', NODE_TYPE_NET_OPTION_NAME_SHIDE ],
/* synonym */ [ 'specifichide', NODE_TYPE_NET_OPTION_NAME_SHIDE ],
[ 'to', NODE_TYPE_NET_OPTION_NAME_TO ],
[ 'urltransform', NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM ],
[ 'uritransform', NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM ],
[ 'xhr', NODE_TYPE_NET_OPTION_NAME_XHR ],
/* synonym */ [ 'xmlhttprequest', NODE_TYPE_NET_OPTION_NAME_XHR ],
[ 'webrtc', NODE_TYPE_NET_OPTION_NAME_WEBRTC ],
@ -3081,7 +3081,7 @@ export const netOptionTokenDescriptors = new Map([
[ 'shide', { } ],
/* synonym */ [ 'specifichide', { } ],
[ 'to', { mustAssign: true } ],
[ 'urltransform', { mustAssign: true } ],
[ 'uritransform', { mustAssign: true } ],
[ 'xhr', { canNegate: true } ],
/* synonym */ [ 'xmlhttprequest', { canNegate: true } ],
[ 'webrtc', { } ],

View File

@ -71,7 +71,7 @@ const keyvalStore = typeof vAPI !== 'undefined'
// ||||+---------------- bit 12: removeparam filters
// |||+----------------- bit 13: csp filters
// ||+------------------ bit 14: permissions filters
// |+------------------- bit 15: urltransform filters
// |+------------------- bit 15: uritransform filters
// +-------------------- bit 16: replace filters
// TODO: bit 11-16 can be converted into 3-bit value, as these options are not
// meant to be combined.
@ -217,7 +217,7 @@ const modifierTypeFromName = new Map([
[ 'removeparam', MODIFIER_TYPE_REMOVEPARAM ],
[ 'csp', MODIFIER_TYPE_CSP ],
[ 'permissions', MODIFIER_TYPE_PERMISSIONS ],
[ 'urltransform', MODIFIER_TYPE_URLTRANSFORM ],
[ 'uritransform', MODIFIER_TYPE_URLTRANSFORM ],
[ 'replace', MODIFIER_TYPE_REPLACE ],
]);
@ -227,7 +227,7 @@ const modifierNameFromType = new Map([
[ MODIFIER_TYPE_REMOVEPARAM, 'removeparam' ],
[ MODIFIER_TYPE_CSP, 'csp' ],
[ MODIFIER_TYPE_PERMISSIONS, 'permissions' ],
[ MODIFIER_TYPE_URLTRANSFORM, 'urltransform' ],
[ MODIFIER_TYPE_URLTRANSFORM, 'uritransform' ],
[ MODIFIER_TYPE_REPLACE, 'replace' ],
]);
@ -4378,7 +4378,7 @@ FilterContainer.prototype.dnrFromCompiled = function(op, context, ...args) {
[ REMOVEPARAM_REALM, 'removeparam' ],
[ CSP_REALM, 'csp' ],
[ PERMISSIONS_REALM, 'permissions' ],
[ URLTRANSFORM_REALM, 'urltransform' ],
[ URLTRANSFORM_REALM, 'uritransform' ],
]);
const partyness = new Map([
[ ANYPARTY_REALM, '' ],
@ -4570,7 +4570,7 @@ FilterContainer.prototype.dnrFromCompiled = function(op, context, ...args) {
dnrAddRuleError(rule, `Unsupported removeparam exception: ${rule.__modifierValue}`);
}
break;
case 'urltransform': {
case 'uritransform': {
const path = rule.__modifierValue;
let priority = rule.priority || 1;
if ( rule.__modifierAction !== ALLOW_REALM ) {
@ -5297,7 +5297,7 @@ FilterContainer.prototype.redirectRequest = function(redirectEngine, fctxt) {
};
FilterContainer.prototype.transformRequest = function(fctxt) {
const directives = this.matchAndFetchModifiers(fctxt, 'urltransform');
const directives = this.matchAndFetchModifiers(fctxt, 'uritransform');
if ( directives === undefined ) { return; }
const directive = directives[directives.length-1];
if ( (directive.bits & ALLOW_REALM) !== 0 ) { return directives; }
@ -5584,7 +5584,7 @@ FilterContainer.prototype.dump = function() {
[ REMOVEPARAM_REALM, 'removeparam' ],
[ CSP_REALM, 'csp' ],
[ PERMISSIONS_REALM, 'permissions' ],
[ URLTRANSFORM_REALM, 'urltransform' ],
[ URLTRANSFORM_REALM, 'uritransform' ],
[ REPLACE_REALM, 'replace' ],
]);
const partyness = new Map([