Skip to content

[BUG] Firefox webworker's console messages are reported twice #6001

Closed

Description

Context:

  System:
    OS: macOS 11.2.1
    Memory: 346.17 MB / 32.00 GB
  Binaries:
    Node: 15.12.0 - ~/.nvm/versions/node/v15.12.0/bin/node
    npm: 7.6.3 - ~/.nvm/versions/node/v15.12.0/bin/npm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    playwright: ^1.10.0 => 1.10.0 

Code Snippet

Repro repo: https://github.com/achingbrain/playwright-ff-webworkers

$ git clone https://github.com/achingbrain/playwright-ff-webworkers.git
$ cd playwright-ff-webworkers
$ npm i
$ npm start

> [email protected] start
> node .

globalThis in worker is JSHandle@object
globalThis in worker is [object DedicatedWorkerGlobalScope]

Describe the bug

When running webworker code in Firefox, it appears to get run twice, see the linked repo above for more details and a runnable example.

  • Only seems to affect Firefox run via playwright, running the same page in standalone Firefox or Chrome works as expected
  • Happens when loading a page via file:// or via a webserver

Activity

  1. achingbrain commented on Mar 30, 2021

    @achingbrain
    Author

    It could just be the console event getting fired twice, rather than the whole worker running twice?

  2. pavelfeldman commented on Mar 30, 2021

    @pavelfeldman
    Member

    Thanks for the repro!

    Yes, that's the same message printed twice: once from the worker itself and once from the page that owns the worker:

    pw:protocol ◀ RECV {"method":"Page.dispatchMessageFromWorker","params":{"workerId":"8a646122-5c21-e140-8dfa-d978e751c86b","message":"{\"method\":\"Runtime.console\",\"params\":{\"args\":[{\"value\":\"globalThis in worker is\"},{\"objectId\":\"id-2\",\"type\":\"object\"}],\"type\":\"info\",\"executionContextId\":\"id-1\",\"location\":{\"lineNumber\":1,\"columnNumber\":8,\"url\":\"http://localhost:5000/worker.js\"}}}"},"sessionId":"9ecfb2d5-2c78-8e47-94e4-b407f7156e4a"} +2ms
    console message
    globalThis in worker is JSHandle@object
    pw:protocol ◀ RECV {"method":"Runtime.console","params":{"args":[{"value":"globalThis in worker is"},{"value":"[object DedicatedWorkerGlobalScope]"}],"type":"info","executionContextId":"id-5","location":{"lineNumber":1,"columnNumber":8,"url":"http://localhost:5000/worker.js"}},"sessionId":"9ecfb2d5-2c78-8e47-94e4-b407f7156e4a"} +7ms
    

    Note that workers aren't supposed to work when running off file://.

  3. changed the title [-][BUG] Firefox webworkers get run twice[/-] [+][BUG] Firefox webworker's console messages are reported twice[/+] on Mar 30, 2021
  4. added 5 commits that reference this issue on Apr 1, 2021
    924c66c
    ac9f377
    dc77b4d
    cb15603
    63e16b4
  5. added a commit that references this issue on Apr 2, 2021
    4da2d6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions