← Chrome 147 reference

v147 · developer trial · workers · performance

JS Profiling in Dedicated Workers

Limited availability — worker exposure in developer trial

  • Chrome · Profiler on the main thread since 94; in dedicated workers: developer trial in 147
  • Edge · Profiler since 94 (webstatus.dev)
  • Firefox · has not shipped JS Self-Profiling (implementation bug, from BCD)
  • Safari · has not shipped JS Self-Profiling (BCD)

The profiler web-feature is Baseline limited (queried 2026-09-27) — Chromium-only since Chrome/Edge 94. The worker exposure documented here is newer still: a Chrome 147 developer trial, not yet recorded in BCD api/Profiler.json (which has no worker-support subfeature, verified 2026-09-27). See the full table.

Chrome 147 adds developer trial support for the JavaScript Self-Profiling API (Profiler) inside dedicated workers. The spec already declares the interface [Exposed=(Window, Worker)]; this trial implements the Worker half in Chromium, so worker scripts can collect statistical call-stack samples of their own execution — still gated by Document Policy, whose worker support is tracked separately.

Developer trial Behind flags in Chrome 147. The Blink runtime feature is ProfilerAPIForDedicatedWorker (status experimental in runtime_enabled_features.json5, verified 2026-09-27; the ChromeStatus record lists the Finch pair DocumentPolicyInDedicatedWorker,ProfilerAPIForDedicatedWorker). Enable with --enable-blink-features=ProfilerAPIForDedicatedWorker,DocumentPolicyInDedicatedWorker, or turn on everything experimental via chrome://flags/#enable-experimental-web-platform-features — and serve the worker script with Document-Policy: js-profiling. The API surface may change before it ships; do not use in production.

at a glance

Status in Chrome 147Developer trial — filed under “In developer trial (Behind a flag)” in the milestone=147 listing
ExtendsJS Self-Profiling API (Profiler), on the main thread since Chrome 94 (webstatus.dev)
Runtime flagProfilerAPIForDedicatedWorker (experimental; “When enabled, dedicated workers can use profiler API” per the flag’s definition comment)
Policy gateDocument-Policy: js-profiling on the worker script’s response — see gendn: Document Policy in Dedicated Workers
SpecificationJS Self-Profiling API — the Profiler interface
ExplainerMSEdgeExplainers — Document Policy in Workers (the record’s explainer/doc link)
Intent to Prototypeblink-dev thread
ChromeStatus5159559872249856 — js-profiling in dedicated workers
Tracking bugcrbug 482085416

Gating and status divergence, both sides reported rather than resolved (fetched 2026-10-06): this page’s eyebrow and glance table present the feature as a Developer trial behind flags in Chrome 147 — the category the milestone=147 listing files it under — while the ChromeStatus record itself reads status “Proposed” with no desktop milestone field, describing the surface as “remaining gated by Document Policy” with worker Document Policy support tracked separately. The cited WICG draft is where that gate is defined — the js-profiling-mode / js-profiling policy values whose absence makes the constructor throw NotAllowedError — which the syntax section documents.

syntax

IDL quoted verbatim from the draft (read 2026-09-27) — note the exposure set already includes Worker; Chrome 147’s trial is Chromium catching up to it for dedicated workers:

[Exposed=(Window, Worker)]
interface Profiler : EventTarget {
  readonly attribute DOMHighResTimeStamp sampleInterval;
  readonly attribute boolean stopped;

  constructor(ProfilerInitOptions options);
  Promise<ProfilerTrace> stop();
};

dictionary ProfilerInitOptions {
  required DOMHighResTimeStamp sampleInterval;
  required unsigned long maxBufferSize;
};

The constructor algorithm already speaks worker: “If globalObject is a Window or a WorkerGlobalScope”, it reads the js-profiling-mode / js-profiling Document Policy values from that global and throws a "NotAllowedError" DOMException when neither authorizes profiling (and a RangeError for a negative sampleInterval). When the sample buffer reaches maxBufferSize, a samplebufferfull event fires on the profiler (an EventTarget) and sampling stops. stop() resolves with the collected ProfilerTrace — the per-member trace format is documented on MDN’s Profiler pages and in the draft; this page documents the v147 worker-exposure delta rather than duplicating them.

Source: JS Self-Profiling draft (IDL verbatim); policy gating per the ChromeStatus summary (“while remaining gated by Document Policy”)

why it exists

Many performance-sensitive applications move heavy computation into dedicated workers to keep the main thread responsive — data processing, cryptography, image manipulation, WebAssembly calls. Without profiling support in workers, developers had to rely on external DevTools profiling or indirect measurement: per the explainer, existing worker performance APIs “reveal when tasks are slow, but not why” — they cannot attribute CPU cost to specific JS stacks inside the worker event loop.

The JS Self-Profiling API lets scripts collect low-overhead statistical call-stack samples of their own execution and report them as structured traces. Extending it to dedicated workers gives performance engineers exact CPU attribution for offloaded work without a DevTools/CDP session.

Source: Document Policy in Workers explainer (motivation, quoted); JS Self-Profiling draft

examples

Inside a dedicated worker whose script response carries Document-Policy: js-profiling (flags enabled, Chrome 147):

// worker.js — served with:  Document-Policy: js-profiling
// Loaded as a MODULE worker so top-level await below is valid:
//   new Worker("/worker.js", { type: "module" })
if (typeof Profiler !== "function") {
  postMessage({ unsupported: true });   // trial off / policy missing
} else {
  const profiler = new Profiler({
    sampleInterval: 10,     // ms between samples
    maxBufferSize: 10_000,  // samples before sampling auto-stops
  });

  await doHeavyWork();

  const trace = await profiler.stop();
  // trace is a ProfilerTrace: { resources, frames, stacks, samples }
  postMessage({ trace });
}
Live example from the Chrome Platform Showcase (route HEAD-checked 200, 2026-09-27). Sibling concept demos: profiler API explorer, profile comparator, upload trace, and compatibility lab.Source: chrome-platform-showcase
Source: snippet gendn-derived from the draft IDL and the trace shape on MDN (labelled accordingly)

browser compatibility

Per-version data for the base Profiler interface from BCD api/Profiler.json (verified 2026-09-27); BCD has no worker-support subfeature yet, so that row is interim ChromeStatus data:

CapabilityChromeFirefoxSafari
Profiler on the main thread (BCD)94Not shipped (impl bug)Not shipped
Profiler in dedicated workers (no BCD subfeature yet; interim)Developer trial in 147 behind flags (ChromeStatus; no ship milestone set)No signal — the record’s view notes Firefox “has not shipped JS Self-Profiling; no specific signal on the worker extension”No signal — same note for Safari on the record

Feature-detect inside the worker (typeof Profiler === "function") and degrade to coarser instrumentation (User Timing, PerformanceObserver) when absent.

Source: BCD api/Profiler.json; webstatus.dev profiler; ChromeStatus API record (vendor view notes)

security and privacy

The draft’s Privacy and Security section shields cross-origin script: samples only include functions “defined in a script served with CORS-same-origin” (via the muted-errors property), and browser builtins are included only when invoked from CORS-same-origin script — so the API “does not expose any new insight into the contents or execution characteristics of cross-origin script” beyond what manual instrumentation already allows. Access is additionally opt-in per response through the Document-Policy: js-profiling gate (constructor throws NotAllowedError otherwise), which in a dedicated worker is the worker script’s own policy per the companion reference.

Source: JS Self-Profiling draft — Privacy and Security (quoted)

specifications

SpecificationSection
JS Self-Profiling API (WICG Draft Community Group Report)The Profiler interface

see also