Skip to content

'Unable to use window or document' warning even if sync_main_only = true #2426

@jolaf

Description

@jolaf

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help

What happened?

For now it seems that every worker which doesn't have CORS headers properly configured, displays the following warning in the browser console:

Unable to use `window` or `document` -> https://docs.pyscript.net/latest/faq/#sharedarraybuffer

"Unable to use `window` or `document` in worker. "

It's rather weird to see this warning when worker is configured with sync_main_only = true, because if someone configures a worker that way, they somewhat agree not to use window or document, and seeing this warning could make them think their configuration is incorrect, they've put sync_main_only = true in the wrong place, etc.

It seems to me, it would be nice to suppress this warning for workers configured with sync_main_only = true.

Maybe if sync_main_only = true, window and document could be set to NotSupported without even trying to initialize them via SharedArrayBuffer.

What browsers are you seeing the problem on? (if applicable)

Chrome

Console info

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions