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

Web Worker errors are not collected by page.on('pageerror'... #2761

Closed
yanivefraim opened this issue Jun 18, 2018 · 4 comments · Fixed by #2795
Closed

Web Worker errors are not collected by page.on('pageerror'... #2761

yanivefraim opened this issue Jun 18, 2018 · 4 comments · Fixed by #2795

Comments

@yanivefraim
Copy link
Contributor

When an error occures on a Web Worker, it is not collected by page.on('pageerror'... event.

For example:

const puppeteer = require('puppeteer');
(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  page.on('pageerror', message => console.log(message));

  await page.setContent(`<!DOCTYPE html>
  <script id="worker1" type="javascript/worker">
    throw new Error('this is my error');
  </script>
  <script>
    const blob = new Blob([
      document.querySelector('#worker1').textContent
    ], { type: "text/javascript" })

    new Worker(window.URL.createObjectURL(blob));
  </script>`);
})()
@TomasHubelbauer
Copy link

I think this might be related to #1921 and in turn #2350, which was closed a month ago, but I am not sure if it was released yet.

@TomasHubelbauer
Copy link

However the WebWorker class doesn't seem to expose any events, you can only get it's URL and execution context and I am not sure if it is possible to catch errors thrown in execution contexts…

@yanivefraim
Copy link
Contributor Author

@TomasHubelbauer - yes, exactly. So this issue was closed, although the requirement for:

can issue requests, so worker.on('request') should be available as well

wasn't implemented.

@aslushnikov - can we reopen #2350?

plus, is this supported by the CDP?

@aslushnikov
Copy link
Contributor

@aslushnikov - can we reopen #2350?

@yanivefraim there's a separate issue for network in workers: #2781

plus, is this supported by the CDP?

Yes, we need to handle the Runtime.exceptionThrown event in WebWorkers.

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

Successfully merging a pull request may close this issue.

3 participants