mirror of https://github.com/gorhill/uBlock.git
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
|
@ -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 New Issue