mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Redirect non-existing operators to a void operator
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2292 This will prevent unexpected oversezealous blocking if ever this happens again. The internal void operator will ensure no blocking takes place and issue a note about non-existing operator to the dev tools console.
This commit is contained in:
parent
a78bb0f8eb
commit
990ad75ca8
1 changed files with 9 additions and 2 deletions
|
@ -43,6 +43,14 @@ class PSelectorTask {
|
|||
}
|
||||
}
|
||||
|
||||
class PSelectorVoidTask extends PSelectorTask {
|
||||
constructor(task) {
|
||||
super();
|
||||
console.info(`uBO: :${task[0]}() operator does not exist`);
|
||||
}
|
||||
transpose() {
|
||||
}
|
||||
}
|
||||
|
||||
class PSelectorHasTextTask extends PSelectorTask {
|
||||
constructor(task) {
|
||||
|
@ -377,8 +385,7 @@ class PSelector {
|
|||
const tasks = [];
|
||||
if ( Array.isArray(o.tasks) === false ) { return; }
|
||||
for ( const task of o.tasks ) {
|
||||
const ctor = this.operatorToTaskMap.get(task[0]);
|
||||
if ( ctor === undefined ) { return; }
|
||||
const ctor = this.operatorToTaskMap.get(task[0]) || PSelectorVoidTask;
|
||||
tasks.push(new ctor(task));
|
||||
}
|
||||
// Initialize only after all tasks have been successfully instantiated
|
||||
|
|
Loading…
Reference in a new issue