aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPBundleHTMLOutputController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-14 12:17:11 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-14 12:17:11 +0000
commiteb443a99b9a7b32ccce4b5ab1e70fa5aad6b1f61 (patch)
treeabb93f945e39c5488ec6d136e298b9f0d8e02916 /Source/SPBundleHTMLOutputController.m
parente4afc0cda57f53dbbb5020a88d85777385cbc941 (diff)
downloadsequelpro-eb443a99b9a7b32ccce4b5ab1e70fa5aad6b1f61.tar.gz
sequelpro-eb443a99b9a7b32ccce4b5ab1e70fa5aad6b1f61.tar.bz2
sequelpro-eb443a99b9a7b32ccce4b5ab1e70fa5aad6b1f61.zip
• added 'suppressExceptionAlert' JavaScript function for window.system bridge; if called JS exceptions won't be alerted instead written to Console
Diffstat (limited to 'Source/SPBundleHTMLOutputController.m')
-rw-r--r--Source/SPBundleHTMLOutputController.m22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index 12af6bcf..3c47964a 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -33,6 +33,7 @@
@synthesize initHTMLSourceString;
@synthesize windowUUID;
@synthesize docUUID;
+@synthesize suppressExceptionAlert;
/**
* Initialisation
@@ -50,6 +51,7 @@
[webView setEditable:NO];
[webView setShouldCloseWithWindow:YES];
[webView setShouldUpdateWhileOffscreen:NO];
+ suppressExceptionAlert = NO;
}
@@ -374,6 +376,8 @@
return @"makeHTMLOutputWindowKeyWindow";
if (aSelector == @selector(closeHTMLOutputWindow))
return @"closeHTMLOutputWindow";
+ if (aSelector == @selector(suppressExceptionAlert))
+ return @"suppressExceptionAlert";
return @"";
}
@@ -399,6 +403,9 @@
if (selector == @selector(closeHTMLOutputWindow)) {
return NO;
}
+ if (selector == @selector(suppressExceptionAlert)) {
+ return NO;
+ }
return YES;
}
@@ -440,8 +447,14 @@
- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame sourceId:(NSInteger)sid line:(NSInteger)lineno forWebFrame:(WebFrame *)webFrame
{
+
NSString *mes = [NSString stringWithFormat:@"Exception:\nline = %ld\nfunction = %@\ncaller = %@\nexception = %@", lineno, [frame functionName], [frame caller], [frame userInfo], [frame exception]];
+ if([self suppressExceptionAlert]) {
+ NSLog(@"%@", mes);
+ return;
+ }
+
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"JavaScript Exception", @"javascript exception")
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
@@ -525,6 +538,15 @@
}
/**
+ * JavaScript window.system.suppressExceptionAlert() function
+ * to suppress an exception alert, instead write the message to NSLog
+ */
+- (void)suppressExceptionAlert
+{
+ [self setSuppressExceptionAlert:YES];
+}
+
+/**
* JavaScript window.system.run('a_command'|new Array('a_command', 'uuid')) function
* to return the result of the BASH command a_command
*/