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] Chromium - Playwright not intercepting importScripts requests in WebWorker #6403

Closed
Meir017 opened this issue May 4, 2021 · 3 comments

Comments

@Meir017
Copy link
Contributor

Meir017 commented May 4, 2021

tl;dr

running importScripts inside a web-worker is not intercepted property with page.route

Context:

System:

  • OS: Windows 10 10.0.19042

Binaries:

  • Node: 12.13.1 - C:\Program Files\nodejs\node.EXE
  • Yarn: 1.19.1 - ~\AppData\Roaming\npm\yarn.CMD
  • npm: 6.14.2 - C:\Program Files\nodejs\npm.CMD

Languages:

  • Bash: 4.4.20 - C:\WINDOWS\system32\bash.EXE

npmPackages:

  • playwright: ^1.10.0 => 1.10.0

Code Snippet

complete reproduction - https://github.com/Meir017/playwright-worker-interception-sample

Describe the bug

running importScripts inside a web-worker is not intercepted property with page.route

this does work in firefox and webkit.
might be related to #4487

firefox output - looks like something is causing the web-worker to be loaded twice.

> node worker.demo

devtools parameter is not supported as a launch argument in Firefox. You can launch the devtools window manually.
error: [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "https://microsoft.com/main.html" line: 0}] ({"lineNumber":0,"columnNumber":0,"url":"https://microsoft.com/main.html"})
info: page fetched data: {
    "id": "playwright caught ya!"
} ({"lineNumber":19,"columnNumber":31,"url":"https://microsoft.com/main.html"})
info: importing scripts... ({"lineNumber":0,"columnNumber":8,"url":"https://microsoft.com/worker.js"})
info: importing scripts... ({"lineNumber":0,"columnNumber":8,"url":"https://microsoft.com/worker.js"})
info: "testing worker" ({"lineNumber":14,"columnNumber":20,"url":"https://microsoft.com/main.html"})
info: imported scripts... ({"lineNumber":4,"columnNumber":8,"url":"https://microsoft.com/worker.js"})
info: imported scripts... ({"lineNumber":4,"columnNumber":8,"url":"https://microsoft.com/worker.js"})
info: worker fetched data: {
    "id": "playwright caught ya!"
} ({"lineNumber":8,"columnNumber":23,"url":"https://microsoft.com/worker.js"})
info: worker fetched data: {
    "id": "playwright caught ya!"
} ({"lineNumber":8,"columnNumber":23,"url":"https://microsoft.com/worker.js"})
warn: [JavaScript Warning: "Strict-Transport-Security: The connection to the site is untrustworthy, so the specified header was ignored." {file: "https://www.microsoft.com/favicon.ico" line: 0}] ({"lineNumber":0,"columnNumber":0,"url":"https://www.microsoft.com/favicon.ico"})
Terminate batch job (Y/N)?

webkit output - works properly

> node worker.demo

devtools parameter as a launch argument in WebKit is not supported. Also starting Web Inspector manually will terminate the execution in WebKit.
info: page fetched data: {
    "id": "playwright caught ya!"
} ({"url":"https://microsoft.com/main.html","lineNumber":19,"columnNumber":35})
info: importing scripts... ({"url":"https://microsoft.com/worker.js","lineNumber":0,"columnNumber":12})
info: imported scripts... ({"url":"https://microsoft.com/worker.js","lineNumber":4,"columnNumber":12})
info: "testing worker" ({"url":"https://microsoft.com/main.html","lineNumber":14,"columnNumber":24})
info: worker fetched data: {
    "id": "playwright caught ya!"
} ({"url":"https://microsoft.com/worker.js","lineNumber":8,"columnNumber":27})
Terminate batch job (Y/N)?

chromium output - stuck on the importScripts line

> node worker.demo

info: page fetched data: {
    "id": "playwright caught ya!"
} ({"url":"https://microsoft.com/main.html","lineNumber":19,"columnNumber":31})
info: importing scripts... ({"url":"https://microsoft.com/worker.js","lineNumber":0,"columnNumber":8})
Terminate batch job (Y/N)?
@rwoll
Copy link
Member

rwoll commented May 9, 2021

Once the resolution for #5952 lands in a release, this should work. Just tested under playwright@next.

@mxschmitt
Copy link
Member

Closing then if its already fixed in npm install playwright@next which should get released as v1.11 in a few hours. Thanks for verifying.

@Meir017
Copy link
Contributor Author

Meir017 commented May 11, 2021

@mxschmitt works now, thanks!

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

No branches or pull requests

4 participants