← Chrome 150 reference

v150 · security · workers · origins

Opaque origin for data: URLs

Chrome 150 assigns a unique opaque origin to Dedicated Workers and Shared Workers created from data: URLs, rather than inheriting the creator's origin. This aligns Chrome with the HTML specification, with Firefox, and with Safari, closing a same-origin access path from these workers to their creator's storage and channels.

at a glance

Shipped inChrome 150 (Enabled by default)
StatusEnabled by default
SpecHTML Living Standard — Worker settings object
Standards position (Firefox)Shipped/Shipping
Standards position (Safari)Shipped/Shipping
ChromeStatus6290352295247872 — Opaque origin for data: URLs
Source: chromestatus.com/feature/6290352295247872

why it exists

Before Chrome 150, a data: URL worker automatically inherited the same origin as the page that created it — for example, new Worker('data:text/javascript,...') from https://example.com ran with origin https://example.com. This meant the worker could:

The HTML Living Standard (step 3 of the Worker settings object algorithm) specifies that workers created from opaque URLs such as data: should receive a unique opaque origin. Chrome 150 implements this. The worker still shares the same storage partition as its creator (so quota accounting is unchanged), but it no longer shares the creator's same-origin privileges.

Source: HTML Living Standard §Worker settings object; chromestatus feature summary

what changes

ContextChrome 149 and earlierChrome 150+
new Worker('data:...') from https://example.comWorker origin = https://example.comWorker origin = unique opaque origin
BroadcastChannel from that workerReceives messages from same-origin pagesIsolated — no same-origin channel access
Same-origin storage accessAllowed (localStorage, indexedDB, etc.)Blocked for cross-origin storage; partition preserved
Shared Workers via data: URLInherited originOpaque origin
Source: chromestatus feature summary

example

// Before Chrome 150: worker inherited https://example.com origin.
// After Chrome 150: worker has a unique opaque origin.

const workerCode = `
  // This BroadcastChannel will no longer receive messages from the
  // parent page's origin in Chrome 150+ — the worker is now isolated.
  const bc = new BroadcastChannel('updates');
  bc.onmessage = (e) => console.log('received', e.data);
`;
const blob = new Blob([workerCode], { type: 'text/javascript' });
const url = URL.createObjectURL(blob); // blob: URLs retain creator origin
// ^ Use blob: URLs (still inherits origin) for workers that need same-origin access.
// data: URLs now produce opaque origins.

// Prefer blob: URLs when same-origin communication is intended:
const w = new Worker(url);

// data: URL workers are safe for sandboxed computation:
const sandboxed = new Worker('data:text/javascript,' + encodeURIComponent(workerCode));
// sandboxed.origin is opaque — can't reach parent's storage or channels.
Source: HTML Living Standard §Worker settings object

browser support

BrowserSupportNotes
Chrome 150+Enabled by defaultDesktop and mobile
FirefoxShippedAlready uses opaque origins for data: URL workers
SafariShippedAlready uses opaque origins for data: URL workers
Source: chromestatus.com/feature/6290352295247872

see also