[GitHub] cordova-plugin-wkwebview-engine pull request #23: CB-11997: Add crash recove...
Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/23 --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-wkwebview-engine pull request #23: CB-11997: Add crash recove...
Github user cjpearson commented on a diff in the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/23#discussion_r90223157 --- Diff: src/ios/CDVWKWebViewEngine.m --- @@ -123,6 +123,32 @@ - (void)pluginInitialize name:UIApplicationWillEnterForegroundNotification object:nil]; NSLog(@"Using WKWebView"); + +[self addURLObserver]; +} + +- (void)onReset { +[self addURLObserver]; +} + +static void * KVOContext = + +- (void)addURLObserver { +if(![[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = 9, .minorVersion = 0, .patchVersion = 0 }]){ --- End diff -- Yeah I was using the local webserver plugin to support iOS 8. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-wkwebview-engine pull request #23: CB-11997: Add crash recove...
Github user shazron commented on a diff in the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/23#discussion_r90091089 --- Diff: src/ios/CDVWKWebViewEngine.m --- @@ -123,6 +123,32 @@ - (void)pluginInitialize name:UIApplicationWillEnterForegroundNotification object:nil]; NSLog(@"Using WKWebView"); + +[self addURLObserver]; +} + +- (void)onReset { +[self addURLObserver]; +} + +static void * KVOContext = + +- (void)addURLObserver { +if(![[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = 9, .minorVersion = 0, .patchVersion = 0 }]){ --- End diff -- To make it simpler, you can use `IsAtLeastiOSVersion(@"9.0")` (from CDVAvailability.h) I'm not sure how this whole patch would work for iOS 8, because of this note: https://github.com/apache/cordova-plugin-wkwebview-engine#notes Is this for a "using a local webserver" context? --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-wkwebview-engine pull request #23: CB-11997: Add crash recove...
Github user shazron commented on a diff in the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/23#discussion_r90092299 --- Diff: src/ios/CDVWKWebViewEngine.m --- @@ -123,6 +123,32 @@ - (void)pluginInitialize name:UIApplicationWillEnterForegroundNotification object:nil]; NSLog(@"Using WKWebView"); + +[self addURLObserver]; +} + +- (void)onReset { +[self addURLObserver]; +} + +static void * KVOContext = + +- (void)addURLObserver { +if(![[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = 9, .minorVersion = 0, .patchVersion = 0 }]){ +[self.webView addObserver:self forKeyPath:@"URL" options:0 context:KVOContext]; +} +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ +if (context == KVOContext) { +if (object == [self webView] && [keyPath isEqualToString: @"URL"] && [object valueForKeyPath:keyPath] == nil){ +NSLog(@"URL is nil. Reloading WebView"); --- End diff -- Change WebView to WKWebView to give more clarity in the log here. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-wkwebview-engine pull request #23: CB-11997: Add crash recove...
GitHub user cjpearson opened a pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/23 CB-11997: Add crash recovery for iOS 8 ### Platforms affected iOS ### What does this PR do? Reloads the WebView when it crashes. This behavior already exists on iOS >= 9, but has not been added for iOS 8. ### What testing has been done on this change? I've tried consuming a bunch of memory in javascript to cause a crash. The app reloads successfully. ### Checklist - [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB- is the JIRA ID & "android" is the platform affected. - [ ] Added automated test coverage as appropriate for this change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/cjpearson/cordova-plugin-wkwebview-engine master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/23.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 #23 commit d9d30f2cf91f307b44ecc5efe1763ae7d0b3bdb3 Author: Connor PearsonDate: 2016-10-11T18:04:37Z CB-11997: Add crash recovery for iOS 8 --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org