fix: custom script may listen to mutationIdle

This commit is contained in:
Yanlong Wang 2025-03-12 18:15:06 +08:00
parent f7dbadffb7
commit 8121d62324
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37

View File

@ -619,9 +619,6 @@ export class CrawlerOptions extends AutoCastable {
if ((this.respondWith.includes('vlm') || this.respondWith.includes('screenshot')) && !snapshot.screenshot) { if ((this.respondWith.includes('vlm') || this.respondWith.includes('screenshot')) && !snapshot.screenshot) {
return false; return false;
} }
if (this.respondTiming === RESPOND_TIMING.MUTATION_IDLE && snapshot.lastMutationIdle) {
return true;
}
if (this.respondTiming === RESPOND_TIMING.RESOURCE_IDLE && snapshot.lastContentResourceLoaded) { if (this.respondTiming === RESPOND_TIMING.RESOURCE_IDLE && snapshot.lastContentResourceLoaded) {
const now = Date.now(); const now = Date.now();
if ((snapshot.lastContentResourceLoaded + 500) < now) { if ((snapshot.lastContentResourceLoaded + 500) < now) {
@ -629,11 +626,14 @@ export class CrawlerOptions extends AutoCastable {
} }
} }
if (this.injectFrameScript?.length || this.injectPageScript?.length) {
return false;
}
if (this.respondTiming === RESPOND_TIMING.NETWORK_IDLE) { if (this.respondTiming === RESPOND_TIMING.NETWORK_IDLE) {
return false; return false;
} }
if (this.injectFrameScript?.length || this.injectPageScript?.length) { if (this.respondTiming === RESPOND_TIMING.MUTATION_IDLE && snapshot.lastMutationIdle) {
return false; return true;
} }
if (this.respondWith.includes('lm')) { if (this.respondWith.includes('lm')) {
return false; return false;