-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up internal loops in
console
and pageerror
event handlers
Both the `console` and `pageerror` events are only passed a single argument by Puppeteer. For the `console` the loop made it seem like the event handler args are related to the `console.log()` args, but this wasn't the case since the single "msg" object represents the call overall, not one argument. Also update the documentation to not document a `stackTrace` argument as this did not actually exist. When `pageerror` is given an Error object, as it usually is, it may have a trace property, however, but there seems to be no such argument. The good thing is that when Puppeteer emits `pageerror`, it already serialised and re-created the Error object within Node.js, thus it can be cleanly used and stringified in a useful manner by other code. (Unlike when e.g. an Error object is passed to `console.error()`, because "console" arguments are merely JSHandle references that have to be asynchronously evaluated back via the browser to format as a string. This would be nice to improve..., but that's for another time.) This commit should be a no-op.
- Loading branch information
Showing
3 changed files
with
27 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters