cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-4788) Android InAppBrowser workaround for destructive PROMPT bridge problems
Date Wed, 11 Sep 2013 23:21:51 GMT

    [ https://issues.apache.org/jira/browse/CB-4788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13764938#comment-13764938
] 

Andrew Grieve commented on CB-4788:
-----------------------------------

I think a better fix here would be to change mobilespec to not open a cordova page in the
IAB. Unless there is some other use-case for wanting to do so?
                
> Android InAppBrowser workaround for destructive PROMPT bridge problems
> ----------------------------------------------------------------------
>
>                 Key: CB-4788
>                 URL: https://issues.apache.org/jira/browse/CB-4788
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android, mobile-spec, Plugin InAppBrowser
>    Affects Versions: 2.9.0
>            Reporter: Peter
>            Assignee: Joe Bowser
>
> We encountered the same problem as CB-4005 when running the manual mobile-spec tests.
> Please consider the following modified InAppBrowser code as a workaround to this issue.
> *Observations:*
> * If InAppBrowser uses Cordova API at all then the cordova.js falls back to using the
PROMPT bridge because there is no _cordovaNative defined by InAppBrowser.
> * The InAppBrowser’s onJsPrompt method (current implementation) is not capable of handling
the PROMPT bridge messages (eg "gap:", "gap_poll:" etc)
> The combination of the above causes the huge number of prompts which results in the application
non-responsiveness issues already described by CB-4005 and elsewhere.
> *Solution:*
> Change the IAB onJsPrompt to simply _ignore_ those unhandled messages from Cordova PROMPT
bridge. 
> * Since there is no ability for IAB to run the API calls anyway [Ref 3] no functionality
is lost. 
> * Now the mobile-spec tests for InAppBrowser can run OK without suffering the unresponsive
problems reported by CB-4005 and CB-3665
> Perhaps this is not be a true "fix", but it is certainly more forgiving than the current
implementation which just hangs.
> Here is my suggested modification for InAppBrowser.onJsPrompt()
> {code}
> @Override
> public boolean onJsPrompt(WebView view, String url, String message, String defaultValue,
JsPromptResult result) {
>     if (defaultValue != null) { 
>         // See if the prompt string uses the 'gap-iab' protocol. If so, the remainder
should be the id of a callback to execute.
>         if (defaultValue.startsWith("gap-iab://")) {            	
>             ...
>             // blah blah same code as before 
>             ...
>         }
>         /*
>          * IAP does not support ability to execute Cordova API calls so just gobble them
up
>          * and log a warning.
>          */
>         if (defaultValue.startsWith("gap")) {		
>             if (!defaultValue.equals("gap_poll:")) {
>                 LOG.w(LOG_TAG, "InAppBrowser does not support Cordova API calls: " +
url + " " + defaultValue);	
>             }		
>             result.cancel();
>             return true;
>         }
>     
>     }
>     return false;
> }
> {code}
> Please try it. Works for me :)
> Related to:
> [1] CB-4005
> [2] CB-3665
> [3] PG Forum https://groups.google.com/forum/#!topic/phonegap/wyOezp7B-iI

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message