Skip to content

Commit

Permalink
Rename urltransform to uritransform
Browse files Browse the repository at this point in the history
Related commit:
uBlockOrigin/uAssets@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.
  • Loading branch information
gorhill committed Dec 8, 2023
1 parent 01ce24e commit cdc5e89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/js/static-filtering-parser.js
Expand Up @@ -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 ],
Expand Down Expand Up @@ -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', { } ],
Expand Down
14 changes: 7 additions & 7 deletions src/js/static-net-filtering.js
Expand Up @@ -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.
Expand Down Expand Up @@ -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 ],
]);

Expand All @@ -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' ],
]);

Expand Down Expand Up @@ -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, '' ],
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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([
Expand Down

0 comments on commit cdc5e89

Please sign in to comment.