Skip to content

Commit

Permalink
WebCocoa, using WebKit's inspector as a JSCocoa debugging tool
Browse files Browse the repository at this point in the history
  • Loading branch information
parmanoir committed Jul 9, 2010
1 parent efa643a commit 8acd77f
Show file tree
Hide file tree
Showing 17 changed files with 8,652 additions and 106 deletions.
7 changes: 5 additions & 2 deletions JSCocoa/JSCocoaController.m
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ - (id)initWithGlobalContext:(JSGlobalContextRef)_ctx
useSplitCall = NO;
ownsContext = NO;

[JSCocoa updateCustomCallPaths];

return self;
}

Expand Down Expand Up @@ -645,7 +647,7 @@ - (JSValueRef)callJSFunctionNamed:(NSString*)name withArguments:(id)firstArg, ..
- (JSValueRef)callJSFunctionNamed:(NSString*)name withArgumentsArray:(NSArray*)arguments
{
JSObjectRef jsFunction = [self JSFunctionNamed:name];
if (!jsFunction) return NULL;
if (!jsFunction) return NSLog(@"callJSFunctionNamed found no function %@", name), NULL;
return [self callJSFunction:jsFunction withArguments:arguments];
}

Expand Down Expand Up @@ -4029,7 +4031,7 @@ static JSValueRef jsCocoaObject_callAsFunction_ffi(JSContextRef ctx, JSObjectRef
JSValueRef res = [jsc JSCocoa:jsc callMethod:methodName ofObject:callee privateObject:thisPrivateObject argumentCount:argumentCount arguments:arguments inContext:ctx exception:exception];
if (res) return res;

return throwException(ctx, exception, [NSString stringWithFormat:@"jsCocoaObject_callAsFunction : method %@ not found — remnant of a split call ?", methodName]), NULL;
return throwException(ctx, exception, [NSString stringWithFormat:@"jsCocoaObject_callAsFunction : method %@ of object %@ not found — remnant of a split call ?", methodName, [callee class]]), NULL;
}
}

Expand Down Expand Up @@ -4679,3 +4681,4 @@ - (id)description
}

@end

6 changes: 5 additions & 1 deletion Tests/Resources/37 inited from webview.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ <h1>WebView's context used as JSCocoa source</h1>
log('app delegate=' + delegate)
log('test array=' + array)
log('test hash=' + hash)
log('NSDate=' + OSX.NSDate)
log('NSDate(now)=' + OSX.NSDate.date)
log('NSDate=' + OSX.NSDate.valueOf())
log('OSX=' + OSX)

delegate.finishTest37(true)
document.getElementById('dump').innerHTML += '<br><h2 style="color: lime">OK</h2>'
document.getElementById('dump').innerHTML += '<br><h2 style="color: lime">OK</h2>'
}
catch(e)
{
Expand Down
3 changes: 2 additions & 1 deletion TestsRunner/ApplicationController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import <Cocoa/Cocoa.h>
#import "JSCocoa.h"
#


@interface ApplicationController : NSObject <NSApplicationDelegate> {

Expand All @@ -35,6 +35,7 @@
- (IBAction)garbageCollect:(id)sender;
- (IBAction)logInstanceStats:(id)sender;
- (IBAction)logBoxedObjects:(id)sender;
- (void)log:(NSString*)message;

- (IBAction)runSimpleTestFile:(id)sender;
- (IBAction)unlinkAllReferences:(id)sender;
Expand Down
6 changes: 5 additions & 1 deletion TestsRunner/ApplicationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ - (IBAction)logBoxedObjects:(id)sender
[JSCocoa logBoxedObjects];
}

- (void)log:(NSString*)message
{
NSLog(@"%@", message);
}


- (IBAction)runSimpleTestFile:(id)sender
Expand Down Expand Up @@ -811,7 +815,7 @@ - (void)finishTest37:(BOOL)b
{
if (!b) return;
[jsc callJSFunctionNamed:@"completeDelayedTest" withArguments:@"37 init from webview", [NSNumber numberWithInt:1], nil];

[jsc2 release];
for (id o in topObjects)
[o release];
Expand Down
Loading

0 comments on commit 8acd77f

Please sign in to comment.