From 4f83a17a3e0cdecbe4cd2d2801625ab415aaa55f Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Sun, 14 Feb 2016 23:31:52 +0100 Subject: [PATCH] #223 Don't start a new webserver after a crash if one is still running --- README.md | 4 ++-- package.json | 2 +- plugin.xml | 2 +- src/ios/AppDelegate+WKWebViewPolyfill.m | 7 +++++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 70e706f..877ce4e 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ $ cordova plugin add cordova-plugin-wkwebview --variable WKWEBVIEW_SERVER_PORT=1 No need for anything else - you can now open the project in XCode 6 if you like. ## 4. Changelog -ApiAISDKPlugin -* __0.6.8__ Compatibility with Telerik's LivePatch plugin. See #202. +* __0.6.9__ Don't start a new webserver after a crash if one is still running. See #223. +* __0.6.8__ Compatibility with Telerik's LivePatch plugin. See #202. * __0.6.7__ Compatibility with `file://` protocol for usage in plugins like [cordova-hot-code-push](https://github.com/nordnet/cordova-hot-code-push), thanks #195 and #196! * __0.6.5__ `KeyboardDisplayRequiresUserAction` works! So set to `false` if you want the keyboard to pop up when programmatically focussing an input field. * __0.6.4__ On top of the port preference introduced in 0.6.3 you can now override the default variable when installing this plugin (see 'Installation'). diff --git a/package.json b/package.json index db152e6..c69fd57 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.6.7", + "version": "0.6.9", "name": "cordova-plugin-wkwebview", "cordova_name": "WKWebView Polyfill", "description": "A drop-in replacement of UIWebView for boosted performance and enhanced HTML5 support", diff --git a/plugin.xml b/plugin.xml index 35a27a9..83aa0b6 100755 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ + version="0.6.9"> WKWebView Polyfill diff --git a/src/ios/AppDelegate+WKWebViewPolyfill.m b/src/ios/AppDelegate+WKWebViewPolyfill.m index 2b245bb..02388ae 100755 --- a/src/ios/AppDelegate+WKWebViewPolyfill.m +++ b/src/ios/AppDelegate+WKWebViewPolyfill.m @@ -44,6 +44,13 @@ - (void) createWindowAndStartWebServer:(BOOL) startWebServer { // Note: the embedded webserver is still needed for iOS 9. It's not needed to load index.html, // but we need it to ajax-load files (file:// protocol has no origin, leading to CORS issues). NSString *directoryPath = myMainViewController.wwwFolderName; + + // don't restart the webserver if we don't have to (fi. after a crash, see #223) + if (_webServer != nil && [_webServer isRunning]) { + [myMainViewController setServerPort:_webServer.port]; + return; + } + _webServer = [[GCDWebServer alloc] init]; _webServerOptions = [NSMutableDictionary dictionary];