Skip to content

Phabricator: execute extension host worker in an iframe

Administrator requested to merge phabricator-worker-csp into master

Created by: lguychard

Rel #2415

In newer Phabricator versions, the CSP prevents us from spawning an inline worker using blob:. This circumvents it by creating an iframe, and spawning the extension host worker from within that iframe. The MessagePort objects used to communicate with the extension host are sent to the iframe using postMessage (which allows transferring MessagePort objects), and forwarded to the extension host worker. Since the origin of the iframe is the Sourcegraph instance, the worker bundle can be fetched without running into CSP restrictions.

@felixfbecker @chrismwendt would love your thoughts on this. Is there a simpler solution I would've missed? Do you have any concerns about this solution?

Merge request reports

Loading