[go: up one dir, main page]

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

Warn against JSX transform failure for non-HTTP-served JSX #4357

Merged
merged 1 commit into from
Jul 13, 2015
Merged

Warn against JSX transform failure for non-HTTP-served JSX #4357

merged 1 commit into from
Jul 13, 2015

Conversation

yangmillstheory
Copy link
Contributor

Failures have been observed in Chrome 43 for JSX requested via XHR through file:// protocol.

Resolves #4354.

I ran the text for the English changeset through Google Translate to get the Korean, Chinese, and Japanese versions. For the Chinese version, I used "Chinese (Simplified)" as opposed to "Chinese (Traditional)".

@jimfb
Copy link
Contributor
jimfb commented Jul 12, 2015

I was actually thinking that this comment would go above the source code provided in the starter kit. I tend to think it doesn't need to go in the online documentation, since I think most javascript developers will have run into this before (it's standard javascript sandboxing) and will know what the browser's error message means. The comment is not intended as a unique thing about React that we are telling all readers about; it's intended more so that if someone runs the code in the starterpack, gets the error, and looks through the source code, we have a little note for them.

Also, the gatekeepers for this change should probably be @spicyj or @zpao anyway.

@yangmillstheory
Copy link
Contributor Author

Sounds good - thanks for the clarification.

The error is thrown on line 215 in load, which is called by loadScripts, which is called by runScripts. I put the comment in load, since that's where the error is thrown.

@jimfb
Copy link
Contributor
jimfb commented Jul 13, 2015

SInce this is a newbie mistake, it's probably more readily findable in the html markup right above the script tag for the transform. The bug #4354 mentions helloworld.html, so that's a good place, there may be other intro-examples (the advanced examples probably don't need it, since people will work up to the advanced examples and anyone who hits it should hit the issue fairly early in their learning of React).

That's my two cents anyway. Ultimate gatekeeper for this change is @spicyj or @zpao.

@zpao
Copy link
Member
zpao commented Jul 13, 2015

This (as written at time of comment, in the JS) will probably help maybe 1 in 10 people who have the issue. It might be more effective to add to the documentation in the "Getting Started" section where you had issues. I didn't see what you had initially but it sounds like that's the direction you headed. Let's do that, and just do it in English (let translators pick up the changes in other languages). It's not a unique thing about React but it is definitely related to the use of JSXTransformer (though of course you can hit the issue with any local XHR).

Also, we're not going to be building JSXTransformer in 0.14 and we're unlikely to ship anything more to 0.13 so this won't end up in user's hands.

@jimfb FWIW, it's not really standard sandboxing. Different browsers have different security settings. The file:// url works fine in Safari and Firefox. I don't remember about IE. Chrome is the one that we know doesn't work (unless you check a box somewhere).

@jimfb
Copy link
Contributor
jimfb commented Jul 13, 2015

By standard, I meant it's a browser thing and not react-specific, but yeah. The specifics of the rules vary browser to browser, but protocol sandboxing is implemented in every browser. I figured people would have hit this in the past (when first learning ajax, for instance). But yeah, if people are hitting it for the first time because they're using the React transform, then we should document it for them.

I have no objections to it being in the online docs if @zpao likes it there. :)

@yangmillstheory
Copy link
Contributor Author

Hi @zpao,

Yes, that's where I had issues and where I initially put the comment. (Can't see it in the revision history since I rebased that those commits and force-pushed.)

I just updated the PR; moved the comment to that part of the documentation where I hit the problem.

@zpao
Copy link
Member
zpao commented Jul 13, 2015

👍 That sounds good to me. If people have more issues we can always expand on the topic.

zpao added a commit that referenced this pull request Jul 13, 2015
Warn against JSX transform failure for non-HTTP-served JSX
@zpao zpao merged commit e9915f0 into facebook:master Jul 13, 2015
@yangmillstheory yangmillstheory deleted the docfix branch July 13, 2015 20:46
zpao added a commit that referenced this pull request Jul 17, 2015
Warn against JSX transform failure for non-HTTP-served JSX
(cherry picked from commit e9915f0)
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.

4 participants