cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Montyleena (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-3531) InAppBrowser hangs the app in case of no/delayed response from server
Date Mon, 03 Jun 2013 09:32:20 GMT

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

Montyleena edited comment on CB-3531 at 6/3/13 9:31 AM:
--------------------------------------------------------

I modified some code in CDVInAppBrowser.m but it didn't fix the problem. Looks like the main
thread hangs as soon as we call [self.webView loadRequest:request] and after that calling
[self.webView stopLoading] or [self.webView loadHTMLString:nil baseURL:nil] has no effect.
I added some code in the close() method. As soon as close() method is called, i tried setting
the URL to about:blank and then after a small delay i added the code to close the InAppBrowser
using "dismissViewControllerAnimated:completion:". 

The logic works with a normal web page i.e. when i click the Done button, it sets the URL
to about:blank and then after a delay, it closes the child browser window. But when i open
a non/slow responding page and click on Done button before it has finished loading, the app
doesn't respond. I tried setting the URL to about:blank in the close() method and also tried
calling [self.view stopLoading] but it doesn't help.

The behavior is different in Android. In Android, i am able to click the Done button and close
the child browser but the main app remains in frozen state. I couldn't modify and test the
behavior in Android as only a compiled jar file is given with PhoneGap.

Is there a way to make this more robust? i.e if a URL is not responding, then we should be
able to cancel that request so that it doesn't clog the main thread. At least, on Android,
can we try to fix this if possible? Maybe, you can try stopping the URL loading request when
Done button is clicked.


Here's a small .html code using which you can reproduce this (basically just running an infinite
while loop). Put this html in your local web server and access it with InAppBrowser:

<!DOCTYPE html>
    <html>
        <head>
            <title>
                index
            </title>
            <style>
            </style>
        </head>
        <body>
            
        </body>
        <script type="text/javascript">
			//window.setInterval(function(){
				while(1){
				console.log("interval");
				}
				//},500);
        </script>
    </html>
                
      was (Author: montylee):
    I modified some code in CDVInAppBrowser.m but it didn't fix the problem. Looks like the
main thread hangs as soon as we call [self.webView loadRequest:request] and after that calling
[self.webView stopLoading] or [self.webView loadHTMLString:nil baseURL:nil] has no effect.
I added some code in the close() method. As soon as close() method is called, i tried setting
the URL to about:blank and then after a small delay i added the code to close the InAppBrowser
using "dismissViewControllerAnimated:completion:". 

The logic works with a normal web page i.e. when i click the Done button, it sets the URL
to about:blank and then after a delay, it closes the child browser window. But when i open
a non/slow responding page and click on Done button before it has finished loading, the app
doesn't respond. I tried setting the URL to about:blank in the close() method and also tried
calling [self.view stopLoading] but it doesn't help.

The behavior is different in Android. In Android, i am able to click the Done button and close
the child browser but the main app remains in frozen state. I couldn't modify and test the
behavior in Android as only a compiled jar file is given with PhoneGap.

Is there a way to make this more robust? i.e if a URL is not responding, then we should be
able to cancel that request so that it doesn't clog the main thread. At least, on Android,
can we try to fix this if possible? Maybe, you can try stopping the URL loading request when
Done button is clicked.


Here's a small .html code using which you can reproduce this (basically just running an infinite
while loop). Put this html in your local web server and access it with InAppBrowser:

<!DOCTYPE html>
    <html>
        <head>
            <title>
                index
            </title>
            <style>
                /*page style*/
            </style>
        </head>
        <body>
            
        </body>
        <script type="text/javascript">
            /* Page script*/
			//window.setInterval(function(){
				while(1){
				console.log("interval");
				}
				//},500);
        </script>
    </html>
                  
> InAppBrowser hangs the app in case of no/delayed response from server
> ---------------------------------------------------------------------
>
>                 Key: CB-3531
>                 URL: https://issues.apache.org/jira/browse/CB-3531
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin InAppBrowser
>    Affects Versions: 2.7.0
>         Environment: Mac OSX 10.8.3, XCode 4.6.2, iOS 6.1
> Android 4.1.2
>            Reporter: Montyleena
>            Assignee: Steve Gill
>              Labels: hangs, inappbrowser,
>
> The InappBrowser hangs the entire application if the URL takes long time to respond or
doesn't respond. Even if we manage to close the InAppBrowser using the "Done" button and return
to the main application, the application stops responding. The expected behavior is that once
we close the child browser by clicking the "Done" button, it should cancel the URL request
but this doesn't happen. The application remains in non-responding state.

--
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