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

Comments

Projects
None yet
3 participants
@yanivefraim
Copy link
Contributor

commented Jun 18, 2018

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

This comment has been minimized.

Copy link

commented Jun 18, 2018

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

This comment has been minimized.

Copy link

commented Jun 18, 2018

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

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2018

@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

This comment has been minimized.

Copy link
Contributor

commented Jun 23, 2018

@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
You can’t perform that action at this time.