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 upOptional pipeline in WorkerScriptLoadOrigin should not be optional #24772
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 |
|
@highfive: assign me This looks like something I could do. |
|
Hey @phil3112! Thanks for your interest in working on this issue. It's now assigned to you! |
|
i help but dont give back |
|
@highfive : assign me It seems like no work has been completed on this so I would like to give it a try. |
|
It looks like this has already been assigned to someone. I'll leave the decision to a core contributor. |
|
I have looked into this and this is my understanding: My problem with this is that both |
|
@warren-fisher I'm not sure I understand the issue - I believe any code in those files that expects an Option can be passed |
|
@jdm My bad, I definitely explained it poorly. If I change the This then has cascading affects in a few of the other files I mentioned where they were expecting an Optional but not are being passed a PipelineId struct instead. It is very possible that I misunderstood the goal of this issue. I looked a little deeper and found this example of an unsafe block testing to make sure that |
|
It certainly sounds like you're on the right track. We want to change the |
Remove Optional pipeline_id <!-- Please describe your changes on the following line: --> All code that creates a WorkerScriptLoadOrigin passes a Some value for the pipeline, so we should remove the Option from the struct member field. I changed the `WorkerScriptLoadOrigin` struct in `components/script_traits/lib.rs` to have a PipelineId and not an Option<PipelineId>. In `components/script/dom/worker.rs` and `components/script/dom/serviceworkerregistration.rs` it was changed so that `WorkerScriptLoadOrigin` was instantiated with a non-Optional. In `components/script/dom/dedicatedworkerglobalscope.rs` testing for if pipeline_id is an Optional is removed. In `components/script/dom/serviceworkerglobalscope.rs` and `components/script/dom/dedicatedworkerglobalscope.rs` a `PipelineId` was provided as an Optional to a `RequestBuilder` and I changed it to provide a `Some(pipeline_id)` instead. I am not sure changing the [RequestBuilder struct](https://github.com/warren-fisher/servo/blob/5c3bda025144118fc8dd67a3f975d8f91fd25e78/components/net_traits/request.rs#L118-L159) at line 147 to accept a non-optional was within this issue so I left it as is. I was able to successfully build it so I assume these changes worked, however I am not sure about the implications of the changes made in the unsafe block in `components/script/dom/dedicatedworkerglobalscope.rs`. <!-- 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 #24772 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because the issue says so <!-- 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 Optional pipeline_id <!-- Please describe your changes on the following line: --> All code that creates a WorkerScriptLoadOrigin passes a Some value for the pipeline, so we should remove the Option from the struct member field. I changed the `WorkerScriptLoadOrigin` struct in `components/script_traits/lib.rs` to have a PipelineId and not an Option<PipelineId>. In `components/script/dom/worker.rs` and `components/script/dom/serviceworkerregistration.rs` it was changed so that `WorkerScriptLoadOrigin` was instantiated with a non-Optional. In `components/script/dom/dedicatedworkerglobalscope.rs` testing for if pipeline_id is an Optional is removed. In `components/script/dom/serviceworkerglobalscope.rs` and `components/script/dom/dedicatedworkerglobalscope.rs` a `PipelineId` was provided as an Optional to a `RequestBuilder` and I changed it to provide a `Some(pipeline_id)` instead. I am not sure changing the [RequestBuilder struct](https://github.com/warren-fisher/servo/blob/5c3bda025144118fc8dd67a3f975d8f91fd25e78/components/net_traits/request.rs#L118-L159) at line 147 to accept a non-optional was within this issue so I left it as is. I was able to successfully build it so I assume these changes worked, however I am not sure about the implications of the changes made in the unsafe block in `components/script/dom/dedicatedworkerglobalscope.rs`. <!-- 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 #24772 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because the issue says so <!-- 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. -->
All code that creates a WorkerScriptLoadOrigin passes a Some value for the pipeline, so we should remove the Option from the struct member field.
Code:
components/script_traits/lib.rscomponents/script/dom/serviceworkerregistration.rscomponents/script/dom/worker.rsNo need to run tests - if it builds, it's good enough for a pull request.