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 upRewrite websocket array buffer handling to use typed array APIs #14675
Comments
|
I will give it a try! |
|
Alright! |
|
I’ve rewritten the handling to use |
|
Great work! Two notes, though:
|
|
Also, feel free to go ahead and create a PR; that might make discussion easier. |
|
Huh, I'm surprised that dpyro@9bd1fab#diff-c13bae09b178a30151ecebdc13c30a26R619 passes tests, however. Additionally, dpyro@9bd1fab#diff-c13bae09b178a30151ecebdc13c30a26R613 shouldn't compile, since the last argument is supposed to be a mutable handle. |
bors-servo
added a commit
that referenced
this issue
Dec 24, 2016
Rewrote websocket array buffer handling to typed array API <!-- Please describe your changes on the following line: -➜ Replaced existing code for handling `BinaryType::Arraybuffer` from `JS_NewArrayBuffer` to `Uint8Array::create`. --- <!-- 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 #14675 (github issue number if applicable). <!-- Either: --> - [X] These changes do not require tests because they replace an existing implementation <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> I am not certain the test suite will adequately verify my implementation as I am not familiar with the architecture. It compiles and passes the current tests. <!-- 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/14718) <!-- Reviewable:end -->
bors-servo
added a commit
that referenced
this issue
Dec 28, 2016
Rewrote websocket array buffer handling to typed array API <!-- Please describe your changes on the following line: -➜ Replaced existing code for handling `BinaryType::Arraybuffer` from `JS_NewArrayBuffer` to `Uint8Array::create`. --- <!-- 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 #14675 (github issue number if applicable). <!-- Either: --> - [X] These changes do not require tests because they replace an existing implementation <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> I am not certain the test suite will adequately verify my implementation as I am not familiar with the architecture. It compiles and passes the current tests. <!-- 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/14718) <!-- Reviewable:end -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current implementation uses the JSAPI to create an array buffer, get its buffer and populate it with the received websocket message. We should be using the ArrayBufferU8::create API instead (see FileReader::perform_readasarraybuffer for an example).
Code:
components/script/dom/websocket.rsTests:
./mach test-wpt tests/wpt/websockets/