cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AlexMouton <...@git.apache.org>
Subject [GitHub] cordova-ios pull request: Moved commandQueue push into non-WK_WEBV...
Date Thu, 09 Apr 2015 22:25:23 GMT
GitHub user AlexMouton opened a pull request:

    https://github.com/apache/cordova-ios/pull/136

    Moved commandQueue push into non-WK_WEBVIEW_BINDING branch.

    Hi Shazron
    I am working on an html5 video game that is packaged for ios using cordova.
    We were having memory issues with UIWebView and have integrated your work on WKWebView
recently.
    Its working great for the performance! thanks! but, we are of course feeling alpha growing
pains.
    
    One thing we have noticed is that when we invoke the cordova Barcode plugin, it is always
called twice!
    
    I have only looked at the code a short time, but it appears to me that:
    * the first call to Barcode happens, and in iosExec, it gets placed in commandQueue.
    * the first call passes to Objective C world by WKScriptMessageHandler - (void)userContentController:(WKUserContentController*)userContentController
didReceiveScriptMessage:(WKScriptMessage*)message
    * this call to Barcode does its thing, completes, and it's javascript response handler
code winds through:
        CDVCommandDelegateImpl::sendPluginResult
        CDVCommandDelegateImpl::evalJSHelper
        CDVCommandDelegateImpl::evalJSHelper2
    * in Helper2, the callback is finally passed to a webViewEngine, which processes the Javascript,
and returns, on completion, a list of commands remaining in the javascript commandQueue.
    * these commands are queued on the Obj-C side and run in CDVCommandQueue fashion.
    
    AHA!
    
    * since the command was persisted in commandQueue before execution, and not removed, it
is called again!
    
    SO
    
    I moved the enqueue behavior into the branch that excludes bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING
    This fixes it, but I am not confident its the right solution.
    
    Do you have any insight into this problem?
    Feedback for my solution?
    A broader or more appropriate venue for the conversation?
    
    Thanks!
    Alex Mouton

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/skcamp/cordova-ios CB-8838-wkwebview-double-call

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-ios/pull/136.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #136
    
----
commit a4ff60b961c567e1de9077474ee76bbf0874341d
Author: Alex Mouton <thomas.mouton@gmail.com>
Date:   2015-04-09T22:16:40Z

    Moved commandQueue push into non-WK_WEBVIEW_BINDING branch.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message