fix(wa-2.3000): concurrent-inject guard + dual-compat serialized ids (#201893 + #201840) - #147
Merged
Merged
Conversation
Cherry-pick + reconcile two upstream open PRs for WA Web 2.3000.x breakage: - wwebjs#201893 (fix/concurrent-inject-race): serialize inject() per Client via _injectQueue, split inject()/_inject(), route framenavigated through _handleFrameNavigated with inject_error emit, and treat the duplicate Puppeteer binding error as idempotent in exposeFunctionIfAbsent. Fixes the 'onLogoutEvent already exists' unhandled rejection. - wwebjs#201840 (fix/wa-web-1043-serialized-compat): add widSerialized()/ normalizeSerialized() helpers, wire into getMessageModel/getChatModel, dual message id for downloadMedia/downloadMediaStream, and resolveMediaBlob DownloadManager fallback for missing/thumbnail blobs. Reconciled against our existing LID/_serialized work (rebuildKeySerialized, Message from/to/author $1 fallbacks, __x_id drop kept as ours; adopted widSerialized + try/catch fault isolation in getChatModel lastMessage). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Cherry-pick + reconcile two upstream open PRs that fix the WhatsApp Web 2.3000.x breakage (WA renamed MsgKey/WID
_serialized→$1and moved to@lidids), reconciled against our fork's existing LID/_serializedwork.Included
inject()perClientvia_injectQueue, splitsinject()/_inject(), routesframenavigatedthrough_handleFrameNavigatedand emitsinject_errorinstead of an unhandled rejection, and treats the duplicate Puppeteer binding error as idempotent inexposeFunctionIfAbsent.→ Fixes the
Failed to add page binding with name onLogoutEvent: window['onLogoutEvent'] already exists!crashes seen in prod logs.widSerialized()/normalizeSerialized()helpers, wires them intogetMessageModel/getChatModel, uses a dual message id fordownloadMedia/downloadMediaStream, and adds aresolveMediaBlobDownloadManager fallback for missing/thumbnail blobs.Reconciliation notes
rebuildKeySerializedlogic andMessage.from/to/author|| $1fallbacks (functionally equal to the PR's?? $1).delete message.__x_idmedia fix (already ourmain-rebasedtip).widSerialized()atgetMessageModel/createWidcall sites and thetry/catchfault-isolation around thegetChatModellastMessage lookup.Verification
node --checkpasses on all four changed files.Not included (follow-up)
_serializedprototype getter — fixessendMessagereturningundefineddespite delivery) and fix(Utils): resolve getChats() CDP 'r: r' on WhatsApp Web 2.3000.x ($1 rename + fault-isolated getChatModel) wwebjs/whatsapp-web.js#201910'sPromise.allSettledfault-isolation ingetChats/getChannelsare recommended next.🤖 Generated with Claude Code