Skip to content

Commit

Permalink
Make queryprune an exact alias of removeparam
Browse files Browse the repository at this point in the history
As per agreed upon discussion, `queryprune` now follows
exactly the syntax of AdGuard's `removeparam`.

Related discussion:
- uBlockOrigin/uBlock-issues#1356

Related issue:
- uBlockOrigin/uBlock-issues#760

For the short term, `queryprune` will still interpret a
leading `|` to mean "anchor to start of name", until no
such filters are present in uBO's own filter lists.
  • Loading branch information
gorhill committed Nov 30, 2020
1 parent 391a5c9 commit e08f8cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/js/static-filtering-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ const Parser = class {

static parseQueryPruneValue(arg) {
let s = arg.trim();
if ( s === '*' ) { return { all: true }; }
if ( s === '' ) { return { all: true }; }
const out = { };
out.not = s.charCodeAt(0) === 0x7E /* '~' */;
if ( out.not ) {
Expand Down Expand Up @@ -2017,7 +2017,8 @@ const OPTBlockOnly = 1 << 9;
const OPTAllowOnly = 1 << 10;
const OPTMustAssign = 1 << 11;
const OPTAllowMayAssign = 1 << 12;
const OPTDomainList = 1 << 13;
const OPTMayAssign = 1 << 13;
const OPTDomainList = 1 << 14;

//const OPTGlobalMask = 0x0fff0000;
const OPTNetworkType = 1 << 16;
Expand Down Expand Up @@ -2166,8 +2167,8 @@ const netOptionTokenDescriptors = new Map([
[ 'beacon', OPTTokenPing | OPTCanNegate | OPTNetworkType | OPTModifiableType | OPTNonCspableType | OPTNonRedirectableType ],
[ 'popunder', OPTTokenPopunder | OPTNonNetworkType | OPTNonCspableType | OPTNonRedirectableType ],
[ 'popup', OPTTokenPopup | OPTNonNetworkType | OPTCanNegate | OPTNonCspableType | OPTNonRedirectableType ],
[ 'queryprune', OPTTokenQueryprune | OPTMustAssign | OPTAllowMayAssign | OPTModifierType | OPTNonCspableType | OPTNonRedirectableType ],
[ 'removeparam', OPTTokenQueryprune | OPTMustAssign | OPTAllowMayAssign | OPTModifierType | OPTNonCspableType | OPTNonRedirectableType ],
[ 'queryprune', OPTTokenQueryprune | OPTMayAssign | OPTModifierType | OPTNonCspableType | OPTNonRedirectableType ],
[ 'removeparam', OPTTokenQueryprune | OPTMayAssign | OPTModifierType | OPTNonCspableType | OPTNonRedirectableType ],
[ 'redirect', OPTTokenRedirect | OPTMustAssign | OPTAllowMayAssign | OPTModifierType ],
[ 'redirect-rule', OPTTokenRedirectRule | OPTMustAssign | OPTAllowMayAssign | OPTModifierType | OPTNonCspableType ],
[ 'script', OPTTokenScript | OPTCanNegate | OPTNetworkType | OPTModifiableType | OPTRedirectableType | OPTNonCspableType ],
Expand Down Expand Up @@ -2387,7 +2388,7 @@ const NetOptionsIterator = class {
this.exception === false &&
hasBits(descriptor, OPTAllowOnly) ||
assigned &&
hasNoBits(descriptor, OPTMustAssign) ||
hasNoBits(descriptor, OPTMayAssign | OPTMustAssign) ||
assigned === false &&
hasBits(descriptor, OPTMustAssign) && (
this.exception === false ||
Expand Down
2 changes: 1 addition & 1 deletion src/js/static-net-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ const FilterModifier = class {
FilterModifier.fid,
details.action,
details.modifyType,
details.modifyValue
details.modifyValue || '',
];
}

Expand Down

0 comments on commit e08f8cb

Please sign in to comment.