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

request.abort() doesn't work for stylesheet in v.1.7.0 #3089

Closed
ozgur-yalcin opened this issue Aug 15, 2018 · 2 comments
Closed

request.abort() doesn't work for stylesheet in v.1.7.0 #3089

ozgur-yalcin opened this issue Aug 15, 2018 · 2 comments
Assignees

Comments

@ozgur-yalcin
Copy link

Puppeteer version: 1.7.0
Platform / OS version: Win10
Node.js version: 9.4.0
Chromium Version: r579032

request.abort() works on image but doesn't work for stylesheet.

For example:

var puppeteer = require('puppeteer');
(async () => {
    const browser = await puppeteer.launch({
        headless: false,
        userDataDir: "profile",
        ignoreHTTPSErrors: true,
        dumpio: true,
        args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu']
    });
    const page = await browser.newPage();
    await page.setCacheEnabled(false);
    await page.setRequestInterception(true);
    await page.on('request', request => {
        if ((request.resourceType() === 'image') || (request.resourceType() === 'stylesheet')) {
            request.abort();
        } else {
            request.continue();
        }
    });
    await page.goto('http://www.milas.bel.tr/index.php?modul=2_16&ID=1246', {
            waitUntil: ['networkidle0', 'load', 'domcontentloaded'],
            timeout: 10000
        })
        .then(async () => {
            //something
        })
        .catch(async (error) => {
            console.log(error);
            await browser.close();
        });
    await browser.close();
})();

Above code returns

"Error: Navigation Timeout Exceeded: 10000ms exceeded"

@aslushnikov
Copy link
Contributor

The core issue here is that for certain requests (POST requests that got redirected with 302) DevTools protocol reports unmatching requestWillBeSent and requestIntercepted events; that's a bug in devtools protocol.

Interestingly this is broken in different way for both NetworkService and non-NetworkService instrumentation. The NetworkService part was regressed back in february: https://chromium-review.googlesource.com/c/chromium/src/+/861952

We'll need to fix this upstream; we'll likely fix this for NetworkService instrumentation only since that's the upcoming future.

@aslushnikov
Copy link
Contributor

Closing this in favor of #3471

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

No branches or pull requests

2 participants