fix(stealth): avoid matchMedia Illegal invocation

- bind MediaQueryList methods when proxied for prefers-color-scheme light patch

- add regression test for addEventListener/removeEventListener

- bump version to 0.14.0-fork.6 and sync Cargo metadata
This commit is contained in:
leeguooooo
2026-02-28 11:17:02 +09:00
parent 74910cfef1
commit bf672ee7f9
5 changed files with 21 additions and 5 deletions
+6 -2
View File
@@ -856,9 +856,13 @@ function patchPrefersColorSchemeHeuristic(): string {
const patchMediaQueryList = (mql) => {
if (!mql || typeof mql !== 'object') return mql;
return new Proxy(mql, {
get(target, prop, receiver) {
get(target, prop) {
if (prop === 'matches') return false;
return Reflect.get(target, prop, receiver);
const value = Reflect.get(target, prop, target);
if (typeof value === 'function') {
return value.bind(target);
}
return value;
},
});
};