Bug 1826389 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Bug 1817834 will introduce a chrome only way to toggle JavaScript tracing.
Ideally, we should also allow Web pages to toggle tracing from code.
Exposing it on console via console.jsTrace() and console.jsTraceEnd() methods (or similar) sounds like an ideal location for such debugging API.

This would also ease toggling tracing from chrome codebase as current patch from bug 1817834 requires to manual import a ES Module.
An incremental improvement would be to expose a ChromeOnly API easily available from all chrome globals.
Bug 1817834 will introduce a chrome only way to toggle JavaScript tracing.
But this is still tedious as it requires the following code to toggle it:
```
const {
  startTracing,
  stopTracing,
} = ChromeUtils.import("resource://devtools/server/tracer/tracer.jsm");
startTracing({ prefix: "myPrefix" });
[... run some code...]
stopTracing();
```

Exposing it on console via console.jsTrace() and console.jsTraceEnd() methods (or similar) sounds like an ideal location for such debugging API.
An incremental improvement would be to expose a ChromeOnly API easily available from all chrome globals and later expose it to all pages via bug 1827616.
Bug 1817834 will introduce a chrome only way to toggle JavaScript tracing.
But this is still tedious as it requires the following code to toggle it:
```
const {
  startTracing,
  stopTracing,
} = ChromeUtils.import("resource://devtools/server/tracer/tracer.jsm");
startTracing({ prefix: "myPrefix" });
[... run some code...]
stopTracing();
```

Exposing it on console via `console.jsTrace()` and `console.jsTraceEnd()` methods (or similar) sounds like an ideal location for such debugging API.
An incremental improvement would be to expose a ChromeOnly API easily available from all chrome globals and later expose it to all pages via bug 1827616.

Back to Bug 1826389 Comment 0