google / perfetto

Performance instrumentation and tracing for Android, Linux and Chrome (read-only mirror of https://android.googlesource.com/platform/external/perfetto/)

Home Page:https://www.perfetto.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suppress "Open trace?" modal for same origin

unprompted opened this issue · comments

I embedded the Perfetto UI in a web application and did the window.open() + postMessage() dance as is prescribed, and it's working fine. But I am surprised that it prompts me "Open trace?" ... "Do you trust the origin and want to proceed?" every time. I would like to make this flow as smooth as possible, and I assumed that hosting the my traces and the Perfetto UI together would minimize friction.

I'm not well versed on this codebase or the nuances, but it looks as though isTrustedOrigin() could return true if origin == window.origin, and that would satisfy my needs and be in the spirit of what the code is already trying to do. Thanks.

Seems like a reasonable request - @primiano - any thoughts?

I am not sure I understand the issue here. Can you expand with more details? What's the origin of perfetto, what's the origin of your app? Is the origin really the same? even the port number?

If you host the perfetto UI on your origin, edit the code and remove that dialog.

Yes, same exact origin. In one of my use cases, I have a custom internal continuous integration web application that generates traces of various build processes that I want to visualize. I am hosting the perfetto ui (the contents of ui/out/dist) alongside it in the same service.

I'm sure I can kludge it locally to get what I want. If there's something simple and sensible that can be done upstream, I'd rather see that.

okay for the same exact origin it would be safe. I thought you were going to propose for same origin but different port.
Mind sending out a patch? see https://perfetto.dev/docs/contributing/getting-started

Closing this as the patch landed. Thanks for the idea and the contribution!

This will go live in O(Weeks) depending on the channel, see https://perfetto.dev/docs/visualization/perfetto-ui-release-process