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 MessageEvent.initMessageEvent #25192
Comments
|
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the If you intend to work on this issue, then add |
|
Code: |
|
I would like to try and solve this one. |
|
Hey @kunalmohan! Thanks for your interest in working on this issue. It's now assigned to you! |
|
I am having trouble initializing variables which are DOMString type. How should I get past it? |
|
@kunalmohan Are you using DOMString::new() for an empty string and DOMString::from(...) to create a DOMString from an existing Rust string value? |
|
I have defined the function as
I am not taking
|
|
What is the trouble you are having with initialization, in that case? |
|
Actually it's not just the DOMString.
for the values obtained as parameters. |
|
Ah. You will need to put the members that need to be reinitialized inside DOMRefCell or Cell values. These allow mutating the values inside of methods that take &self instead of &mut self, like all of our DOM APIs. As for the str vs. DOMString error, that also surprises me. See if it goes away when you use the appropriate DOMRefCell/Cell wrappers? |
|
Okay, I'll use the DOMRefCell/Cell wrappers. Would there be a need to edit other functions for the |
|
Any method that uses the members that are now wrapped in cells will need to be adjusted in order to compile, yes. |
|
That was quite helpful. Thanks :) |
Implement MessageEvent.InitMessageEvent <!-- Please describe your changes on the following line: --> InitMessageEvent had to be implemented as required by wpt. For this few keys of struct `MessageEvent` are now wrapped inside DomRefCell wrapper. --- <!-- 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 #25192 (GitHub issue number if applicable) <!-- Either: --> - [X] There are 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. -->
Implement MessageEvent.InitMessageEvent <!-- Please describe your changes on the following line: --> InitMessageEvent had to be implemented as required by wpt. For this few keys of struct `MessageEvent` are now wrapped inside DomRefCell wrapper. --- <!-- 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 #25192 (GitHub issue number if applicable) <!-- Either: --> - [X] There are 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. -->
Implement MessageEvent.InitMessageEvent <!-- Please describe your changes on the following line: --> InitMessageEvent had to be implemented as required by wpt. For this few keys of struct `MessageEvent` are now wrapped inside DomRefCell wrapper. --- <!-- 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 #25192 (GitHub issue number if applicable) <!-- Either: --> - [X] There are 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. -->
Implement MessageEvent.InitMessageEvent <!-- Please describe your changes on the following line: --> InitMessageEvent had to be implemented as required by wpt. For this few keys of struct `MessageEvent` are now wrapped inside DomRefCell wrapper. --- <!-- 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 #25192 (GitHub issue number if applicable) <!-- Either: --> - [X] There are 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. -->
This is expected by WPT html/webappapis/scripting/events/messageevent-constructor.https.html and has IDL in https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interface