-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[RFC] Add support for missing XHR response types #6870
[RFC] Add support for missing XHR response types #6870
Conversation
By analyzing the blame information on this pull request, we identified @davidaurelio, @sreesharp and @lexs to be potential reviewers. |
@facebook-github-bot import |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
this._sent = false; | ||
this._lowerCaseResponseHeaders = {}; | ||
|
||
this._clearSubscriptions(); | ||
} | ||
|
||
get responseType() { | ||
return this._responseType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get/set properties not yet supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pity
Your lint neglect is shameful |
wanna take over? |
break; | ||
|
||
case 'blob': | ||
this._cachedResponse = new global.Blob([this.responseText]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that makes sense
Looks mostly good to me. I didn't look at the UTF-8 decoder too closely but assume it's right. |
@davidaurelio updated the pull request. |
@@ -44,8 +55,6 @@ class XMLHttpRequestBase { | |||
readyState: number; | |||
responseHeaders: ?Object; | |||
responseText: ?string; | |||
response: ?string; | |||
responseType: '' | 'text'; | |||
status: number; | |||
timeout: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get/set properties not yet supported
Thanks for the review!
it actually doesn’t handle surrogate pairs. |
@davidaurelio updated the pull request. |
@facebook-github-bot shipit |
@bestander, this is ready for merge. I assume you have to accept it in phabricator |
@davidaurelio updated the pull request. |
@facebook-github-bot import |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
@davidaurelio updated the pull request. |
@ide, @bestander: as @javache assumed, What shall we do? Not support |
Do we even support ios7? On Friday, 8 April 2016, David Aurelio [email protected] wrote:
|
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: |
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@davidaurelio updated the pull request. |
@facebook-github-bot import |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
@facebook-github-bot import |
@davidaurelio updated the pull request. |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
fcc89e9
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
@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? |
@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:Fixes facebook#6679 This adds support for the missing response types to XMLHttpRequest. Don?t ship this yet. This is completely untested. yolo and stuff. Closes facebook#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.