You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "jcesarmobile (Jira)" <ji...@apache.org> on 2019/11/29 12:43:00 UTC

[jira] [Closed] (CB-10774) CDVUIWebView performs javascript synchronous, but command queue expects it to be async

     [ https://issues.apache.org/jira/browse/CB-10774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jcesarmobile closed CB-10774.
-----------------------------
    Resolution: Won't Do

closing since UIWebView is deprecated and it's usage will be removed in next major version 

> CDVUIWebView performs javascript synchronous, but command queue expects it to be async
> --------------------------------------------------------------------------------------
>
>                 Key: CB-10774
>                 URL: https://issues.apache.org/jira/browse/CB-10774
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios
>    Affects Versions: 4.1.0
>            Reporter: Torsten Freyhall
>            Assignee: Shazron Abdullah
>            Priority: Major
>              Labels: cordova-ios-4.1.1
>
> From https://issues.apache.org/jira/browse/CB-10530 regarding app freezing at launch.
> ...
> However I was not sure about why the timer resolves due to long script execution times though. It seems like the intention is that whenever gap://ready is loaded in the iframe, the immediate response from the native side should be to call nativeFetchMessages() which should clear the timeout.
> Therefore I dug a little deeper in the native side, and found that the evaluateJavaScript:completionHandler: in CDVCommandQueue expects implementation to to be async (a comment in the code says so), but the CDVUIWebViewEngine method actually is implemented synchronous.
> I wrapped the entire method in a dispatch_async call (maybe a very naive solution, it might mess with references?):
> {code}
> dispatch_async(dispatch_get_main_queue(), ^{
>   NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString:javaScriptString];
> if (completionHandler)
> { completionHandler(ret, nil); }
> });
> {code}
> This also solves the original issue on cordova-ios 4.0.1 as the timeout never resolves, so maybe asyncing this method should also be a part of the proper fix?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org