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

Fix Lite to work on FireFox #9527

Closed
wants to merge 2 commits into from
Closed

Fix Lite to work on FireFox #9527

wants to merge 2 commits into from

Conversation

whitphx
Copy link
Member

@whitphx whitphx commented Oct 4, 2024

Description

Context: internal link

Lite doesn't work on FireFox when the script is loaded in the cross-origin manner as below (this screenshot was taken in an env where the Lite is served from localhost:8000 and the parent page is from localhost:8080).
CleanShot 2024-10-04 at 14 34 51@2x

This is because, on FireFox, new WebWorker() throws the SecurityError asynchronously, while it's synchronous on Chrome, so the synchronous try-catch surrounding it doesn't work.

We have been using the normal initializer new WebWorker(url) first and the cross-origin initializer as a fall-back,
but in this PR we gave up using the normal one and switched to use the cross-origin one in any cases for simplicity sake.

…e URL and pass the bypassed blob directly, because the current approach doesn't work on FireFox where new WebWorker() throws the SecurityError asynchronously so we can't catch it with synchronous try-catch
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Oct 4, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/e01c6c73bbff5759cdba387bb8f19060c54684bc/gradio-4.44.1-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@e01c6c73bbff5759cdba387bb8f19060c54684bc#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/e01c6c73bbff5759cdba387bb8f19060c54684bc/gradio-client-1.6.0-beta.3.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/e01c6c73bbff5759cdba387bb8f19060c54684bc/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Oct 4, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/wasm minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Fix Lite to work on FireFox

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@whitphx whitphx requested review from aliabd and pngwn October 4, 2024 05:50
@whitphx whitphx marked this pull request as ready for review October 4, 2024 05:50
@whitphx whitphx closed this Oct 4, 2024
@whitphx whitphx deleted the fix-cross-origin-worker branch October 4, 2024 06:40
@whitphx
Copy link
Member Author

whitphx commented Oct 4, 2024

Supersedded by #9528

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 this pull request may close these issues.

2 participants