Skip to content

DevTools: Display tabs and processes - #32475

Merged
mrobinson merged 5 commits into
servo:mainfrom
eerii:devtools-tabs
Jun 12, 2024
Merged

mrobinson merged 5 commits into
servo:mainfrom
eerii:devtools-tabs

Conversation

@eerii

@eerii eerii commented Jun 11, 2024

Copy link
Copy Markdown
Member

Following the work of @fabricedesre and cleaning some things a bit, this PR updates the messages sent from Servo to the DevTools server so that Tabs and Processes can be shown again in the main view.

Note that tab inspection doesn't work yet (that's the next step!), as a Watcher Actor needs to be implemented.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes are a part of Fix support for the DevTools protocol #32404
  • These changes do not require tests because they relate to an external tool*
  • I am unsure on how to write automated tests for DevTools. They can be tested manually running Servo with the propper argument: ./mach run --devtools=6080 and connecting via about:debugging in Firefox. If there is a way to write tests please let me know.

@eerii eerii mentioned this pull request Jun 11, 2024
22 of 26 tasks

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start!

Comment thread components/devtools/actors/root.rs Outdated
.map(|target| {
registry
.find::<TabDescriptorActor>(target)
.encodable(registry, true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why encode here, rather than when we find the actual tab we want to send back?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it this way since TabDescriptorActorMsg contains the broswerId, but TabDescriptorActor doesn't, and we need to filter them by that, I thought of doing the conversion beforehand, but I can absolutely try to do it other way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. That's reasonable!

@jdm

jdm commented Jun 11, 2024

Copy link
Copy Markdown
Member

And you are correct—we have not prioritized any kind if automated testing for the devtools server implementation.

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Just a couple small nits to help gradually improve the devtools code:

Comment thread components/devtools/actors/root.rs Resolved
Comment thread components/devtools/actors/root.rs Resolved
Comment thread components/devtools/actors/tab.rs Resolved
Comment thread components/devtools/actors/root.rs Resolved
Comment thread components/devtools/actors/root.rs Outdated
};
let _ = stream.write_json_packet(&reply);
ActorMessageStatus::Processed
if let Some(serde_json::Value::Number(browserId)) = msg.get("browserId") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to move this code into a function in order to use an early return pattern and avoid some indentation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, how about now? I used let else to further reduce indentation but I can change it if another pattern is preferred. I am also not sure about the name get_tab_msg_by_browser_id but I couldn't think of one that was shorter but still descriptive, any suggestion is welcome.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great now. Thank!

@mrobinson
mrobinson added this pull request to the merge queue Jun 12, 2024
Merged via the queue into servo:main with commit 370fbf0 Jun 12, 2024
@eerii
eerii deleted the devtools-tabs branch June 12, 2024 10:32
@eerii eerii mentioned this pull request Jul 8, 2024
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants