aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPBundleHTMLOutputController.m
diff options
context:
space:
mode:
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
*/