Skip to content
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

resolving URL from scriptID in pausedClient #144

Closed
sahilt-ti opened this issue Jun 15, 2023 · 2 comments
Closed

resolving URL from scriptID in pausedClient #144

sahilt-ti opened this issue Jun 15, 2023 · 2 comments

Comments

@sahilt-ti
Copy link

sahilt-ti commented Jun 15, 2023

This is our current code, which was last tested to be working 2 months ago.

ev, err := pausedClient.Recv()
for _, callFrame := range ev.CallFrames {
    url, err := url.Parse(callFrame.URL)
    .
    .
}

Currently it works on linux but returns empty string for macOS.
I saw the comment that it is deprecated but why for mac and not for linux?
Question: What is the other way we can resolve the URL from callFrame.Location.ScriptID?

@mafredri
Copy link
Owner

Are you using the exact same version of the browser on both Mac and Linux? If not, that may explain why it's empty on Mac and not on Linux.

According to: https://pkg.go.dev/github.com/mafredri/cdp@v0.34.1/protocol/debugger#CallFrame

It seems you should also create a debugger.ScriptParsed client and store an ScriptID -> URL mapping so that you can then reference it when you receive the call frame.

@sahilt-ti
Copy link
Author

@mafredri Thanks, that solved the issue.

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

No branches or pull requests

2 participants