Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: page.off("request") is messed up because of interceptCooperative mode #7675

Closed
EedoCelsius opened this issue Oct 12, 2021 · 2 comments
Labels

Comments

@EedoCelsius
Copy link

Bug description

Steps to reproduce the problem:

PAGE.JS

on(eventName, handler) {
    if (eventName === 'request') {
        return super.on(eventName, (event) => {
            event.enqueueInterceptAction(() => handler(event));
        });
    }
    return super.on(eventName, handler);
}

This is the page.on() method. Because it is overriding the handlers for events with eventName "request", the original handler is not removable by

INDEX.JS

off(type, handler) {
    const handlers = all.get(type); 
    if (handlers) {
        handlers.splice(handlers.indexOf(handler) >>> 0, 1);
    }
}

and I'm wondering what ' >>> 0' is needed for.

Puppeteer version

10.4.0

Node.js version

v14.16.0

npm version

6.14.11

What operating system are you seeing the problem on?

Windows

Relevant log output

No response

@EedoCelsius
Copy link
Author

EedoCelsius commented Oct 12, 2021

works great when

on(eventName, handler) {
    if (eventName === 'request') {
        return super.on(eventName, (event) => {
            event.enqueueInterceptAction(() => handler(event));
        });
    }
    return super.on(eventName, handler);
}

deleted from PAGE.JS (cooperative wouldn't work probably)

@jpxzp
Copy link

jpxzp commented Oct 14, 2021

fixed #7624

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants