Skip to content

UI element selection debt #247499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 4 tasks
bpasero opened this issue Apr 27, 2025 · 2 comments
Open
2 of 4 tasks

UI element selection debt #247499

bpasero opened this issue Apr 27, 2025 · 2 comments
Assignees
Labels
debt Code quality issues
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Apr 27, 2025

Some feedback from #246643

  • I find that the complexity of the methods justifies putting them into their own respective service. Native host service is already a bit of a kitchen sink of sorts and was never meant to contain all methods for all use cases. But I feel that getElementData specifically is getting large enough to think about having it in its own service. Specifically because it seems to depend on the simple browser, which is some hardcoded knowledge that does not seem right for the native host.

  • the use of cancellation is not very robust, I would generate some kind of UUID or increasing integer and register a channel with that UUID specifically to cancel that one invocation of the use of the method. we use a similar technique to control native context menus here

  • As with the code, there seems to be leaks, specifically the use of this._register from getNodeData is odd because you will add disposables to the global map each time the method is called 🤔

this._register(debuggers.off('message', onMessage));

this._register(debuggers.off('message', onMessage));

this._register(debuggers.on('message', onMessage));

  • Finally, the listener to window.webContents.on('ipc-message', async (event, channel) => { is never removed:

window.webContents.on('ipc-message', async (event, channel) => {

@bpasero bpasero added the debt Code quality issues label Apr 27, 2025
@bpasero bpasero added this to the May 2025 milestone Apr 27, 2025
@justschen
Copy link
Collaborator

justschen commented Apr 27, 2025

gotcha! thanks for the feedback!

I'll address the listener issues this iteration, and yeah this whole chrome debugger tools thing is super complicated, and agree with the new service.

the native host main service was just the easiest place to put it at the moment. maybe naming something along the lines of simpleBrowserDebuggerService or something of the sort 🏎

@bpasero
Copy link
Member Author

bpasero commented Apr 27, 2025

👍 , I added another point about the way how you support cancellation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Code quality issues
Projects
None yet
Development

No branches or pull requests

2 participants