pub fn build_worker_script(identity: &Identity) -> StringExpand description
The worker-scope counterpart of build_stealth_script.
Workers are separate targets with separate realms and their own intrinsics, so
they need their own copy of PropertyModifier. They also need a different
script: worker scope has no window, no document, and no Navigator — the
interface is WorkerNavigator — so the main-world script throws on its first
statement there.
Delivered by CDP: auto-attach freezes each worker before it runs anything and
this is evaluated into it. That replaced an earlier approach that patched the
Worker constructor to re-host workers from a blob: URL — which could not
reach service workers at all (the platform rejects blob: for register()) and
left a trail to cover up (WorkerLocation, a MessageEvent.data rewrite).