ui: add ability to open traces via POST /_open_trace/xxxx
This change makes it possible to open traces by simply doing
a HTTP POST operation on https://ui.perfetto.dev/_open_trace/
via a <form>. This allows:
1. Easier integration from other dashboards, even in presence
of cross-origin isolation (which applies to fetch, but not
<form>) without requiring popups.
2. Allows in future to solve the teardown problem and open a
2nd trace in the UI by replacing the current window with a
fresh UI state (a follow up CL is required for this).
The main downside is that this works only after the serviceworker
has been registered. In other words, this works only after the
user has visited ui.perfetto.dev once.
I think this is easily solvable by adding an error page to
handle /_open_trace on ui.perfetto.dev that explains what's
happening.
Bug: 337296884
Change-Id: I543b76481c400cfb4e9947252ce89964655e247e
diff --git a/ui/src/open_perfetto_trace/tsconfig.json b/ui/src/open_perfetto_trace/tsconfig.json
new file mode 100644
index 0000000..66bf290
--- /dev/null
+++ b/ui/src/open_perfetto_trace/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "include": [ "." ],
+ "exclude": [
+ "../gen/"
+ ],
+ "compilerOptions": {
+ "outDir": "../../out/tsc/open_perfetto_trace",
+ "lib": [
+ "dom", // Need to be explicitly mentioned now since we're overriding default included libs.
+ "es2021", // Need this to use Promise.allSettled, replaceAll, etc
+ ],
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ }
+}