Skip to content
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

Add logs and fixes a race condition in CryptoWebView #1241

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

zatteo
Copy link
Contributor

@zatteo zatteo commented Sep 3, 2024

### ✨ Features

*

### πŸ› Bug Fixes

* Fixes a race condition in CryptoWebView leading to a blue screen

### πŸ”§ Tech

* Add more logs in CryptoWebView

Checklist

Before merging this PR, the following things must have been done if relevant:

  • Tested on iOS
  • Tested on Android
  • Test coverage
  • README and documentation

- Forward errors from CryptoWebView to React Native side to log them
- Add a title to CryptoWebView to help finding it on Chrome debugger
@@ -23,6 +23,8 @@ const jsCode = `
generateHttpServerSecurityKey,
sublteProxy
}

postMessage(JSON.stringify({ isReady: true }))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si on ralentit le code au dΓ©but de ce jsCode avec une boucle qui tourne pour rien, onLoadEnd peut se dΓ©clencher beaucoup trop tΓ΄t.

We use react-native-webview onLoadEnd callback to set the
CryptoWebView as ready. It is an important action because other
webviews are rendered only when the CryptoWebView is ready. But the
onLoadEnd can be triggered before the javascript, where we add
our crypto functions, is executed.
It is also executed two times (I do not understand why). So here I
send a post message from the CryptoWebView to indicate that it is
ready.

It fixes a race condition we may encounter more and more.
ios/Podfile.lock Outdated
@@ -1025,7 +1025,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
boost: 7dcd2de282d72e344012f7d6564d024930a6a440
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should be removed from the PR?

@zatteo zatteo merged commit 980fe77 into master Sep 6, 2024
1 check passed
@zatteo zatteo deleted the fix/error-in-crypto-webview branch September 6, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants