Using airgap.js in Web Workers
Configuring realm auto-protection
Overview
airgap.js 9.118.0 and later can protect web workers.
Limitations
airgap.js does not yet support consent sync within protected worker threads. This means that quarantined events aren’t replayed when consent changes outside the worker's realm, so quarantined events are effectively blocked.
Loading airgap.js
In order to apply airgap.js protections without our realm auto-protection hooks, use the following snippets:
Declare Environment Metadata
self.airgap = {
loadOptions: {
airgap: '[location of airgap.js]',
baseUrl: '[URL of the original worker script]',
},
};Import airgap.js
Classic worker
importScripts(self.airgap.loadOptions.airgap);