mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 18:08:46 -04:00
* Allow regex in blacklist fixes #167 #542 * Added protection against invalid regex causing failed initialization * Added regex input validation
This commit is contained in:

committed by
Ilya Grigorik

parent
c4a26e3da2
commit
ac7471edfc
13
inject.js
13
inject.js
@@ -275,7 +275,7 @@
|
||||
// the first element of the target, which may not be the parent.
|
||||
this.parent.insertBefore(fragment, this.parent.firstChild);
|
||||
}
|
||||
return wrapper;
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,16 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var regexp = new RegExp(escapeStringRegExp(match));
|
||||
if (match.startsWith('/')) {
|
||||
try {
|
||||
var regexp = new RegExp(match);
|
||||
} catch(err) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
var regexp = new RegExp(escapeStringRegExp(match));
|
||||
}
|
||||
|
||||
if (regexp.test(location.href)) {
|
||||
blacklisted = true;
|
||||
return;
|
||||
|
Reference in New Issue
Block a user