← Chrome 157 reference

v157 · enabled by default · miscellaneous · service workers

Expose ProgressEvent in service workers

Baseline Widely available (parent XMLHttpRequest feature) · service-worker exposure new in Chrome 157

  • Chrome · 157 in service workers (1 in Window; 47 in dedicated/shared workers)
  • Edge · Chromium-based; service-worker exposure not independently verified
  • Firefox · exposed to all workers incl. service workers (verified in 140 release IDL)
  • Safari · exposed to all workers incl. service workers (verified in WebKit-7614 release source)

ProgressEvent belongs to the xhr web-feature, which webstatus.dev reports as Baseline Widely available (newly available 2015-07-29, widely 2018-01-29; queried 2026-11-15). That status describes the interface as a whole, not its availability inside service workers: BCD api/ProgressEvent.json still marks Chrome’s worker_support as a partial implementation “not available in service workers” (fetched 2026-11-15). This page documents the Chrome 157 change that closes that gap; no separate Baseline date exists for it.

The XMLHttpRequest Standard declares ProgressEvent with [Exposed=(Window,Worker)], and a service worker’s global scope is a Worker global, so the interface belongs there. Blink, however, exposed it only to Window, dedicated workers and shared workers. From Chrome 157, ProgressEvent is also a global constructor in ServiceWorkerGlobalScope, so service-worker code can construct progress events with lengthComputable, loaded and total and reuse progress-reporting code across every worker type. The change reuses the existing implementation; it does not add XMLHttpRequest to service workers or make fetch() fire progress events.

at a glance

What changesself.ProgressEvent is defined in ServiceWorkerGlobalScope; previously typeof ProgressEvent was "undefined" there
What does not changeThe interface, its constructor and its three attributes are byte-for-byte the existing Blink implementation; no new members, no XMLHttpRequest in service workers, no automatic progress events from fetch()
ShippedChrome 157 (desktop, Android, WebView per the ChromeStatus API record); CL 8425503 merged 2026-10-13 at refs/heads/main@{#1717288}, first landed in 157.0.8103.0
Runtime featureProgressEventInServiceWorker, status: "stable" in runtime_enabled_features.json5 — on by default, retained as a Finch kill switch; no chrome://flags entry
Intent threadsIntent to Prototype · Intent to Ship (three LGTMs)
Trackingissues.chromium.org/332663431 · blink component Blink
ChromeStatuschromestatus.com/feature/5069584943153152 (listed under “Enabled by default” in the milestone=157 listing)
Source: ChromeStatus API record, CL 8425503, Chromium Dash commit record, all read 2026-11-15

Syntax

The interface, verbatim from XMLHttpRequest Standard §5 Interface ProgressEvent. Every member below is documented on this page: constructor, ProgressEventInit, lengthComputable, loaded, total.

[Exposed=(Window,Worker)]
interface ProgressEvent : Event {
  constructor(DOMString type, optional ProgressEventInit eventInitDict = {});

  readonly attribute boolean lengthComputable;
  readonly attribute double loaded;
  readonly attribute double total;
};

dictionary ProgressEventInit : EventInit {
  boolean lengthComputable = false;
  double loaded = 0;
  double total = 0;
};

The Chrome 157 change is entirely in Blink’s [Exposed] list. progress_event.idl at main (fetched 2026-11-15) now gates the ServiceWorker exposure on the ProgressEventInServiceWorker runtime feature:

[
    Exposed(Window StableBlinkFeatures,
            DedicatedWorker StableBlinkFeatures,
            SharedWorker StableBlinkFeatures,
            ServiceWorker ProgressEventInServiceWorker)
] interface ProgressEvent : Event { /* members unchanged */ };

In script, the only new syntax is that this now works inside a service worker:

// sw.js, Chrome 157+
const event = new ProgressEvent("progress", { lengthComputable: true, loaded: 512, total: 2048 });
Source: XHR Standard IDL; Blink progress_event.idl; CL 8425503

Service-worker exposure

The Service Workers specification declares [Global=(Worker,ServiceWorker), Exposed=ServiceWorker, SecureContext] interface ServiceWorkerGlobalScope. Because the XHR Standard exposes ProgressEvent to every Worker global, the specification has always required it in service workers; Chrome 157 implements that requirement. After the change, inside a service worker typeof ProgressEvent === "function", "ProgressEvent" in self is true, and ProgressEvent.prototype inherits from Event.prototype exactly as in a window.

Inputs
None of its own: exposure adds a global binding. Construction inputs are the constructor parameters and ProgressEventInit, identical to every other realm.
Observable effects
A new own property ProgressEvent on the service worker global object, visible to feature detection and to Object.getOwnPropertyNames(self). Blink’s service-worker interface-listing expectations (default and virtual/stable) were updated in the CL to include it. Verified at runtime: in Chrome 153.0.8010.12 a service worker reported typeof ProgressEvent === "undefined"; in Chrome 157.0.8103.78 and 158.0.8127.18 the same worker reported "function" and constructed an event with the expected values (gendn headless test, 2026-11-15).
What is not added
XMLHttpRequest stays undefined in service workers (runtime-checked in 157.0.8103.78), and fetch() does not dispatch progress events; per the ChromeStatus motivation, the change “reuses the existing implementation without exposing XMLHttpRequest or adding automatic fetch progress events.” Any ProgressEvent in a service worker is one your code constructs and dispatches, so isTrusted is always false.
Errors
Exposure has no error path of its own; it only defines a previously undefined global. Code that ran new ProgressEvent(…) in a service worker before Chrome 157 got a ReferenceError: ProgressEvent is not defined; that is the failure feature detection guards against. Construction errors are listed under constructor exceptions.
Context
Available in every service worker in Chrome 157+ (service workers themselves require a secure context, per the [SecureContext] on ServiceWorkerGlobalScope). No permission, origin trial, header or policy is involved. Window, dedicated-worker and shared-worker exposure are unchanged (Chrome 1 and 47 respectively, per BCD).
Lifecycle
The binding exists for the whole life of each service worker global, from script evaluation until the worker is terminated; it is not tied to install, activate or any event. The ProgressEventInServiceWorker runtime feature is status: "stable", so it is on by default; the CL message says the feature is retained “as a Finch kill switch”, meaning Google could disable it server-side if a compatibility problem appeared. Always feature-detect rather than branch on the Chrome version.
Compatibility risk
The ChromeStatus record rates it low, but notes that adding the global “may change feature-detection results or interact with application-defined ProgressEvent polyfills in service workers.” A polyfill that does self.ProgressEvent = class … unconditionally now overwrites the native constructor; guard it with if (typeof ProgressEvent !== "function").
Source: Service Workers spec, ServiceWorkerGlobalScope IDL; XHR Standard; CL 8425503; ChromeStatus API record

ProgressEvent() constructor

Creates a new, untrusted ProgressEvent. It follows the DOM Standard’s event constructor steps: the event is created with isTrusted false, the init dictionary members are copied onto the matching attributes, and the event is not dispatched until you call dispatchEvent().

new ProgressEvent(type)
new ProgressEvent(type, eventInitDict)

Parameters

type
A string, the event name (required). Converted with WebIDL DOMString rules, so null becomes "null". The XHR Standard suggests loadstart, progress, error, abort, timeout, load and loadend (see event sequence), but any name is accepted.
eventInitDict (optional)
A ProgressEventInit dictionary. Defaults to {}, giving lengthComputable: false, loaded: 0, total: 0, bubbles: false, cancelable: false, composed: false.

Return value

A new ProgressEvent whose type is type, whose target and currentTarget are null, whose eventPhase is Event.NONE, whose isTrusted is false, and whose lengthComputable, loaded and total equal the dictionary values. There is no legacy initProgressEvent() method (asserted by the WPT test below).

Exceptions

TypeError
Thrown when type is omitted (new ProgressEvent()), when eventInitDict is not an object, null or undefined, or when loaded or total is a non-finite number (NaN, Infinity, -Infinity). The last rule follows from the WebIDL double type (restricted, not unrestricted double). Verified in Chrome 153, 157 and 158 in window, dedicated-worker and service-worker realms (gendn headless test, 2026-11-15).
Values that do not throw
Negative and fractional numbers are accepted unchanged (loaded: -1 reads back -1). Non-number values are converted, not rejected: { lengthComputable: "hah", loaded: "2" } gives true and 2. Dictionary keys are case-sensitive, so { lengthcomputable: true } is ignored. All of these cases come from the WPT test xhr/progressevent-constructor.any.js.

Example

// Works the same in a window, a dedicated/shared worker, and (Chrome 157+) a service worker.
const event = new ProgressEvent("progress", {
  lengthComputable: true,
  loaded: 1.5,
  total: 3,
});
event.lengthComputable; // true
event.loaded;           // 1.5
event.total;            // 3
event.isTrusted;        // false — script-constructed

try {
  new ProgressEvent("progress", { loaded: NaN });
} catch (err) {
  err.name;             // "TypeError" — loaded/total must be finite
}
Source: XHR Standard constructor; DOM Standard event constructor; WPT progressevent-constructor.any.js

ProgressEventInit dictionary

Inherits bubbles, cancelable and composed (all default false) from the DOM Standard’s EventInit, and adds:

ProgressEventInit members
MemberTypeDefaultSets
lengthComputablebooleanfalseevent.lengthComputable
loadeddouble (finite)0event.loaded
totaldouble (finite)0event.total

No member is validated against another: the constructor will happily build { lengthComputable: true, loaded: 9, total: 3 }. Keeping the values consistent is the caller’s job. When the platform itself fires a progress event, the XHR Standard’s fire a progress event algorithm sets loaded to the bytes transmitted and, only when the length is non-zero, sets lengthComputable to true and total to the length. Mirror that rule when constructing events by hand.

Source: XHR Standard ProgressEventInit; DOM Standard EventInit

ProgressEvent.lengthComputable

Read-only boolean. The getter returns the value the event was initialized with (spec getter steps). It tells the consumer whether loaded / total is a meaningful ratio; when it is false, show an indeterminate indicator instead of a percentage.

event.lengthComputable // boolean, default false

Assigning to it is ignored in sloppy mode and throws a TypeError in strict mode (and in modules), because it is an accessor without a setter; set it through the constructor instead.

Source: XHR Standard lengthComputable

ProgressEvent.loaded

Read-only double. The getter returns the initialized value (spec getter steps): the amount of work done so far, in whatever unit you chose. For events the browser fires for HTTP transfers it is a byte count; for events you construct it can be any finite number, such as a 0–1 fraction paired with total: 1.

event.loaded // double, default 0

The type was unsigned long long before Chrome 136; Update ProgressEvent to use double type for ‘loaded’ and ‘total’ changed it to double, so every Chrome release that has service-worker exposure (157+) uses double. Read-only semantics match lengthComputable.

Source: XHR Standard loaded; ChromeStatus double-type change

ProgressEvent.total

Read-only double. The getter returns the initialized value (spec getter steps): the total amount of work, or 0 when unknown. In a service worker the usual source is the response’s Content-Length header. That header gives the encoded (possibly compressed) size while a response body stream yields decoded bytes, so a hand-built loaded can exceed total for compressed responses. Clamp, or treat the length as not computable, when Content-Encoding is present.

event.total // double, default 0
Source: XHR Standard total

Event sequence and delivery

A constructed ProgressEvent is inert until dispatched. In a service worker you dispatch it to an EventTarget you own (there is no XHR object to fire it at); listeners run synchronously inside dispatchEvent(). The XHR Standard’s non-normative suggested names define the conventional order: loadstart once, then progress zero or more times, then exactly one of error, abort, timeout or load, then loadend once. It suggests bubbles and cancelable stay false.

A ProgressEvent cannot cross to a page. Client.postMessage() uses structured cloning, and events are not serializable, so structuredClone(event) throws a DataCloneError (verified in Chrome 157). Post the plain fields { type, lengthComputable, loaded, total } and rebuild the event on the receiving side, as the example below does.

Source: XHR Standard §5.2; DOM Standard dispatching events

Examples

Live example from the Chrome Platform Showcase: registers a service worker and asks it whether ProgressEvent exists in its global (route HEAD-checked 200, 2026-11-15). Sibling concept demos: which scopes have it and streaming download relay.Source: chrome-platform-showcase

Report download progress from a service worker

The service worker counts response bytes as they stream through, describes each step as a real ProgressEvent, and posts the fields to its window clients. On older engines it falls back to a plain Event with the same fields. Both files were run in headless Chrome 153 (fallback path) and Chrome 157.0.8103.78 (native path) against a 400 kB file; both produced matching progress/loadend messages and no errors (gendn test, 2026-11-15).

// sw.js
const hasProgressEvent = typeof ProgressEvent === "function"; // false before Chrome 157
const progress = new EventTarget();

function makeProgress(type, init) {
  return hasProgressEvent
    ? new ProgressEvent(type, init)
    : Object.assign(new Event(type), init); // fallback for older engines
}

async function forward(event) {
  // ProgressEvent is not serializable: post its fields, not the object.
  const clients = await self.clients.matchAll({ type: "window" });
  for (const client of clients) {
    client.postMessage({
      type: event.type,
      lengthComputable: event.lengthComputable,
      loaded: event.loaded,
      total: event.total,
    });
  }
}
progress.addEventListener("progress", forward);
progress.addEventListener("loadend", forward);

self.addEventListener("fetch", (event) => {
  if (!new URL(event.request.url).pathname.startsWith("/large/")) return;

  event.respondWith((async () => {
    const response = await fetch(event.request);
    if (!response.body) return response; // opaque responses expose no body

    const length = Number(response.headers.get("content-length")) || 0;
    let loaded = 0;
    const counter = new TransformStream({
      transform(chunk, controller) {
        loaded += chunk.byteLength;
        progress.dispatchEvent(makeProgress("progress", {
          lengthComputable: length !== 0, loaded, total: length,
        }));
        controller.enqueue(chunk);
      },
      flush() {
        progress.dispatchEvent(makeProgress("loadend", {
          lengthComputable: length !== 0, loaded, total: length,
        }));
      },
    });

    return new Response(response.body.pipeThrough(counter), {
      status: response.status,
      statusText: response.statusText,
      headers: response.headers,
    });
  })());
});
<!-- page.html -->
<progress id="bar" value="0"></progress>
<script>
  const bar = document.getElementById("bar");
  navigator.serviceWorker.addEventListener("message", (event) => {
    const { type, ...init } = event.data;
    const pe = new ProgressEvent(type, init); // rebuild a real ProgressEvent on the page
    if (pe.lengthComputable) {
      bar.max = pe.total;
      bar.value = pe.loaded;
    }
  });
  navigator.serviceWorker.register("/sw.js");
</script>

Feature detection

// Inside the service worker
const supported = typeof ProgressEvent === "function";
// Never overwrite a native constructor with a polyfill:
if (!supported) {
  self.ProgressEvent = class ProgressEvent extends Event {
    constructor(type, init = {}) {
      super(type, init);
      this.lengthComputable = Boolean(init.lengthComputable);
      this.loaded = Number(init.loaded ?? 0);
      this.total = Number(init.total ?? 0);
    }
  };
}

This polyfill is a convenience shape, not a faithful one: its fields are writable data properties and it does not throw for non-finite numbers.

Source: gendn-derived from the XHR Standard and the spec’s §5.4 progress-bar example; behaviour checked in Chrome 153 and 157

Web platform tests

CL 8425503 converted the constructor test to xhr/progressevent-constructor.any.js with // META: global=window,dedicatedworker,sharedworker,serviceworker, so the same ten assertions (defaults, no initProgressEvent, value conversion, decimals, negatives, case-sensitive keys) now run in a service worker. The former progressevent-constructor.html is gone upstream (404, 2026-11-15).

Source: WPT file; CL 8425503 file list

Browser compatibility

Two layers matter: whether ProgressEvent is available in a service worker (this change), and how the interface itself is supported. BCD has no service-worker-specific row; its worker_support row covers all workers and still flags Chrome as partial (fetched 2026-11-15). The first table therefore combines BCD with release-source and runtime evidence, and states every unknown explicitly.

ProgressEvent in service workers
BrowserVersionEvidence
Chrome (desktop)157Runtime-verified in 157.0.8103.78 (gendn headless test); undefined in 153.0.8010.12. BCD worker_support: 47, partial, “not available in service workers” (not yet updated)
Chrome Android157ChromeStatus android: 157; not device-tested
Android WebView157ChromeStatus webview: 157; not device-tested
EdgeUnknownChromium-based, so expected to follow Chrome 157, but no Edge-specific evidence; BCD mirror of Chrome’s partial row
FirefoxYes (first version unknown)Firefox 140 ProgressEvent.webidl [Exposed=(Window,Worker)] + ServiceWorkerGlobalScope.webidl Global=(Worker,ServiceWorker); BCD worker_support: 54
SafariYes (first version unknown)WebKit-7614 ProgressEvent.idl Exposed=(Window,Worker) + ServiceWorkerGlobalScope.idl Global=(Worker,ServiceWorker); BCD worker_support: 10
ProgressEvent interface and members (BCD, any context)
FeatureChromeEdgeFirefoxSafari
ProgressEvent1123.53.1
ProgressEvent() constructor1614186
lengthComputable1123.53.1
loaded1123.53.1
total1123.53.1
Worker support47 (partial: no service workers until 157)mirror of Chrome5410

Mobile columns (Chrome Android, Firefox for Android, Safari on iOS, Samsung Internet, WebView) are mirror entries in BCD. double typing of loaded/total differs by engine and release: Chrome since 136, Firefox 140 release IDL uses double, and the WebKit-7614 release source still used unsigned long long (WebKit main now uses double; the first Safari release with it is not recorded here). Under unsigned long long, fractional values are truncated and NaN converts to 0 instead of throwing.

Source: BCD api/ProgressEvent.json (raw, 2026-11-15); ChromeStatus API record; engine IDL files linked per row

Security and privacy

Constructing a ProgressEvent reveals nothing: it holds only the numbers your code supplies, and it adds no I/O, no new network access and no new cross-origin surface. The XHR Standard’s security considerations concern browser-fired progress events for cross-origin requests, where sizes must not leak without a CORS opt-in. That threat model carries over to hand-built events. A service worker sees an opaque response (response.body === null, unreadable length) for no-cors cross-origin fetches, so the example above cannot measure them. Do not work around that by forwarding Content-Length values from other origins to pages that could not read them directly. MDN’s guidance to normalize total (for example to 1) applies when exact byte counts would be sensitive. The ChromeStatus record lists security and privacy review as pending and no origin trial, permission or enterprise policy.

Source: XHR Standard §5.3; MDN ProgressEvent; ChromeStatus API record

Specifications

See also