-
Notifications
You must be signed in to change notification settings - Fork 31
fix: resolve var hoisting bug in console bridge #1494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…hidden The console bridge had a critical bug where the 'seen' Set was used in the JSON.stringify replacer function before it was declared. Due to JavaScript var hoisting, 'seen' was undefined when accessed, causing TypeError that were caught and swallowed, hiding actual errors from the frame code. This fix moves the 'seen' declaration to before the try block where it's used, ensuring it's properly initialized. This will allow actual errors from attestation verification and other frame operations to be properly logged and visible for debugging. Impact: This bug was hiding 'Load failed' and other critical errors in WKWebView environments, making it impossible to diagnose attestation verification failures. Co-Authored-By: austin@paella.dev <austin@paella.dev>
Original prompt from austin@paella.dev |
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
🦋 Changeset detectedLatest commit: e0946dc The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: austin@paella.dev <austin@paella.dev>
Description
Fixes a critical JavaScript var hoisting bug in the React Native WebView console bridge that was hiding errors from the frame code.
The Problem:
The
seenSet variable was declared inside afinallyblock usingvar, but was accessed in thetryblock's JSON.stringify replacer function. Due to JavaScript var hoisting,seenwasundefinedwhen accessed, causingTypeError: Cannot read property 'has' of undefined. This error was caught and swallowed, returning'[Unserializable Object]'instead of the actual error message.The Impact:
This bug was hiding critical errors from the open-signer frame code running in WKWebView, including:
This made debugging WKWebView issues nearly impossible, as reported in https://crossmint.slack.com/archives/C09T6V4QSEQ/p1763238997415029.
The Fix:
seendeclaration to before thetryblock where it's usedvartoconstfor proper scopingvar seendeclarationTest plan
Unit tests should be added for the console bridge serialization logic in a follow-up.
Package updates
@crossmint/client-sdk-rn-window- patch version bump neededpnpm change:addto create changesetHuman Review Checklist:
Requested by: austin@paella.dev (@afeight)
Devin session: https://app.devin.ai/sessions/019ddb2501804c8d83765e0311cb6720