Repository: cordova-osx Updated Branches: refs/heads/master 00d9c6349 -> cecdf449f
CB-9584 OSX: add config to enable webview debug menu - not setting the debug menu, this can be done via `defaults` - disabling the console override when WebKitDeveloperExtras is set. Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/cecdf449 Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/cecdf449 Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/cecdf449 Branch: refs/heads/master Commit: cecdf449fc8fbecdbd25bbb6682d4010b3b1e880 Parents: 00d9c63 Author: Tobias Bocanegra <[email protected]> Authored: Wed Nov 25 16:28:04 2015 -0800 Committer: Tobias Bocanegra <[email protected]> Committed: Wed Nov 25 16:28:04 2015 -0800 ---------------------------------------------------------------------- CordovaLib/CordovaLib/Classes/CDVWebViewDelegate.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/cecdf449/CordovaLib/CordovaLib/Classes/CDVWebViewDelegate.m ---------------------------------------------------------------------- diff --git a/CordovaLib/CordovaLib/Classes/CDVWebViewDelegate.m b/CordovaLib/CordovaLib/Classes/CDVWebViewDelegate.m index 4d83f54..63fced8 100644 --- a/CordovaLib/CordovaLib/Classes/CDVWebViewDelegate.m +++ b/CordovaLib/CordovaLib/Classes/CDVWebViewDelegate.m @@ -38,10 +38,8 @@ } - (void) webView:(WebView*) webView didClearWindowObject:(WebScriptObject*) windowScriptObject forFrame:(WebFrame*) frame { - if (self.console == nil) { - self.console = [CDVConsole new]; - } - [windowScriptObject setValue:self.console forKey:@"console"]; + + [self initConsole:windowScriptObject]; // allways re-initialized bridge to that it can add the helper methods on the webview's window self.bridge = [[CDVBridge alloc] initWithWebView:webView andViewController:self.viewController]; @@ -59,6 +57,15 @@ message[@"message"]); } +- (void) initConsole:(WebScriptObject*) windowScriptObject { + // only use own console if no debug menu is enabled. + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDeveloperExtras"]) { + if (self.console == nil) { + self.console = [CDVConsole new]; + } + [windowScriptObject setValue:self.console forKey:@"console"]; + } +} #pragma mark WebScripting protocol --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
