Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js stops running in hidden InAppBrowser on ios #141

Closed
peter-meemo opened this issue Aug 14, 2019 · 3 comments
Closed

js stops running in hidden InAppBrowser on ios #141

peter-meemo opened this issue Aug 14, 2019 · 3 comments
Labels

Comments

@peter-meemo
Copy link

JS running in a hidden InAppBrowser will stop after a few seconds (and resume when the browser becomes visible again). Is this caused by some ios system restriction?

This is observed on a physical ios device, but not on Android or in the ios simulator.

Reproduce:

class TestBrowser extends InAppBrowser {
  @override
  void onConsoleMessage(ConsoleMessage consoleMessage) {
    print('CONSOLE LOG: ${consoleMessage.message}');
  }
}

Then open the following page in a TestBrowser that is hidden:

<html>
   <head>
      <script>
         async function a() {
         let c = 0;
         while(true) {
           let p = new Promise(resolve => {
         setTimeout(() => {
         resolve('resolved');
         }, 200);
         });
         await p;
         c += 1;
         console.log('ASYNC ' + c);
         document.body.innerHTML += ' ' + c;
         }
         return
         }
         a();
      </script>
   </head>
   <body>
      BODY-A
   </body>
</html>

You will see that the console stops logging after a few seconds. If you call .show() on the browser after waiting, console logging and js will resume.

@peter-meemo
Copy link
Author

Sounds like this is indeed a consequence of ios js execution model?
https://www.raymondcamden.com/2013/01/20/FYI-iOS-JavaScript-and-inactive-tabs

This was referenced Jul 6, 2020
Copy link

github-actions bot commented Oct 7, 2024

This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.

@github-actions github-actions bot added the stale label Oct 7, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant