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

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

Closed
achingbrain opened this issue Mar 30, 2021 · 2 comments · Fixed by #6052
Closed

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

achingbrain opened this issue Mar 30, 2021 · 2 comments · Fixed by #6052
Assignees

Comments

@achingbrain
Copy link

achingbrain commented Mar 30, 2021

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

> playwright-ff-webworkers@1.0.0 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
@achingbrain
Copy link
Author

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

@pavelfeldman
Copy link
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://.

@pavelfeldman pavelfeldman changed the title [BUG] Firefox webworkers get run twice [BUG] Firefox webworker's console messages are reported twice Mar 30, 2021
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Apr 1, 2021
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Apr 1, 2021
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Apr 1, 2021
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Apr 2, 2021
aslushnikov added a commit that referenced this issue Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants