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 upPipeline lookup in webdriver #11791
Pipeline lookup in webdriver #11791
Conversation
highfive
commented
Jun 19, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jun 19, 2016
|
This does have some overlap with #11695. |
|
Maybe I should rebase my changes over those ones, replacing my script thread file with the one from that PR. @asajeffrey do you agree? |
ec8ffde
to
534f492
|
No worries, whatever you prefer. |
|
|
|
@craftytrickster Could you rebase this, now that #11695 has merged? |
|
Reviewed the changes, mostly this much better, thanks! The only thing that's worth looking at is the remaining panics in devtools.rs. It would be nice to replace those with warnings. Reviewed 2 of 3 files at r4, 3 of 3 files at r5. Comments from Reviewable |
534f492
to
d438c75
|
Rebasing now, I will take a look at the comments and address them after. |
|
@asajeffrey I removed the unwraps, but I am not sure if the way I did it is preferable, is returning early and not panicking really a better solution? Should these methods maybe return a Result type? |
| let context = context.find(pipeline).unwrap(); | ||
| let context = match context.find(pipeline) { | ||
| Some(found_context) => found_context, | ||
| None => return warn!("No root node found for pipeline id {}", pipeline) |
This comment has been minimized.
This comment has been minimized.
izgzhen
Jul 15, 2016
Contributor
@craftytrickster Maybe you can make reply a IpcSender<Result<NodeInfo, SomeErrorType>>? (I am not an expert on that, but it looks like no other places are using this message now so I think it is safe to change its type)
| @@ -91,17 +98,12 @@ fn find_node_by_unique_id(context: &BrowsingContext, | |||
| pipeline: PipelineId, | |||
This comment has been minimized.
This comment has been minimized.
|
Everything should be returning a Result, which bubble up until the error can be sent down a channel. |
|
@Manishearth do you mean actually return a Result from the function, or do you mean what @izgzhen is saying? |
|
Functions which do not send anything down a sender should use |
|
Thanks for the clarification. When I have time after work I will make the changes. |
|
We now have warnings included in issue reports, so whether or not we return a |
fc257cc
to
329a3fe
|
A nit about linebreaking style, otherwise lgtm. Squash and then r=me. Reviewed 1 of 3 files at r7, 2 of 3 files at r8, 4 of 4 files at r10. components/script/devtools.rs, line 73 [r9] (raw file):
|
|
@asajeffrey should I keep your initial commit and just squash my commits, or should I just squash them all? |
|
Squash everything. |
3a6d2f9
to
f31ce88
|
r=asajeffrey |
|
@craftytrickster Sorry, bors-servo only listens to reviewers. @bors-servo r=asajeffrey |
|
|
…ffrey Pipeline lookup in webdriver Fixes #11712 <!-- Please describe your changes on the following line: --> Removed a method that seemed to duplicate already existing functionality, and returned BrowsingContextErrors in the web_handler file where panics were previously occurring. I am not sure if I like all the unwrapping that occurs in the script thread, but the current methods are not set up to return Option/Result. Also, should line the method on line 37 `find_node_by_unique_id` of components/script/webdriver_handlers.rs return None if the context is not found like I have it currently? Or should it return a `Result<Option...>` instead? <!-- 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 #11712 . <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because I simply removed a method that duplicated already existing functionality. On the other part, I added better error sending instead of forcing a panic, which does not require testing to my knowledge. <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11791) <!-- Reviewable:end -->
|
|
|
…Option values instead to indicate when a pipeline context is missing where appropriate. Additionally, removed erroneous method get_browsing_context.
f31ce88
to
2475dc1
|
Sorry about that, the tidy check has been fixed now. |
|
@bors-servo r=asajeffrey |
|
|
…ffrey Pipeline lookup in webdriver Fixes #11712 <!-- Please describe your changes on the following line: --> Removed a method that seemed to duplicate already existing functionality, and returned BrowsingContextErrors in the web_handler file where panics were previously occurring. I am not sure if I like all the unwrapping that occurs in the script thread, but the current methods are not set up to return Option/Result. Also, should line the method on line 37 `find_node_by_unique_id` of components/script/webdriver_handlers.rs return None if the context is not found like I have it currently? Or should it return a `Result<Option...>` instead? <!-- 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 #11712 . <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because I simply removed a method that duplicated already existing functionality. On the other part, I added better error sending instead of forcing a panic, which does not require testing to my knowledge. <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11791) <!-- Reviewable:end -->
|
|
craftytrickster commentedJun 19, 2016
•
edited by Manishearth
Fixes #11712
Removed a method that seemed to duplicate already existing functionality, and returned BrowsingContextErrors in the web_handler file where panics were previously occurring.
I am not sure if I like all the unwrapping that occurs in the script thread, but the current methods are not set up to return Option/Result.
Also, should line the method on line 37
find_node_by_unique_idof components/script/webdriver_handlers.rs return None if the context is not found like I have it currently? Or should it return aResult<Option...>instead?./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is