mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-09 16:52:00 +01:00
Fix exception thrown in spoof-css
in Firefox
Related feedback: https://github.com/uBlockOrigin/uAssets/issues/25358#issuecomment-2358278979
This commit is contained in:
parent
62d74d4f1d
commit
11c3a16036
1 changed files with 10 additions and 10 deletions
|
@ -1524,9 +1524,9 @@ function proxyApplyFn(
|
||||||
apply(target, thisArg, args) {
|
apply(target, thisArg, args) {
|
||||||
return handler(new proxyApplyFn.ApplyContext(target, thisArg, args));
|
return handler(new proxyApplyFn.ApplyContext(target, thisArg, args));
|
||||||
},
|
},
|
||||||
get(target, prop, receiver) {
|
get(target, prop) {
|
||||||
if ( prop === 'toString' ) { return toString; }
|
if ( prop === 'toString' ) { return toString; }
|
||||||
return Reflect.get(target, prop, receiver);
|
return Reflect.get(target, prop);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if ( fn.prototype?.constructor === fn ) {
|
if ( fn.prototype?.constructor === fn ) {
|
||||||
|
@ -3109,11 +3109,11 @@ function alertBuster() {
|
||||||
apply: function(a) {
|
apply: function(a) {
|
||||||
console.info(a);
|
console.info(a);
|
||||||
},
|
},
|
||||||
get(target, prop, receiver) {
|
get(target, prop) {
|
||||||
if ( prop === 'toString' ) {
|
if ( prop === 'toString' ) {
|
||||||
return target.toString.bind(target);
|
return target.toString.bind(target);
|
||||||
}
|
}
|
||||||
return Reflect.get(target, prop, receiver);
|
return Reflect.get(target, prop);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3836,7 +3836,7 @@ function spoofCSS(
|
||||||
const targetElements = new WeakSet(document.querySelectorAll(selector));
|
const targetElements = new WeakSet(document.querySelectorAll(selector));
|
||||||
if ( targetElements.has(args[0]) === false ) { return style; }
|
if ( targetElements.has(args[0]) === false ) { return style; }
|
||||||
const proxiedStyle = new Proxy(style, {
|
const proxiedStyle = new Proxy(style, {
|
||||||
get(target, prop, receiver) {
|
get(target, prop) {
|
||||||
if ( typeof target[prop] === 'function' ) {
|
if ( typeof target[prop] === 'function' ) {
|
||||||
if ( prop === 'getPropertyValue' ) {
|
if ( prop === 'getPropertyValue' ) {
|
||||||
return cloackFunc(function getPropertyValue(prop) {
|
return cloackFunc(function getPropertyValue(prop) {
|
||||||
|
@ -3848,7 +3848,7 @@ function spoofCSS(
|
||||||
if ( instanceProperties.includes(prop) ) {
|
if ( instanceProperties.includes(prop) ) {
|
||||||
return Reflect.get(target, prop);
|
return Reflect.get(target, prop);
|
||||||
}
|
}
|
||||||
return spoofStyle(prop, Reflect.get(target, prop, receiver));
|
return spoofStyle(prop, Reflect.get(target, prop));
|
||||||
},
|
},
|
||||||
getOwnPropertyDescriptor(target, prop) {
|
getOwnPropertyDescriptor(target, prop) {
|
||||||
if ( propToValueMap.has(prop) ) {
|
if ( propToValueMap.has(prop) ) {
|
||||||
|
@ -3864,11 +3864,11 @@ function spoofCSS(
|
||||||
});
|
});
|
||||||
return proxiedStyle;
|
return proxiedStyle;
|
||||||
},
|
},
|
||||||
get(target, prop, receiver) {
|
get(target, prop) {
|
||||||
if ( prop === 'toString' ) {
|
if ( prop === 'toString' ) {
|
||||||
return target.toString.bind(target);
|
return target.toString.bind(target);
|
||||||
}
|
}
|
||||||
return Reflect.get(target, prop, receiver);
|
return Reflect.get(target, prop);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Element.prototype.getBoundingClientRect = new Proxy(Element.prototype.getBoundingClientRect, {
|
Element.prototype.getBoundingClientRect = new Proxy(Element.prototype.getBoundingClientRect, {
|
||||||
|
@ -3887,11 +3887,11 @@ function spoofCSS(
|
||||||
}
|
}
|
||||||
return new self.DOMRect(rect.x, rect.y, width, height);
|
return new self.DOMRect(rect.x, rect.y, width, height);
|
||||||
},
|
},
|
||||||
get(target, prop, receiver) {
|
get(target, prop) {
|
||||||
if ( prop === 'toString' ) {
|
if ( prop === 'toString' ) {
|
||||||
return target.toString.bind(target);
|
return target.toString.bind(target);
|
||||||
}
|
}
|
||||||
return Reflect.get(target, prop, receiver);
|
return Reflect.get(target, prop);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue