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.goto hangs, never returning #9196

Closed
jribbens opened this issue Oct 31, 2022 · 4 comments
Closed

[Bug]: page.goto hangs, never returning #9196

jribbens opened this issue Oct 31, 2022 · 4 comments

Comments

@jribbens
Copy link

Bug description

Steps to reproduce the problem:

  1. page.setRequestInterception(true)
  2. Add a request handler which calls request.continue() on the first request it sees but request.abort() on the second.
  3. page.goto() a page which says <script>window.location = 'something'
  4. puppeteer loads the first page, that request is allowed, it then tries to load the second page, that request is aborted, page.goto hangs forever and never returns.

Sample code to reproduce:

'use strict'

const puppeteer = require('puppeteer')

async function test () {
  const browser = await puppeteer.launch()
  const context = await browser.createIncognitoBrowserContext()
  const page = await context.newPage()
  await page.setRequestInterception(true)
  page.on('request', (request) => {
    const url = new URL(request.url())
    if (request.isInterceptResolutionHandled()) return
    if (request.isNavigationRequest() &&
        request.frame() === page.mainFrame() &&
        url.pathname === '/') {
      console.log(`aborting ${url}`)
      request.abort('aborted', 0)
    } else {
      console.log(`allowing ${url.href}`)
      request.continue(request.continueRequestOverrides(), 0)
    }
  })
  console.log('requesting page')
  // the following URL contains "<script>window.location='/'</script>"
  await page.goto('https://unequivocal.eu/location.html')
  console.log('page loaded')
  await context.close()
  await browser.close()
}

test()

Puppeteer version

19.2.0

Node.js version

16.14.0

npm version

8.3.1

What operating system are you seeing the problem on?

Linux, Windows

Configuration file

No response

Relevant log output

requesting page
allowing https://unequivocal.eu/location.html
aborting https://unequivocal.eu/
... hangs ...
@jribbens jribbens added the bug label Oct 31, 2022
@jribbens
Copy link
Author

Doing request.continue({ url: 'data,' }, 0) as an alternative method of 'aborting' the request also causes a hang. But request.continue({ method: 'HEAD' }, 0) doesn't hang.

@OrKoN
Copy link
Collaborator

OrKoN commented Nov 2, 2022

It looks to be the same as #9175 Could you please confirm?

@jribbens
Copy link
Author

jribbens commented Nov 2, 2022

It looks like it almost certainly is, yes. It will be proven when 19.2.1 is released, if it fixes my problem ;-)

@jribbens
Copy link
Author

jribbens commented Nov 2, 2022

Can confirm that 19.2.1 fixes this issue, thanks.

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