-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Fixed devtools url used for debug with chrome and edge #61813
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for your PR, @@Dona278. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
localPath = localPath.Split('/').Last().TrimStart('/'); | ||
// Ensure starts with "devtools" | ||
localPath = $"devtools/{localPath}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand this logic, looking at the previous code, we simply concatenated the devToolsFrontendUrl, why do we need to remove any segments but the last from the path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the current url is in this format https://chrome-devtools-frontend.appspot.com/serve_rev/@031848bc6ad02b97854f3d6154d3aefd0434756a/inspector.html?ws=.....
so the local path will be serve_rev/@xxxxxxx/inspector.html
.
The previous one I suppose was like devtools/inspector.html?ws=.....
, so I take the last segment which is the inspector page of the browser returned by the browser (to avoid hardcode the name) and then add the missing segment devtools/
at the begin.
But after write that, now I think that if I can hardcoded devtools/
I can hardcode directly devotools/inspector.html
too..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize it might not be my brightest day, but I'm not following. In the past we would concatenate the relative URL that came back with the _browserHost
; if the URL that we receive is absolute now, I don't understand why stripping the host+scheme is not enough. In other words, why making the url relative is not enough
The part that I don't follow is why we didn't have to strip a part of the path in the previous version, and we need to do so now.
@thaystg do you have thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dona278 can you please provide the difference between the localhost:9222/json of the browser that you are using and an older version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I cannot downgrade chrome to older version I found the "old" value here:
[{
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734",
"id": "DAB7FB6187B554E10B0BD18821265734",
"title": "Yahoo",
"type": "page",
"url": "https://www.yahoo.com/",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734"
}]
the "new" one:
[
{
"description": "",
"devtoolsFrontendUrl": "https://chrome-devtools-frontend.appspot.com/serve_rev/@031848bc6ad02b97854f3d6154d3aefd0434756a/inspector.html?ws=localhost:9222/devtools/page/719FE9D3B43570193235446E0AB36859",
"id": "719FE9D3B43570193235446E0AB36859",
"title": "Blazor Application",
"type": "page",
"url": "http://localhost:9222/json",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/719FE9D3B43570193235446E0AB36859"
}
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javiercn with the diff do you agree with the changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I created confusion about "new" and "old" urls, I'm sorry.. as we can see in these two json not only changed from relative to absolute but changed also the path, so make the new-absolute-one relative isn't enough..
However I agree with changes suggested by @ilonatommy which maybe create less confusion if the user doesn't read Uri.TryCreate(UriKind.Absolute) and cover both old and new version..
This PR ensure the correct creation of the devtools url with proxy to use for debug with chrome and edge browser which recently changed how urls are returned from "localhost:9222/json".
Browser tested:
Edge Version 136.0.3240.50
Chrome Version 136.0.7103.49
Fixes #61559