- What it is: a compiled “prelude” bundle for Meta/Facebook’s Comet runtime. It’s the bootstrap that sets up the page’s module loader, error handling, perf timers, session/cookie logic, and secure JS execution before app code runs.
- Key subsystems I can spot (high-level):
- Module system:
__d,require,Bootloader,HasteResponse,ServerJS— loads resources (JS/CSS), resolves dependencies, and executes server-pushed payloads. - Error + telemetry:
ErrorGuard,ErrorPubSub,FBLogger, normalizers/serializers; reports exceptions and bootload timing; queueing via Banzai. - Performance + scheduling:
performanceNow, User Timing marks, QPL hooks,JSScheduler(React Scheduler) with priority levels and profiling. - Network/heartbeat: small
/nw/pinger, offline detection + retry logic. - Session/cookies:
WebSession(tab/session ID, expiry),CookieConsent, DTSG/LSR tokens wiring for requests (getAsyncParams). - Security hardening: Trusted Types policies (default + Meta/bootloader data-URI policy), CSRF guard, URI parsing/whitelisting for script URLs.
- DOM hooks: visibility listeners, event emitters, polyfills, and (in Hyperion sections) timer/interceptor wrappers.
- Comet prelude: kicks off the boot load (
CometPrelude*), processesdata-sjsserver payloads, disables animations on low-core devices, etc.
- Module system:
- Why it exists: to reliably initialize the app across browsers/workers, load chunks tier-by-tier, capture metrics, and enforce security (Trusted Types/CSRF) before user code runs.
- Security vibe: nothing custom/malicious — it’s standard Meta bootstrap logic:
- Enforces Trusted Types (prevents DOM XSS sinks from raw strings).
- Adds CSRF/DTSG tokens to requests.
- Controls which script URLs are allowed (facebook.net, fbcdn, etc.).
- If you’re evaluating it:
- Expect define/require calls, Bootloader resource fetches, and ServerJS JSON “payloads” executed via
<script data-sjs>…. - Performance marks (
measureStart/End), QPL annotations, and scheduler callbacks will appear in timelines. - It will retry failed loads and gate “immediate” vs “deferred” bootloads.
- Expect define/require calls, Bootloader resource fetches, and ServerJS JSON “payloads” executed via
If you want, I can extract the most important entry points (e.g., how Bootloader.loadModules paths through to ServerJS.handle) or map the Trusted Types policies to the exact sinks they cover.