Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement typed array support for XMLHttpRequest's send API #20343
Comments
|
This appears to be an interesting issue. I would surely like to work on it |
|
The BodyInit requires extracting both the data and content_type. For a typed array, I was trying to get data using to_vec() method which requires some dereferencing I think, but I was wondering how the content type should be defined here. Should we give it a value None if its absent and Int32 otherwise ? |
|
https://fetch.spec.whatwg.org/#concept-bodyinit-extract does not assign a value for content_type when the input is an arraybuffer, so leaving a None value is appropriate. |
|
I tried using the following code to extract data
This results in an error: cannot borrow immutable borrowed content |
|
If you rebase against Servo master, that problem should be gone (it was fixed by servo/rust-mozjs#408). |
Typed array support for XMLHttpRequest's send API <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20343 <!-- Either: --> - [x] Updated some tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20434) <!-- Reviewable:end -->
Typed array support for XMLHttpRequest's send API <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20343 <!-- Either: --> - [x] Updated some tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20434) <!-- Reviewable:end -->
Typed array support for XMLHttpRequest's send API <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20343 <!-- Either: --> - [x] Updated some tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20434) <!-- Reviewable:end -->
Typed array support for XMLHttpRequest's send API <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20343 <!-- Either: --> - [x] Updated some tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20434) <!-- Reviewable:end -->
Now that #20267 has merged, we can uncomment the BufferSource argument to allow XMLHttpRequest.send() to support sending typed arrays as the XHR body. This will require extracting the data from the typed array in this code.
Code:
components/script/dom/webidls/XMLHttpRequest.webidl,components/script/dom/xmlhttprequest.rsTests:
./mach test-wpt tests/wpt/web-platform-tests/xhr/(this should generate a bunch of new test pass results)