fine: stop worrying about the global environment

This commit is contained in:
yanlong.wang 2025-02-24 11:31:38 +08:00
parent a2f810cce6
commit 6335c526ec
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37

View File

@ -223,23 +223,7 @@ const MUTATION_IDLE_WATCH = `
})();
`;
const DONT_MESS_WITH_THE_FUNDAMENTALS = `
(()=> {
const fnToStringDesc = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
Object.defineProperty(Function.prototype, 'toString', {
get: ()=> fnToStringDesc.value,
set: ()=> 'Dont mess with this',
writeable: true,
configurable: true,
enumerable: false,
});
})();
delete Function.prototype.bind.apply;
delete Function.prototype.bind.call;
`;
const SCRIPT_TO_INJECT_INTO_FRAME = `
${DONT_MESS_WITH_THE_FUNDAMENTALS}
${READABILITY_JS}
${SIMULATE_SCROLL}
${MUTATION_IDLE_WATCH}
@ -510,7 +494,7 @@ export class PuppeteerControl extends AsyncService {
}
this.browser = await puppeteer.launch({
timeout: 10_000,
headless: true,
headless: false,
executablePath: process.env.OVERRIDE_CHROME_EXECUTABLE_PATH,
args: ['--disable-dev-shm-usage']
}).catch((err: any) => {