devtools-protocol icon indicating copy to clipboard operation
devtools-protocol copied to clipboard

Keep track of URL changes

Open craterkamath opened this issue 5 years ago • 4 comments

We use v8 inspector in our project to debug JS code that is running on our isolates and deliver it as a feature to the users to help them debug their code better. Often times the URL to open the debugger(the devtools inspector) seems to break since the URL format is not consistent across different devtools versions/chrome versions.

From our findings we've made a rough estimate of the URL formats:

  • Chrome Version > 84 : devtools://devtools/bundled/inspector.html?
  • Chrome Version > 83 : devtools://devtools/bundled/js_app.html?
  • Older Versions : chrome-devtools://devtools/bundled/js_app.html?

Can anyone redirect me to a comprehensive guide to these change formats and the exact same release versions of these changes? If there a hack to make these changes forward-compatible by any means? We definitely cannot control the version of the chrome the user is accessing our product with!

craterkamath avatar Sep 17 '20 11:09 craterkamath

Unfortunately we don't have an expectation on the URL to stay stable. The best way is to go from chrome://inspect.

Maybe you could query Chrome's version and use that to map to the URL?

hashseed avatar Sep 17 '20 12:09 hashseed

That is exactly how we are planning to implement it as of now. To explain a bit more -- the server sends a websocket address to the client wherein the user can connect to that socket through the devtools to debug the JS code running on the remote isolate on the server.

i.e The user will get a link of the form devtools://devtools/bundled/inspector.html?ws=xxxxxxxx or chrome-devtools://devtools/bundled/js_app.html?ws=xxxxxx which he can enter in the search bar. As of now, this dynamic URL generation is based on the user-agent and the chrome version and is completely hardcoded.

This poses two problems, firstly the map that we have may not be accurate(I need help with the exact version numbers here) and it doesn't offer forward compatibility too. Secondly, our product is expected to coup up with changes made to the devtools link release after release.

Is there any way to overcome these setbacks?

craterkamath avatar Sep 17 '20 13:09 craterkamath

Just make it a CLI flag --node-frontend It should just launch the browser and do chrome.send('open-node-frontend') or whatever the Open dedicated DevTools for Node button does

qwelias avatar Sep 28 '22 21:09 qwelias

There are a few HTML entrypoints, all with slightly different purposes. As of today, here's the list: https://github.com/ChromeDevTools/devtools-frontend/blob/4515db6fd9e9e8033ef08282d29c29a70a79a9ff/front_end/BUILD.gn#L99-L112

You can look in https://github.com/ChromeDevTools/devtools-frontend/tree/4515db6fd9e9e8033ef08282d29c29a70a79a9ff/front_end/entrypoints to get a sense of how each differs.

While stuff like this doesn't change often.. like Yang said... there are no compatibility promises around these URLs or their behavior.

paulirish avatar Sep 29 '22 00:09 paulirish