You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
InjectJavascriptAsync can return the result of a different call (calls are not synchronized). The problem is that, on Android in FormsWebViewRenderer, there is a shared instance of JavascriptCallbackValue which holds the result that is reused for all calls to InjectJavascriptAsync on that FormsWebView. If two calls to InjectJavascriptAsync are running in parallel, the first result returned from one of the pending invocations will be returned as the result for ALL pending InjectJavascriptAsync invocations.
To Reproduce
Steps to reproduce the behavior:
call InjectJavascriptAsync which delays for 3000ms returns "Invocation1" and assign the Task<string> result to a local variable
call InjectJavascriptAsync which immediately returns "Invocation2" and assign the Task<string> result to a second local variable
await the two Tasks and assign the results to local variables
notice that the result of the Task<string> from the second call to InjectJavascriptAsync gets the result "Invocation1"
Expected behavior
The second call to InjectJavascriptAsync should get the result "Invocation2"
Smartphone (please complete the following information):
Device: ANY
OS: Android
The text was updated successfully, but these errors were encountered:
tossingc
added a commit
to tossingc/Xam.Plugin.Webview
that referenced
this issue
Jan 18, 2019
…lt of a different call
1. added sample page which tests this behavior
2. [Droid] modified FormsWebViewRenderer to create a new instance of JavascriptValueCallback for each call to InjectJavascriptAsync
tossingc
added a commit
to tossingc/Xam.Plugin.Webview
that referenced
this issue
Jan 18, 2019
…lt of a different call
1. added sample page which tests this behavior
2. [Droid] modified FormsWebViewRenderer to create a new instance of JavascriptValueCallback for each call to InjectJavascriptAsync
…vascriptAsync-can-return-the-result-of-a-different-call
Fix#5 - Droid: InjectJavascriptAsync can return the result of a different call
1. added sample page which tests this behavior
2. [Droid] modified FormsWebViewRenderer to create a new instance of JavascriptValueCallback for each call to InjectJavascriptAsync
3. revert previous hacky fix which synchronized every call to InjectJavascriptAsync (will cause performance issues)
fixes#5 (corresponding issue in SKLn-Rad repo is 116 - SKLn-Rad#116)
Describe the bug
InjectJavascriptAsync can return the result of a different call (calls are not synchronized). The problem is that, on Android in FormsWebViewRenderer, there is a shared instance of JavascriptCallbackValue which holds the result that is reused for all calls to InjectJavascriptAsync on that FormsWebView. If two calls to InjectJavascriptAsync are running in parallel, the first result returned from one of the pending invocations will be returned as the result for ALL pending InjectJavascriptAsync invocations.
To Reproduce
Steps to reproduce the behavior:
Task<string>
result to a local variableTask<string>
result to a second local variableTask<string>
from the second call to InjectJavascriptAsync gets the result "Invocation1"Expected behavior
The second call to InjectJavascriptAsync should get the result "Invocation2"
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: