Uh oh!
There was an error while loading. Please reload this page.
[RFC] Add support for missing XHR response types - #6870
Conversation
facebook-github-bot
commented
Apr 7, 2016
By analyzing the blame information on this pull request, we identified @davidaurelio, @sreesharp and @lexs to be potential reviewers. |
davidaurelio
commented
Apr 7, 2016
davidaurelio
commented
Apr 7, 2016
@facebook-github-bot import |
facebook-github-bot
commented
Apr 7, 2016
Thanks for importing. If you are an FB employee go to Phabricator to review. |
| } | ||
| get responseType() { | ||
| return this._responseType; |
bestander
commented
Apr 7, 2016
Your lint neglect is shameful |
davidaurelio
commented
Apr 7, 2016
wanna take over? |
| break; | ||
| case 'blob': | ||
| this._cachedResponse = new global.Blob([this.responseText]); |
There was a problem hiding this comment.
The Blob constructor accepts some options including the MIME type of the response -- should we parse the HTTP response headers and pass the Content-Type to the Blob too?
There was a problem hiding this comment.
I guess that makes sense
ide
commented
Apr 7, 2016
Looks mostly good to me. I didn't look at the UTF-8 decoder too closely but assume it's right. |
facebook-github-bot
commented
Apr 7, 2016
@davidaurelio updated the pull request. |
| response: ?string; | ||
| responseType: '' | 'text'; | ||
| status: number; | ||
| timeout: number; |
davidaurelio
commented
Apr 8, 2016
Thanks for the review!
it actually doesn’t handle surrogate pairs. |
facebook-github-bot
commented
Apr 8, 2016
@davidaurelio updated the pull request. |
davidaurelio
commented
Apr 8, 2016
@facebook-github-bot shipit |
davidaurelio
commented
Apr 8, 2016
@bestander, this is ready for merge. I assume you have to accept it in phabricator |
facebook-github-bot
commented
Apr 8, 2016
@davidaurelio updated the pull request. |
davidaurelio
commented
Apr 8, 2016
@facebook-github-bot import |
facebook-github-bot
commented
Apr 8, 2016
Thanks for importing. If you are an FB employee go to Phabricator to review. |
facebook-github-bot
commented
Apr 8, 2016
@davidaurelio updated the pull request. |
davidaurelio
commented
Apr 8, 2016
@ide, @bestander: as @javache assumed, What shall we do? Not support |
bestander
commented
Apr 8, 2016
Do we even support ios7? On Friday, 8 April 2016, David Aurelio notifications@github.com wrote:
|
ide
commented
Apr 8, 2016
Let's support This is the behavior I believe we want:
This should work for apps that want to target iOS 7 and you can easily write code like: |
ide
commented
Apr 8, 2016
@davidaurelio also could you add a comment to the code mentioning iOS 7 so that when we drop support for iOS 7 some day, it's easy to grep for deletable code? |
| } | ||
| /*eslint-disable no-bitwise */ | ||
| exports.encode = (string: string): ArrayBuffer => { |
There was a problem hiding this comment.
I might be missing something here, but doing utf8 ourself doesn't seem like something we should do.
Like the #1 rule of crypto "don't roll your own", I think this applies to string encoding too.
There was a problem hiding this comment.
I think the complexity of crypto and character encodings is very different. I have been looking for a compact utf-8 encoding lib, but didn’t find anything that was compact and solid at the same time. My implementation adds ~1KB when minified.
Do you have any specific concerns? We wouldn’t need to do this if we could pass the binary response data from native to JS wrapped into a host object we’d implement. That host object could pass of character encoding to a system service. I have been looking into JSC’s API for that, but as long as we pass messages as JSON, we can’t do it.
facebook-github-bot
commented
Apr 11, 2016
@davidaurelio updated the pull request. |
davidaurelio
commented
Apr 11, 2016
@facebook-github-bot import |
facebook-github-bot
commented
Apr 11, 2016
Thanks for importing. If you are an FB employee go to Phabricator to review. |
davidaurelio
commented
Apr 11, 2016
@facebook-github-bot import |
facebook-github-bot
commented
Apr 11, 2016
@davidaurelio updated the pull request. |
facebook-github-bot
commented
Apr 11, 2016
Thanks for importing. If you are an FB employee go to Phabricator to review. |
ide
commented
Apr 11, 2016
Cherry-picking this into 0.24-stable. |
Summary:Fixes#6679 This adds support for the missing response types to XMLHttpRequest. Don?t ship this yet. This is completely untested. yolo and stuff. Closes#6870 Reviewed By: bestander Differential Revision: D3153628 Pulled By: davidaurelio fb-gh-sync-id: 76feae3377bc24b931548a9ac1af07943b1048ac fbshipit-source-id: 76feae3377bc24b931548a9ac1af07943b1048ac
mpretty-cyro
commented
May 3, 2016
@davidaurelio Just FYI the utf8 module this provides is supplanting a utf8 node module (https://github.com/mathiasbynens/utf8.js); I assume this is because of the '@providesModule' - should this really be doing that if all it does is encode? |
davidaurelio
commented
May 3, 2016
@mpretty-homepass sorry about that :-( we’ll get rid of the special packager rule for react-native. Feel free to send a PR that renames the module to something else. |
Summary:Fixesreact#6679 This adds support for the missing response types to XMLHttpRequest. Don?t ship this yet. This is completely untested. yolo and stuff. Closesreact#6870 Reviewed By: bestander Differential Revision: D3153628 Pulled By: davidaurelio fb-gh-sync-id: 76feae3377bc24b931548a9ac1af07943b1048ac fbshipit-source-id: 76feae3377bc24b931548a9ac1af07943b1048ac
Fixes#6679
This adds support for the missing response types to XMLHttpRequest.
Don’t ship this yet. This is completely untested. yolo and stuff.