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 upworker.onmessage is seeing non-empty event.origin #25149
Comments
|
Hi! I want to try and solve this issue, if it's not a problem. servo/components/script/dom/messageevent.rs Lines 78 to 85 in 7281336 Should I completely remove the origin parameter it is accepting here (and make the required changes in all of its calls) or should it be left unutilized? |
|
MessageEvent is used in many different ways; some of them are specified as explicitly setting origin, and some of them aren't. If you click on the bolded word "origin" in https://html.spec.whatwg.org/multipage/comms.html#dom-messageevent-origin you should get a popup of all the places the HTML specification references it. |
|
Oh, my mistake. I was not aware of all the different specs that it supported. It will take me some time, but I'll try to understand the usage (especially the posting messages section) and the serialization of origin, and will update my status soon. |
|
servo/components/script/dom/messageevent.rs Lines 148 to 162 in 7281336 |
|
That was the wrong code link - I meant to link servo/components/script/dom/worker.rs Lines 158 to 166 in 7281336 |
|
In fact, we should remove the origin argument from Worker::handle_message entirely. |
|
Thanks for pointing that out. That will save a lot of time :) Just out of curiosity, while I was looking around, I found this: servo/components/url/origin.rs Lines 79 to 82 in d47f0ad I cannot understand how this works. The recursive call (I could not find any other declaration of ascii_serialization, so I figured it must be recursive) is confusing me a bit. Can you explain this briefly?
|
|
into_url_origin returns a url::Origin, which comes from the rust-url crate (which is different than components/url). |
|
Oh, I see. Now I get it. Thanks:) |
Remove `origin` parameter from `Worker::handle_message` <!-- Please describe your changes on the following line: --> Test in `workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.html` was failing because worker.onmessage was seeing non-empty event.origin. Removing `origin` parameter from `Worker::handle_message` and sending `None` to `MessageEvent::dispatch_jsval` solves the issue. r?@jdm --- <!-- 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 #25149 (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. -->
Remove `origin` parameter from `Worker::handle_message` <!-- Please describe your changes on the following line: --> Test in `workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.html` was failing because worker.onmessage was seeing non-empty event.origin. Removing `origin` parameter from `Worker::handle_message` and sending `None` to `MessageEvent::dispatch_jsval` solves the issue. r?@jdm --- <!-- 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 #25149 (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 happens in WPT workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.html. I don't see anything explicit in the standard saying to set origin to an empty string here, but I'm also not seeing anything in the worker or message port steps saying to set it to a real origin, so the implication must be to leave it default, and browsers are passing this test.