Rename WebView postMessage method to postMessageNative.#12997
Rename WebView postMessage method to postMessageNative.#12997soldovskii wants to merge 3 commits intofacebook:masterfrom soldovskii:master
Conversation
…ssage" breaks the functional of some scripts in WebView using cross-domain communication via postMessage. Example: https://api-maps.yandex.ru/2.1/?lang=ru_RU
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
I think something like |
|
Just ran into this today. Real pain :( |
|
The current implementation is completely 100% broken and unusable. Using it results in a red page that says Given that context, I think we should merge this. Something is clearly better than nothing. And even nothing is better than something that's 100% broken. |
|
100% agree with @mcmar we are needing to be able to use onMessage for an app we are building. |
|
Current implementation breaks for webviews that load Meteor js content, which uses |
|
I believe we can fix this without breaking backward compatibility. What if we can call |
|
In the case for RN Webviews I think its safe to assume we are using If so, if the concern is breaking backwards compatibility, does it make sense to instead have a parallel |
|
@mkonicek is this an acceptable PR to solve #10941 ? |
|
@twairball Did you solve your problem. I m facing same issue. |
|
@soldovskij I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
|
@nazrdogan the proposed changes in this PR work. I made my own fork for current version react-native (warning; lots of work) and added similar changes for renaming |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
|
This should definitely not be closed. |
|
Yeah, so this issue (see here: #10865) was brought up in 2016 and I'm still getting it in production. And a bot automatically closes a PR to fix this? Get it together you guys. |
|
This PR is something we MUST have. Currently, it conflicts several web SDKs including Google's, which relies on |
Rename WebView postMessage to postMessageNative. The old name "postMessage" breaks the functional of some scripts in WebView using cross-domain communication via postMessage. Example: https://api-maps.yandex.ru/2.1/?lang=ru_RU
Motivation (required)
The old name "postMessage" breaks the functional of some scripts in WebView using cross-domain communication via postMessage. This bug avalible if WebView has onMessage callback.
Test Plan (required)
Not working

Working

Send message to react-native WebView - window.postMessageNative("data", "*");
Replace original window.postMessage - bad idea;