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

Core: Fix URL handling in Firefox #14556

Merged
merged 2 commits into from Apr 23, 2021
Merged

Core: Fix URL handling in Firefox #14556

merged 2 commits into from Apr 23, 2021

Conversation

raon0211
Copy link
Contributor

@raon0211 raon0211 commented Apr 12, 2021

Issue:

image

When opening a storybook build in a local filesystem with Firefox, an error occurs.

The error indicates that some string like null/Users/raon0211/dev/repo-name/storybook-build/iframe.html was passed to the constructor of the native URL class.

This is because when Firefox parses URLs with protocol file: (e.g. file:///Users/raon0211/dev/repo-name/storybook-build/index.html), the resulting url object has origin "null". (See this bugzilla link.)

image

As documented in MDN, the origin of URL objects is browser dependent when the url has the file: protocol.

What I did

I used the browser-independent protocol and host instead of origin to fix the problem.

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

This issue only occurs in Firefox.

@ndelangen ndelangen self-assigned this Apr 22, 2021
…url' of github.com:raon0211/storybook into pr/raon0211/14556
@ndelangen ndelangen removed their assignment Apr 22, 2021
@shilman shilman changed the title fix: Fix URL handling in Firefox Core: Fix URL handling in Firefox Apr 23, 2021
@shilman shilman added the bug label Apr 23, 2021
@shilman shilman merged commit 9388dd7 into storybookjs:next Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants