question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConsoleMessage type and text not interoperable between Chrome and Firefox

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 5.2.0
  • Platform / OS version: macOS 10.15.5
  • Node.js version: v10.16.3

What steps will reproduce the problem?

Please include code that reproduces the issue.

'use strict';

const puppeteer = require('puppeteer');

async function main() {
  for (const product of ['chrome', 'firefox']) {
    const browser = await puppeteer.launch({product});
    const page = await browser.newPage();
    await page.goto('about:blank');
    const msgPromise = new Promise((resolve) => {
      page.on('console', resolve);
    });
    await page.evaluate('console.log("message")');
    const msg = await msgPromise;
    console.log({
      product,
      type: msg.type(),
      text: msg.text(),
      args: msg.args(),
    });
    await browser.close();
  }
}

main();

Output from running the above is:

{ product: 'chrome',
  type: 'log',
  text: 'message',
  args:
   [ JSHandle {
       _disposed: false,
       _context: [ExecutionContext],
       _client: [CDPSession],
       _remoteObject: [Object] } ] }
{ product: 'firefox',
  type: 'verbose',
  text: [ 'message' ],
  args: [] }

What is the expected result?

The msg.type() and msg.text() should be the same for Chrome and Firefox, to make it possible to use console messages without switching on which product is under test.

What happens instead?

  • Chrome: msg.type() is “log” and msg.text() is “message”.
  • Firefox: msg.type() is “verbose” and msg.text() is an array with a single item “message”

msg.args() is also different, but I don’t know what it should be, and am not using it myself.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
whimboocommented, Jun 24, 2022

Just checked and there is no difference anymore between Chrome and Firefox. Both output the following:

{
  product: 'test',
  type: 'log',
  text: 'message',
  args: [ JSHandle {} ]
}
0reactions
foolipcommented, Jun 26, 2022

Thanks @whimboo!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Console messages — Firefox Source Docs documentation
Console messages¶. Most of the Web Console is occupied by the message display pane: Screenshot of the web console, highlighting the messages area....
Read more >
471020 - Add X-Content-Type-Options: nosniff support to Firefox
It has no Content-Type and we still parse it as HTML. ... is that there's already interoperability problems with this header between IE...
Read more >
console - Web APIs - MDN Web Docs
Chrome Edge Firefox console Full support. Chrome1. Toggle history Full support. Edge12. Toggle history Full s... assert Full support. Chrome1. Toggle history Full support. Edge12....
Read more >
1423098 - Remove support for SMIL's accessKey feature
Issues with the layout or rendering of SVG content and interacting with the SVG DOM. Example bugs: SVG marker can not be clipped...
Read more >
Display alerts for SameSite cookie changes in the developer ...
The messages should not have any interoperability or compatibility risk. ... the output of the messages, resulting in a text diff from the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found