1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Stringify argument using implicit rather than explicit conversion

Reported internally by team.

Explicit conversion was causing an exception to be
thrown when the type argument was not supporting
`toString()`, for example when `type` argument was
literal `null`.
This commit is contained in:
Raymond Hill 2020-07-16 09:55:06 -04:00
parent a22d4cdd54
commit 975d894419
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -216,7 +216,7 @@
self.EventTarget.prototype.addEventListener,
{
apply: function(target, thisArg, args) {
const type = args[0].toString();
const type = String(args[0]);
const handler = String(args[1]);
if (
needle1.test(type) === false ||
@ -238,7 +238,7 @@
self.EventTarget.prototype.addEventListener,
{
apply: function(target, thisArg, args) {
const type = args[0].toString();
const type = String(args[0]);
const handler = String(args[1]);
log('uBO: addEventListener("%s", %s)', type, handler);
return target.apply(thisArg, args);