-
Notifications
You must be signed in to change notification settings - Fork 986
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
CB-14045 - reinit url after app freezes #363
Conversation
Codecov Report
@@ Coverage Diff @@
## 4.5.x #363 +/- ##
=======================================
Coverage 63.45% 63.45%
=======================================
Files 14 14
Lines 1691 1691
Branches 284 284
=======================================
Hits 1073 1073
Misses 618 618 Continue to review full report at Codecov.
|
@@ -720,12 +720,25 @@ - (void)onAppWillTerminate:(NSNotification*)notification | |||
} | |||
} | |||
|
|||
- (void)checkAndReinitViewUrl | |||
{ | |||
if ([[[self.webViewEngine URL] absoluteString] isEqualToString:@"about:blank"]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the unlikely scenario that appURL
is actually about:blank
, you should check for this condition.
RIght now there is no probability of an infinite loop, but you never know if there are side-effects with any calls further down the stack in checkAndReinitViewUrl
I would return a BOOL
from this function (YES
if it re-inited, NO
if it did not), and add a unit test in https://github.com/apache/cordova-ios/blob/master/tests/CordovaLibTests/CDVViewControllerTest.m
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! I'll try to update these when I have a chance :) we've found another case when testing the loaded url in the webview is (null), so added those checks too
9776356
to
33b678f
Compare
Hi @shazron , I've changed the function as requested, however I'm having problems with the test... I've tried adding this test:
However, Any chance you could take this PR from here and add the missing test? I suspect it should not be difficult, however might require some more background knowledge about cordova/ios.. I can also confirm that the approach to solve the initial problem (frozen apps for users) has been fixed by this PR (after also checking if it's not null and not "about:blank") Thanks! |
@svalaskevicius sure, will do. Can you make sure the checkbox "allow maintainers to make edits" is checked? Thanks: https://blog.github.com/2016-09-07-improving-collaboration-with-forks/ |
Never mind, I just did a push and it was successful. Looks like it was checked by default. |
* test reinit url * refactor: split function + check if appUrl is not empty * Added tests.
Made a mistake - didn't realize this was based off 4.5.x branch so it was pulled into that. Reverted the change to 4.5.x and applied to master instead. |
thanks! |
Did it been added for current |
* test reinit url * refactor: split function + check if appUrl is not empty * Added tests.
* test reinit url * refactor: split function + check if appUrl is not empty * Added tests.
No it was removed from As a general rule I recommend asking this kind of question in a new issue or by email to avoid losing such comments in closed issues and merged PRs. |
Hi!
We've stumbled on a similar issue to this: https://issues.apache.org/jira/browse/CB-14045 although for us it takes a bit longer (10h or so of app being in background).
In our case the app resumes in a half working state, where the web view has been reinitialised pointing to about:blank with only default Js api available and no cordova js. Then, cordova tries to emit those resume and other events but all of them fail as there is no cordova js var available.
this approach does not fix app getting into that state as I am not fully aware how does it do that (12h debugging cycle is pretty hard).. but it gets it out of the broken state by pointing the webview back to the app's url.
what do you think?
Thanks!