Skip to content

Facebook cookie tracking is dead code, and broken since Electron 44 #720

Description

@micahflee

Split out of #719, which fixed the same underlying problem for X. Filing rather than fixing, because the right answer for Facebook is probably deletion, not a port.

The underlying finding

Chromium stopped exposing the Cookie request header to webRequest listeners. BaseAccountController registers ses.webRequest.onSendHeaders(...), and handleCookieTracking reads details.requestHeaders["Cookie"] out of it, so that map no longer fills.

Verified with the same listener on both runtimes:

Electron Chromium requestHeaders["Cookie"]
41.10.7 146 ct0=PROBEVALUE
44.4.3 152 null

For X this broke login outright: getCookie returned null, graphqlGetViewerUser logged ct0 is null, and the account was left with no username.

Why Facebook is different

Nothing reads Facebook's cookies. FacebookAccountController declares a cookies field and writes to it in handleCookieTracking, but there is no getCookie method, no IPC handler, and no preload binding — getCookie is exposed only as X:getCookie. The map has been write-only since it was added.

So there is no user-visible breakage to fix. What is there is dead code that also stopped working, plus a trap: anyone who later adds a Facebook cookie reader against this map gets silent nulls, which is a slow thing to debug.

Options

  1. Delete it. Remove the cookies field and the handleCookieTracking override. The base class already has a no-op default (added in Upgrade dependencies: 79 advisories down to 24, no criticals #719), so nothing else has to change. If that leaves X and Facebook both opted out, the onSendHeaders registration in BaseAccountController can go too.
  2. Give Facebook a working getCookie on the model X now uses — session.cookies.get({ url, name }) — but only if there is a near-term need for it. X needs cookies for GraphQL deletes; it is not clear Facebook has an equivalent.

Option 1 unless someone knows of planned work that needs Facebook cookies.

Pointers

  • X fix: commit 609b78a1 on deps-upgrade-2026-09, plus src/account_x/__tests__/unit/controller.cookies.unit.test.ts for the shape of a test that does not presuppose the header.
  • The mock in src/__tests__/platform-fixtures/electronMocks.ts supplies a Cookie header to onSendHeaders, so the suite cannot currently catch this class of failure. It now also has a seedable cookie jar.
  • Facebook code: src/account_facebook/facebook_account_controller.ts, the cookies field and handleCookieTracking.

(This was written by an LLM.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions