Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fails because of use strict, WebView fails because JSValueRefs cannot…

… be shared across contexts
  • Loading branch information...
commit 827ddc293db4ad29571d49420491c4c118e66250 1 parent aaa3105
@parmanoir authored
Showing with 26,102 additions and 4,399 deletions.
  1. +60 −27 JSCocoa/JSCocoaController.m
  2. +8 −5 JSCocoa/JSCocoaFFIArgument.m
  3. +1 −1  JSCocoa/JSCocoaFFIClosure.m
  4. +3 −3 JSCocoa/JSCocoaPrivateObject.m
  5. +8 −2 JSCocoa/class.js
  6. +9 −6 JSCocoa/jslint-jscocoa.js
  7. 0  Tests/{ → ! stock}/1 C and ObjC calls.js
  8. 0  Tests/{ → ! stock}/10 shorthand overload.js
  9. 0  Tests/{ → ! stock}/11 retain test 2.js
  10. 0  Tests/{ → ! stock}/12 instance variables.js
  11. +10 −0 Tests/{ → ! stock}/13 instance.js
  12. 0  Tests/{ → ! stock}/14 class.js
  13. 0  Tests/{ → ! stock}/15 IBOutlet IBAction.js
  14. 0  Tests/{ → ! stock}/16 NSArray NSDictionary easy access.js
  15. 0  Tests/{ → ! stock}/17 struct instance.js
  16. 0  Tests/{ → ! stock}/18 structure args.js
  17. 0  Tests/{ → ! stock}/19 pure js methods.js
  18. 0  Tests/{ → ! stock}/2 structure arguments.js
  19. 0  Tests/{ → ! stock}/20 pointer to function.js
  20. 0  Tests/{ → ! stock}/21 new class definition.js
  21. 0  Tests/{ → ! stock}/22 instance valueOf.js
  22. 0  Tests/{ → ! stock}/23 NSString bridging.js
  23. 0  Tests/{ → ! stock}/24 structure set.js
  24. 0  Tests/{ → ! stock}/25 variadic.js
  25. 0  Tests/{ → ! stock}/26 full NSArray bridge.js
  26. 0  Tests/{ → ! stock}/27 type modifier o.js
  27. 0  Tests/{ → ! stock}/28 struct description.js
  28. 0  Tests/{ → ! stock}/29 pointer handling.js
  29. 0  Tests/{ → ! stock}/3 derivation.js
  30. 0  Tests/{ → ! stock}/30 obj1 == obj2.js
  31. 0  Tests/{ → ! stock}/31 bridgeSupport bench.js
  32. 0  Tests/{ → ! stock}/32 new class syntax.js
  33. 0  Tests/{ → ! stock}/33 class syntax swizzle.js
  34. 0  Tests/{ → ! stock}/34 object keys.js
  35. +1 −0  Tests/{ → ! stock}/35 webview.js
  36. 0  Tests/{ → ! stock}/36 safe dealloc.js
  37. 0  Tests/{ → ! stock}/38 class walker.js
  38. 0  Tests/{ → ! stock}/39 NSArray js functions.js
  39. 0  Tests/{ → ! stock}/4 js load.js
  40. 0  Tests/{ → ! stock}/40 ObjJ syntax.js
  41. 0  Tests/{ → ! stock}/41 class inner js functions.js
  42. 0  Tests/{ → ! stock}/42 return if.js
  43. 0  Tests/{ → ! stock}/43 @ string and selector.js
  44. 0  Tests/{ → ! stock}/44 instanceWith.js
  45. 0  Tests/{ → ! stock}/45 ƒ function shortcut.js
  46. 0  Tests/{ → ! stock}/46 exceptions.js
  47. 0  Tests/{ → ! stock}/47 ObjJ syntax super.js
  48. 0  Tests/{ → ! stock}/48 ObjJ syntax compatibility.js
  49. 0  Tests/{ → ! stock}/49 out pointer.js
  50. 0  Tests/{ → ! stock}/50 setValueForKey op.js
  51. 0  Tests/{ → ! stock}/51 ObjC blocks.js
  52. 0  Tests/{ → ! stock}/52 line and sourceURL.js
  53. 0  Tests/{ → ! stock}/53 Unicode ObjC classes.js
  54. 0  Tests/{ → ! stock}/54 custom indexed access.js
  55. 0  Tests/{ → ! stock}/55 javascript method override.js
  56. 0  Tests/{ → ! stock}/56 whitespace.js
  57. 0  Tests/{ → ! stock}/6 basic arguments.js
  58. 0  Tests/{ → ! stock}/7 split call.js
  59. 0  Tests/{ → ! stock}/8 zero arg autocall.js
  60. 0  Tests/{ → ! stock}/9 auto setter.js
  61. +30 −14 Tests/Resources/37 inited from webview.html
  62. +23 −436 Tests/Resources/inited from WebView.nib/designable.nib
  63. BIN  Tests/Resources/inited from WebView.nib/keyedobjects.nib
  64. +7 −0 TestsRunner/ApplicationController.h
  65. +62 −23 TestsRunner/ApplicationController.m
  66. +521 −778 TestsRunner/English.lproj/MainMenu.xib
  67. +6 −9 TestsRunner/TestsRunner.xcodeproj/project.pbxproj
  68. +25,336 −3,044 ...Runner/TestsRunner.xcodeproj/project.xcworkspace/xcuserdata/mini.xcuserdatad/UserInterfaceState.xcuserstate
  69. +10 −0 TestsRunner/TestsRunner.xcodeproj/project.xcworkspace/xcuserdata/mini.xcuserdatad/WorkspaceSettings.xcsettings
  70. +0 −50 TestsRunner/TestsRunner.xcodeproj/xcuserdata/mini.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  71. +7 −1 TestsRunner/TestsRunner.xcodeproj/xcuserdata/mini.xcuserdatad/xcschemes/TestsRunner.xcscheme
View
87 JSCocoa/JSCocoaController.m
@@ -132,7 +132,7 @@ @implementation JSCocoaController
//
- (id)initWithGlobalContext:(JSGlobalContextRef)_ctx
{
-// NSLog(@"JSCocoa : %x spawning with context %x", self, _ctx);
+ NSLog(@"JSCocoa : %llx spawning with context %llx", self, _ctx);
self = [super init];
controllerCount++;
@@ -255,7 +255,6 @@ - (id)initWithGlobalContext:(JSGlobalContextRef)_ctx
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
[BurksPool setJSFunctionHash:jsFunctionHash];
#endif
-
// Create a reference to ourselves, and make it read only, don't enum, don't delete
[self setObject:self withName:@"__jsc__" attributes:kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontEnum|kJSPropertyAttributeDontDelete];
@@ -265,7 +264,11 @@ - (id)initWithGlobalContext:(JSGlobalContextRef)_ctx
{
useJSLint = NO;
id lintPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"jslint-jscocoa" ofType:@"js"];
- if ([[NSFileManager defaultManager] fileExistsAtPath:lintPath]) [self evalJSFile:lintPath];
+ if ([[NSFileManager defaultManager] fileExistsAtPath:lintPath]) {
+ BOOL b = [self evalJSFile:lintPath];
+ if (!b)
+ NSLog(@"[JSCocoa initWithGlobalContext:] JSLint not loaded");
+ }
id classKitPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"class" ofType:@"js"];
if ([[NSFileManager defaultManager] fileExistsAtPath:classKitPath]) [self evalJSFile:classKitPath];
}
@@ -303,7 +306,7 @@ - (id)initWithGlobalContext:(JSGlobalContextRef)_ctx
ownsContext = NO;
[JSCocoa updateCustomCallPaths];
-
+ NSLog(@"JSCocoa spawned with context %llx", ctx);
return self;
}
@@ -320,7 +323,7 @@ - (id)init
//
- (void)cleanUp
{
-// NSLog(@"JSCocoa : %x dying", self);
+ NSLog(@"JSCocoa : %llx dying", self);
[self setUseSafeDealloc:NO];
[self unlinkAllReferences];
JSGarbageCollect(ctx);
@@ -393,15 +396,21 @@ - (void)cleanUp
- (oneway void)release
{
+ NSLog(@"jsc %llx OUT\n***\n%@\n***\n", self, [NSThread callStackSymbols]);
+//NSLog(@"RET!"); return;
// Each controller adds itself to its Javascript context, therefore retain count will be two when user last calls release.
// We check for this and clean up references then call GC, which will lower retain count to 1.
// Use 'useSafeDealloc' to make sure we're not reentering this one-time code block when GC calls release.
if ([self retainCount] == 2 && useSafeDealloc)
{
[self setUseSafeDealloc:NO];
- [self unlinkAllReferences];
+
// This will take retain count from 2 to 1, readying this instance for deallocation
- [self garbageCollect];
+ // Only collect if we own the context, has a WebView might be deallocating us while it's collecting its garbage
+ if (ownsContext) {
+ [self unlinkAllReferences];
+ [self garbageCollect];
+ }
}
[super release];
}
@@ -436,7 +445,7 @@ + (id)sharedController
// Why ? if init is calling sharedController, the pointer won't have been set and it will call itself over and over again.
//
JSCocoaSingleton = [self alloc];
-// NSLog(@"JSCocoa : allocating shared instance %x", JSCocoaSingleton);
+// NSLog(@"JSCocoa : allocating shared instance %llx", JSCocoaSingleton);
[JSCocoaSingleton init];
}
}
@@ -456,7 +465,7 @@ + (id)controllerFromContext:(JSContextRef)ctx
id jsc = nil;
[JSCocoaFFIArgument unboxJSValueRef:jsValue toObject:&jsc inContext:ctx];
// Commented as it falsely reports failure when controller is cleaning up while being deallocated
-// if (!jsc) NSLog(@"controllerFromContext couldn't find found the JSCocoaController in ctx %x", ctx);
+// if (!jsc) NSLog(@"controllerFromContext couldn't find found the JSCocoaController in ctx %llx", ctx);
return jsc;
}
@@ -550,6 +559,10 @@ - (BOOL)evalJSFile:(NSString*)path toJSValueRef:(JSValueRef*)returnValue
// Expand macros
script = [self expandJSMacros:script path:path];
+ if (!script) {
+ NSLog(@"evalJSFile:toJSValueRef: expandJSMacros returned null on %@", path);
+ return NO;
+ }
//
// Delegate canEvaluateScript, willEvaluateScript
@@ -772,7 +785,7 @@ - (NSString*)expandJSMacros:(NSString*)script path:(NSString*)path errors:(NSMut
BOOL hasFunction = [self hasJSFunctionNamed:functionName];
if (hasFunction && useJSLint)
{
- JSValueRef v = [self callJSFunctionNamed:functionName withArguments:script, array, nil];
+ JSValueRef v = [self callJSFunctionNamed:functionName withArguments:script, path?path:@"null", array, nil];
id expandedScript = [self unboxJSValueRef:v];
// Bail if expansion failed
if (!expandedScript || ![expandedScript isKindOfClass:[NSString class]])
@@ -794,6 +807,10 @@ - (BOOL)isSyntaxValid:(NSString*)script error:(NSString**)outError
{
id errors = [NSMutableArray array];
script = [self expandJSMacros:script path:nil errors:errors];
+ if (!script) {
+ NSLog(@"isSyntaxValid: expandJSMacros returned null on %@", script);
+ return NO;
+ }
JSStringRef scriptJS = JSStringCreateWithUTF8CString([script UTF8String]);
JSValueRef exception = NULL;
@@ -1384,7 +1401,7 @@ + (BOOL)addMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRe
id jsc = [JSCocoaController controllerFromContext:valueAndContext.ctx];
id keyForClassAndMethod = [NSString stringWithFormat:@"%@ %@", class, methodName];
- id keyForFunction = [NSString stringWithFormat:@"%x", valueAndContext.value];
+ id keyForFunction = [NSString stringWithFormat:@"%llx", valueAndContext.value];
id privateObject = [[JSCocoaPrivateObject alloc] init];
[privateObject setJSValueRef:valueAndContext.value ctx:[jsc ctx]];
@@ -1403,7 +1420,7 @@ + (BOOL)addMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRe
SEL selector = NSSelectorFromString(methodName);
id keyForClassAndMethod = [NSString stringWithFormat:@"%@ %@", class, methodName];
- id keyForFunction = [NSString stringWithFormat:@"%x", valueAndContext.value];
+ id keyForFunction = [NSString stringWithFormat:@"%llx", valueAndContext.value];
id existingMethodForJSFunction = [closureHash valueForKey:keyForFunction];
if (existingMethodForJSFunction)
@@ -1412,7 +1429,7 @@ + (BOOL)addMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRe
return NO;
}
-// NSLog(@"keyForFunction=%x for %@.%@", keyForFunction, class, methodName);
+// NSLog(@"keyForFunction=%llx for %@.%@", keyForFunction, class, methodName);
id jsc = [JSCocoaController controllerFromContext:valueAndContext.ctx];
JSContextRef ctx = [jsc ctx];
@@ -1425,7 +1442,7 @@ + (BOOL)addMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRe
// Closure cleanup - dangerous as instances might still be around AND IF dealloc/release is overloaded
if (existingPrivateObject)
{
- id keyForExistingFunction = [NSString stringWithFormat:@"%x", [existingPrivateObject jsValueRef]];
+ id keyForExistingFunction = [NSString stringWithFormat:@"%llx", [existingPrivateObject jsValueRef]];
[closureHash removeObjectForKey:keyForExistingFunction];
[jsFunctionSelectors removeObjectForKey:keyForExistingFunction];
@@ -1746,11 +1763,16 @@ - (BOOL)isFunctionVariadic:(id)functionName
+ (JSObjectRef)boxedJSObject:(id)o inContext:(JSContextRef)ctx
{
- id key = [NSString stringWithFormat:@"%x", o];
+ NSLog(@"QUICK FIX : key is ctx+llx, AND ctx is always the global context");
+
+ id key = [NSString stringWithFormat:@"%llx", o];
id value = [boxedObjects valueForKey:key];
+
+ NSLog(@"boxing (in ctx %llx) %@ (key %@)", ctx, o, key);
// If object is boxed, up its usage count and return it
if (value)
{
+ NSLog(@"CACHE HIT %@", key);
// NSLog(@"upusage %@ (rc=%d) %d", o, [o retainCount], [value usageCount]);
return [value jsObject];
}
@@ -1767,7 +1789,6 @@ + (JSObjectRef)boxedJSObject:(id)o inContext:(JSContextRef)ctx
// To guarantee unicity, we keep a cache of boxed objects.
// As boxed objects are JSObjectRef not derived from NSObject, we box them in an ObjC object.
//
-
// Box the ObjC object in a JSObjectRef
JSObjectRef jsObject = [self jsCocoaPrivateObjectInContext:ctx];
JSCocoaPrivateObject* private = JSObjectGetPrivate(jsObject);
@@ -1788,7 +1809,7 @@ + (JSObjectRef)boxedJSObject:(id)o inContext:(JSContextRef)ctx
+ (void)downBoxedJSObjectCount:(id)o
{
- id key = [NSString stringWithFormat:@"%x", o];
+ id key = [NSString stringWithFormat:@"%llx", o];
id value = [boxedObjects valueForKey:key];
if (!value)
return;
@@ -1804,12 +1825,12 @@ + (id)boxedObjects
#pragma mark Helpers
- (id)selectorForJSFunction:(JSObjectRef)function
{
- return [jsFunctionSelectors valueForKey:[NSString stringWithFormat:@"%x", function]];
+ return [jsFunctionSelectors valueForKey:[NSString stringWithFormat:@"%llx", function]];
}
- (id)classForJSFunction:(JSObjectRef)function
{
- return [jsFunctionClasses valueForKey:[NSString stringWithFormat:@"%x", function]];
+ return [jsFunctionClasses valueForKey:[NSString stringWithFormat:@"%llx", function]];
}
//
@@ -1981,6 +2002,7 @@ - (void)garbageCollect { JSGarbageCollect(ctx); }
//
- (void)unlinkAllReferences
{
+ NSLog(@"WARNING ! Must build an array of first (Object.keys(this)), THEN an exception for each while we try to delete them");
// Null and delete every reference to every live object
// [self evalJSString:@"for (var i in this) { log('DELETE ' + i); this[i] = null; delete this[i]; }"];
[self evalJSString:@"for (var i in this) { this[i] = null; delete this[i]; }"];
@@ -1995,7 +2017,7 @@ - (void)safeDeallocInstance:(id)sender
// This code might re-box the instance ...
[sender safeDealloc];
// So, clean it up
- [boxedObjects removeObjectForKey:[NSString stringWithFormat:@"%x", sender]];
+ [boxedObjects removeObjectForKey:[NSString stringWithFormat:@"%llx", sender]];
// sender is retained by performSelector, object will be destroyed upon function exit
}
@@ -3152,6 +3174,9 @@ static void jsCocoaObject_finalize(JSObjectRef object)
// if dealloc is overloaded, releasing now will trigger JS code and fail
// As we're being called by GC, KJS might assert() in operationInProgress == NoOperation
id private = JSObjectGetPrivate(object);
+
+ // Clean up the object now as WebKit calls us twice while cleaning __jsc__ (20110730)
+ JSObjectSetPrivate(object, NULL);
//
// If a boxed object is being destroyed, remove it from the cache
@@ -3159,7 +3184,7 @@ static void jsCocoaObject_finalize(JSObjectRef object)
id boxedObject = [private object];
if (boxedObject)
{
- id key = [NSString stringWithFormat:@"%x", boxedObject];
+ id key = [NSString stringWithFormat:@"%llx", boxedObject];
// Object may have been already deallocated
id existingBoxedObject = [boxedObjects objectForKey:key];
if (existingBoxedObject)
@@ -3181,7 +3206,6 @@ static void jsCocoaObject_finalize(JSObjectRef object)
}
}
-
[boxedObjects removeObjectForKey:key];
}
else
@@ -3193,6 +3217,7 @@ static void jsCocoaObject_finalize(JSObjectRef object)
// Immediate release if dealloc is not overloaded
[private release];
+
#ifdef __OBJC_GC__
// Mark internal object as collectable
[[NSGarbageCollector defaultCollector] enableCollectorForPointer:private];
@@ -3235,8 +3260,12 @@ static JSValueRef jsCocoaObject_getProperty(JSContextRef ctx, JSObjectRef object
[NSMakeCollectable(propertyName) autorelease];
JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(object);
-// NSLog(@"Asking for property %@ %@(%@)", propertyName, privateObject, privateObject.type);
+ NSLog(@"Asking for property %@ %@(%@)", propertyName, privateObject, privateObject.type);
+ if ([propertyName hasPrefix:@"sharedA"]) {
+ NSLog(@"there");
+ }
+
// Get delegate
JSCocoaController* jsc = [JSCocoaController controllerFromContext:ctx];
id delegate = jsc.delegate;
@@ -3369,7 +3398,7 @@ static JSValueRef jsCocoaObject_getProperty(JSContextRef ctx, JSObjectRef object
JSStringRelease(scriptJS);
BOOL isNativeCode = result ? JSValueToBoolean(ctx, result) : NO;
returnHashValue = !isNativeCode;
-// NSLog(@"isNative(%@)=%d rawJSResult=%x hashProperty=%x returnHashValue=%d", propertyName, isNativeCode, result, hashProperty, returnHashValue);
+// NSLog(@"isNative(%@)=%d rawJSResult=%llx hashProperty=%llx returnHashValue=%d", propertyName, isNativeCode, result, hashProperty, returnHashValue);
}
if (returnHashValue) return hashProperty;
}
@@ -3399,6 +3428,7 @@ static JSValueRef jsCocoaObject_getProperty(JSContextRef ctx, JSObjectRef object
if (useAutoCall)
{
callee = [privateObject object];
+ NSLog(@"%@.%@", [callee class], propertyName);
SEL sel = NSSelectorFromString(propertyName);
BOOL isInstanceCall = [propertyName isEqualToString:@"instance"];
@@ -3738,7 +3768,7 @@ static bool jsCocoaObject_setProperty(JSContextRef ctx, JSObjectRef object, JSSt
NSString* propertyName = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, propertyNameJS);
[NSMakeCollectable(propertyName) autorelease];
-// NSLog(@"****SET %@ in ctx %x on object %x (type=%@) method=%@", propertyName, ctx, object, privateObject.type, privateObject.methodName);
+// NSLog(@"****SET %@ in ctx %llx on object %llx (type=%@) method=%@", propertyName, ctx, object, privateObject.type, privateObject.methodName);
// Get delegate
JSCocoaController* jsc = [JSCocoaController controllerFromContext:ctx];
@@ -4352,7 +4382,7 @@ static JSValueRef jsCocoaObject_callAsFunction_ffi(JSContextRef ctx, JSObjectRef
#endif
superPointer = &_super;
values[0] = &superPointer;
-// NSLog(@"superClass=%@ (old=%@) (%@) function=%x", superSelectorClass, [callee superclass], [callee class], function);
+// NSLog(@"superClass=%@ (old=%@) (%@) function=%llx", superSelectorClass, [callee superclass], [callee class], function);
}
}
@@ -4695,6 +4725,9 @@ static JSObjectRef jsCocoaObject_callAsConstructor(JSContextRef ctx, JSObjectRef
#else
id structureType = [[rootElement attributeForName:@"type"] stringValue];
#endif
+ // Retain the string as releasing xmlDocument deallocs it
+ [[structureType retain] autorelease];
+
[xmlDocument release];
id fullStructureType = [JSCocoaFFIArgument structureFullTypeEncodingFromStructureTypeEncoding:structureType];
if (!fullStructureType) return throwException(ctx, exception, @"Calling constructor on a non struct"), NULL;
@@ -4933,7 +4966,7 @@ - (id)description
#if !TARGET_OS_IPHONE
retainCount = [NSGarbageCollector defaultCollector] ? @"Running GC" : [NSString stringWithFormat:@"%d", [boxedObject retainCount]];
#endif
- return [NSString stringWithFormat:@"<%@: %x holding %@ %@: %x (retainCount=%@)>",
+ return [NSString stringWithFormat:@"<%@: %llx holding %@ %@: %llx (retainCount=%@)>",
[self class],
self,
((id)self == (id)[self class]) ? @"Class" : @"",
View
13 JSCocoa/JSCocoaFFIArgument.m
@@ -64,7 +64,7 @@ - (void)finalize
- (NSString*)description
{
- return [NSString stringWithFormat:@"JSCocoaFFIArgument %x typeEncoding=%c %@ isReturnValue=%d storage=%x", self,
+ return [NSString stringWithFormat:@"JSCocoaFFIArgument %llx typeEncoding=%c %@ isReturnValue=%d storage=%llx", self,
typeEncoding,
(structureTypeEncoding ? structureTypeEncoding : @""),
isReturnValue, ptr];
@@ -276,7 +276,7 @@ - (void*)allocateStorage
if (isReturnValue && size < minimalReturnSize) size = minimalReturnSize;
ptr = malloc(size);
}
-// NSLog(@"Allocated size=%d (%x) for object %@", size, ptr, self);
+// NSLog(@"Allocated size=%d (%llx) for object %@", size, ptr, self);
return ptr;
}
@@ -366,7 +366,7 @@ + (BOOL)fromJSValueRef:(JSValueRef)value inContext:(JSContextRef)ctx typeEncodin
if (!typeEncoding) return NO;
// JSType type = JSValueGetType(ctx, value);
-// NSLog(@"JSType=%d encoding=%c self=%x", type, typeEncoding, self);
+// NSLog(@"JSType=%d encoding=%c self=%llx", type, typeEncoding, self);
switch (typeEncoding)
{
@@ -526,7 +526,7 @@ + (BOOL)toJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx typeEncoding
{
if (!typeEncoding) return NO;
-// NSLog(@"toJSValueRef: %c ptr=%x", typeEncoding, ptr);
+// NSLog(@"toJSValueRef: %c ptr=%llx", typeEncoding, ptr);
switch (typeEncoding)
{
case _C_ID:
@@ -761,7 +761,7 @@ + (NSInteger)structureFromJSObjectRef:(JSObjectRef)object inContext:(JSContextRe
JSStringRelease(propertyNameJS);
// JSObjectRef objectProperty2 = JSValueToObject(ctx, valueJS, NULL);
-// NSLog(@"%c %@ %x %x", encoding, propertyName, valueJS, objectProperty2);
+// NSLog(@"%c %@ %llx %llx", encoding, propertyName, valueJS, objectProperty2);
if (encoding == '{')
{
if (JSValueIsObject(ctx, valueJS))
@@ -983,6 +983,9 @@ + (NSString*)structureFullTypeEncodingFromStructureName:(NSString*)structureName
#else
id type = [[rootElement attributeForName:@"type"] stringValue];
#endif
+ // Retain the string as releasing xmlDocument deallocs it
+ [[type retain] autorelease];
+
[xmlDocument release];
return type;
}
View
2  JSCocoa/JSCocoaFFIClosure.m
@@ -54,7 +54,7 @@ - (void)cleanUp
}
- (void)dealloc
{
-// NSLog(@"deallocing closure %x IMP=%x", self, closure);
+// NSLog(@"deallocing closure %llx IMP=%llx", self, closure);
[self cleanUp];
[super dealloc];
}
View
6 JSCocoa/JSCocoaPrivateObject.m
@@ -67,7 +67,7 @@ - (void)cleanUp
/*
if (retainContext)
{
- NSLog(@"releasing %x", ctx);
+ NSLog(@"releasing %llx", ctx);
JSContextGroupRelease(contextGroup);
// JSGlobalContextRelease((JSGlobalContextRef)ctx);
}
@@ -200,8 +200,8 @@ - (id)rawPointerEncoding
- (id)description
{
id extra = @"";
- if ([type isEqualToString:@"rawPointer"]) extra = [NSString stringWithFormat:@" (%x) %@", rawPointer, declaredType];
- return [NSString stringWithFormat:@"<%@: %x holding %@%@>",
+ if ([type isEqualToString:@"rawPointer"]) extra = [NSString stringWithFormat:@" (%llx) %@", rawPointer, declaredType];
+ return [NSString stringWithFormat:@"<%@: %llx holding %@%@>",
[self class],
self,
type,
View
10 JSCocoa/class.js
@@ -667,8 +667,10 @@
//
// Expand script, log errors into errorArray (or to console if there are none)
//
- function expandJSMacros(script, errorArray)
+ function expandJSMacros(script, scriptURL, errorArray)
{
+ if (!__jslint)
+ return null
__lintTokens = []
var lines = script.split('\n')
var options = { forin : true, laxbreak : true, indent : true, evil : true }
@@ -678,7 +680,11 @@
{
var e = __JSLINT.errors[i]
if (!e) continue
- var error = 'JSLint error (' + e.line + ', ' + e.character + ')=' + e.reason
+ var error = 'JSLint error'
+ if (scriptURL)
+ error += ' in ' + scriptURL + ' '
+
+ error += '(' + e.line + ', ' + e.character + ')=' + e.reason
var errorLine = lines[e.line]
var str = ''
for (var j=0; j<e.character-1; j++) str += ' '
View
15 JSCocoa/jslint-jscocoa.js
@@ -177,7 +177,8 @@ SOFTWARE.
// global variable. The function will be invoked, its return value is the JSLINT
// application itself.
-"use strict";
+// http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
+//"use strict";
function JSLintWithLogs(logs)
{
@@ -5105,12 +5106,9 @@ members)?
if (style != '@implementation') advance('{')
var validTokens = { '-' : true, '+' : true, 'IBOutlet' : true, 'IBAction' : true, 'swizzle' : true, 'Swizzle' : true, 'Key' : true, 'function' : true, 'ƒ' : true }
-
var parsingClassDefinition = true
- while (validTokens[nexttoken.value] && parsingClassDefinition)
- {
- nexttoken.isObjCClassItemStart = true
- var dataHolder = nexttoken
+
+
function type()
{
var line = nexttoken.line
@@ -5131,6 +5129,11 @@ members)?
encodings.push("'" + type + "'")
advance(')')
}
+
+ while (validTokens[nexttoken.value] && parsingClassDefinition)
+ {
+ nexttoken.isObjCClassItemStart = true
+ var dataHolder = nexttoken
// Advance type
advance()
View
0  Tests/1 C and ObjC calls.js → Tests/! stock/1 C and ObjC calls.js
File renamed without changes
View
0  Tests/10 shorthand overload.js → Tests/! stock/10 shorthand overload.js
File renamed without changes
View
0  Tests/11 retain test 2.js → Tests/! stock/11 retain test 2.js
File renamed without changes
View
0  Tests/12 instance variables.js → Tests/! stock/12 instance variables.js
File renamed without changes
View
10 Tests/13 instance.js → Tests/! stock/13 instance.js
@@ -20,13 +20,23 @@
var instance6 = NSString.alloc.init
var instance7 = NSString.alloc.init
+
+
if (instance1 != 'hello') throw "(1) Invalid string instance"
if (instance2 != 'hello') throw "(2) Invalid string instance"
if (instance3 != 'hello') throw "(3) Invalid string instance"
+/*
+ // Class name test commented on Lion as NSCFString is now __NSCFString, __NSCFConstantString, etc : no longer one class
+
if (instance4 != 'hello' || instance4['class'] != 'NSCFString') throw "(4) Invalid string instance"
if (instance5 != '' || instance5.length != 0 || instance5['class'] != 'NSCFString') throw "(5) Invalid string instance"
if (instance6 != '' || instance6.length != 0 || instance6['class'] != 'NSCFString') throw "(6) Invalid string instance"
if (instance7 != '' || instance7.length != 0 || instance7['class'] != 'NSCFString') throw "(7) Invalid string instance"
+*/
+ if (instance4 != 'hello' /*|| instance4['class'] != 'NSCFString'*/) throw "(4) Invalid string instance"
+ if (instance5 != '' || instance5.length != 0 /*|| instance5['class'] != 'NSCFString'*/) throw "(5) Invalid string instance"
+ if (instance6 != '' || instance6.length != 0 /*|| instance6['class'] != 'NSCFString'*/) throw "(6) Invalid string instance"
+ if (instance7 != '' || instance7.length != 0 /*|| instance7['class'] != 'NSCFString'*/) throw "(7) Invalid string instance"
__jsc__.useSplitCall = useSplitCall
View
0  Tests/14 class.js → Tests/! stock/14 class.js
File renamed without changes
View
0  Tests/15 IBOutlet IBAction.js → Tests/! stock/15 IBOutlet IBAction.js
File renamed without changes
View
0  Tests/16 NSArray NSDictionary easy access.js → ...ck/16 NSArray NSDictionary easy access.js
File renamed without changes
View
0  Tests/17 struct instance.js → Tests/! stock/17 struct instance.js
File renamed without changes
View
0  Tests/18 structure args.js → Tests/! stock/18 structure args.js
File renamed without changes
View
0  Tests/19 pure js methods.js → Tests/! stock/19 pure js methods.js
File renamed without changes
View
0  Tests/2 structure arguments.js → Tests/! stock/2 structure arguments.js
File renamed without changes
View
0  Tests/20 pointer to function.js → Tests/! stock/20 pointer to function.js
File renamed without changes
View
0  Tests/21 new class definition.js → Tests/! stock/21 new class definition.js
File renamed without changes
View
0  Tests/22 instance valueOf.js → Tests/! stock/22 instance valueOf.js
File renamed without changes
View
0  Tests/23 NSString bridging.js → Tests/! stock/23 NSString bridging.js
File renamed without changes
View
0  Tests/24 structure set.js → Tests/! stock/24 structure set.js
File renamed without changes
View
0  Tests/25 variadic.js → Tests/! stock/25 variadic.js
File renamed without changes
View
0  Tests/26 full NSArray bridge.js → Tests/! stock/26 full NSArray bridge.js
File renamed without changes
View
0  Tests/27 type modifier o.js → Tests/! stock/27 type modifier o.js
File renamed without changes
View
0  Tests/28 struct description.js → Tests/! stock/28 struct description.js
File renamed without changes
View
0  Tests/29 pointer handling.js → Tests/! stock/29 pointer handling.js
File renamed without changes
View
0  Tests/3 derivation.js → Tests/! stock/3 derivation.js
File renamed without changes
View
0  Tests/30 obj1 == obj2.js → Tests/! stock/30 obj1 == obj2.js
File renamed without changes
View
0  Tests/31 bridgeSupport bench.js → Tests/! stock/31 bridgeSupport bench.js
File renamed without changes
View
0  Tests/32 new class syntax.js → Tests/! stock/32 new class syntax.js
File renamed without changes
View
0  Tests/33 class syntax swizzle.js → Tests/! stock/33 class syntax swizzle.js
File renamed without changes
View
0  Tests/34 object keys.js → Tests/! stock/34 object keys.js
File renamed without changes
View
1  Tests/35 webview.js → Tests/! stock/35 webview.js
@@ -133,6 +133,7 @@
// log('shouldCloseWithWindow=' + view.shouldCloseWithWindow)
var path = NSBundle.mainBundle.resourcePath + '/Tests/Resources/35 webView page.html'
+ path = NSURL.fileURLWithPath(path).absoluteString
// path = 'http://yahoo.com'
view.mainFrameURL = path
View
0  Tests/36 safe dealloc.js → Tests/! stock/36 safe dealloc.js
File renamed without changes
View
0  Tests/38 class walker.js → Tests/! stock/38 class walker.js
File renamed without changes
View
0  Tests/39 NSArray js functions.js → Tests/! stock/39 NSArray js functions.js
File renamed without changes
View
0  Tests/4 js load.js → Tests/! stock/4 js load.js
File renamed without changes
View
0  Tests/40 ObjJ syntax.js → Tests/! stock/40 ObjJ syntax.js
File renamed without changes
View
0  Tests/41 class inner js functions.js → Tests/! stock/41 class inner js functions.js
File renamed without changes
View
0  Tests/42 return if.js → Tests/! stock/42 return if.js
File renamed without changes
View
0  Tests/43 @ string and selector.js → Tests/! stock/43 @ string and selector.js
File renamed without changes
View
0  Tests/44 instanceWith.js → Tests/! stock/44 instanceWith.js
File renamed without changes
View
0  Tests/45 ƒ function shortcut.js → Tests/! stock/45 ƒ function shortcut.js
File renamed without changes
View
0  Tests/46 exceptions.js → Tests/! stock/46 exceptions.js
File renamed without changes
View
0  Tests/47 ObjJ syntax super.js → Tests/! stock/47 ObjJ syntax super.js
File renamed without changes
View
0  Tests/48 ObjJ syntax compatibility.js → ...s/! stock/48 ObjJ syntax compatibility.js
File renamed without changes
View
0  Tests/49 out pointer.js → Tests/! stock/49 out pointer.js
File renamed without changes
View
0  Tests/50 setValueForKey op.js → Tests/! stock/50 setValueForKey op.js
File renamed without changes
View
0  Tests/51 ObjC blocks.js → Tests/! stock/51 ObjC blocks.js
File renamed without changes
View
0  Tests/52 line and sourceURL.js → Tests/! stock/52 line and sourceURL.js
File renamed without changes
View
0  Tests/53 Unicode ObjC classes.js → Tests/! stock/53 Unicode ObjC classes.js
File renamed without changes
View
0  Tests/54 custom indexed access.js → Tests/! stock/54 custom indexed access.js
File renamed without changes
View
0  Tests/55 javascript method override.js → .../! stock/55 javascript method override.js
File renamed without changes
View
0  Tests/56 whitespace.js → Tests/! stock/56 whitespace.js
File renamed without changes
View
0  Tests/6 basic arguments.js → Tests/! stock/6 basic arguments.js
File renamed without changes
View
0  Tests/7 split call.js → Tests/! stock/7 split call.js
File renamed without changes
View
0  Tests/8 zero arg autocall.js → Tests/! stock/8 zero arg autocall.js
File renamed without changes
View
0  Tests/9 auto setter.js → Tests/! stock/9 auto setter.js
File renamed without changes
View
44 Tests/Resources/37 inited from webview.html
@@ -28,23 +28,40 @@
str = str.replace(/>/g, '&gt;')
document.getElementById('dump').innerHTML += str + '\n'
}
-
-
- if ('OSX' in this) log('HAS OSX')
- else log('no JSCocoa :(')
-
+
+ if ('OSX' in this) log('JSCocoa is running')
+ else log('FAILED : JSCocoa is not running')
+
log('jsc=' + ('__jsc__' in this) + ' (' + __jsc__ + ')')
+
var objCDate = OSX.NSDate.alloc.init
log('NSDate=' + objCDate)
+
objCDate.release
objCDate = null
- var delegate = OSX.NSApplication.sharedApplication.delegate
-
- if (delegate.get5 != 5) throw 'get5 failed'
- if (delegate.add1(5) !=6) throw 'add1 failed'
- delegate.dummyValue = 13
- if (delegate.dummyValue != 13) throw 'dummyValue failed'
+// var delegate = OSX.NSApplication.sharedApplication.delegate
+//log('delegate=' + delegate)
+log('NSDate.date=' + OSX.NSDate)
+log('NSDate.date=' + OSX.NSDate.date)
+log('NSDate.date=' + OSX.NSDate.date.timeIntervalSinceNow)
+log('delegate2=' + OSX)
+log('delegate3=' + OSX.NSApplication)
+log('delegate4=' + OSX.NSApplication.sharedApplication)
+
+var a = OSX.NSApplication.sharedApplication
+var str = a.length
+str += '\n' + (typeof a) + '\nproto=' + a.__proto__ + '\ncons=' + a.constructor
+for (var i in a)
+ str += '<br>' + i + '$'
+log('length=' + str)
+
+//log('delegate5=' + OSX.NSApplication.sharedApplication.delegate)
+// if (delegate.get5 != 5) throw 'get5 failed'
+// if (delegate.add1(5) !=6) throw 'add1 failed'
+// delegate.dummyValue = 13
+// if (delegate.dummyValue != 13) throw 'dummyValue failed'
+/*
var point = new OSX.NSPoint(123, 456)
if (point.x != 123 || point.y != 456) throw 'new NSPoint failed'
@@ -60,11 +77,10 @@
var array = delegate.testArray( ['hello', 'world', [4, 5, 6], 'end' ] )
if (!array) throw 'array test failed (1)'
if (array[0] != 'Hello' || array[1] != 'world') throw 'array test failed (2)'
-
+
var hash = delegate.testHash( { hello : 'world', subHash : { part1 : 'bonjour', part2 : 'monde' }, end : 'fin', subArray : [11, 12, 13] } )
if (!hash) throw 'hash test failed (1)'
if (hash['Hello'] != 'world') throw 'hash test failed (2)'
-
log('app delegate=' + delegate)
log('test array=' + array)
log('test hash=' + hash)
@@ -72,8 +88,8 @@
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>'
}
catch(e)
View
459 Tests/Resources/inited from WebView.nib/designable.nib
@@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10A432</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038</string>
- <string key="IBDocument.HIToolboxVersion">437.00</string>
+ <string key="IBDocument.SystemVersion">11A511</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1617</string>
+ <string key="IBDocument.AppKitVersion">1138</string>
+ <string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
@@ -15,13 +15,16 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>732</string>
- <string>732</string>
+ <string>1617</string>
+ <string>518</string>
</object>
</object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
+ <string>NSWindowTemplate</string>
+ <string>NSView</string>
+ <string>NSCustomObject</string>
+ <string>WebView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -33,9 +36,7 @@
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -56,7 +57,7 @@
<string key="NSWindowTitle">JSCocoa inited from WebView</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="1006">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@@ -115,9 +116,11 @@
</object>
<string key="NSFrameSize">{400, 400}</string>
<reference key="NSSuperview"/>
+ <reference key="NSNextKeyView" ref="444077104"/>
</object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
+ <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
+ <bool key="NSWindowIsRestorable">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -192,12 +195,9 @@
<string>-2.IBAttributePlaceholdersKey</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
- <string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>1.IBWindowTemplateEditedContentRect</string>
<string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
<string>2.IBPluginDependency</string>
<string>3.IBPluginDependency</string>
</object>
@@ -207,18 +207,13 @@
<object class="NSMutableDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{24, 720}, {400, 400}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{24, 720}, {400, 400}}</string>
<integer value="1"/>
- <string>{196, 240}</string>
- <string>{{357, 418}, {480, 270}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
</object>
@@ -226,427 +221,20 @@
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">4</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">ApplicationController</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>garbageCollect:</string>
- <string>runJSTests:</string>
- <string>runSimpleTestFile:</string>
- <string>unlinkAllReferences:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">webViewUsedAsContextSource</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ApplicationController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">../JSCocoa/JSCocoaController.h</string>
- </object>
- </object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <string key="superclassName">NSResponder</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="895155419">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="283894681">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="380214857">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSMenu</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="117047522">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <reference key="sourceIdentifier" ref="895155419"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <reference key="sourceIdentifier" ref="283894681"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <reference key="sourceIdentifier" ref="380214857"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <reference key="sourceIdentifier" ref="117047522"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="611743735">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSResponder</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSResponder</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSView</string>
- <string key="superclassName">NSResponder</string>
- <reference key="sourceIdentifier" ref="611743735"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSWindow</string>
- <string key="superclassName">NSResponder</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string>
- </object>
- </object>
- </object>
+ <int key="maxID">6</int>
</object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
@@ -656,7 +244,6 @@
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../TestsRunner.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
View
BIN  Tests/Resources/inited from WebView.nib/keyedobjects.nib
Binary file not shown
View
7 TestsRunner/ApplicationController.h
@@ -21,6 +21,8 @@
IBOutlet NSTextField* evalText;
IBOutlet NSTextField* evalResult;
+
+ BOOL test_unit;
JSCocoa* jsc2;
id topObjects;
@@ -32,6 +34,9 @@
BOOL cyclingContext;
}
+
+@property BOOL test_unit;
+
- (void)applicationDidFinishLaunching:(NSNotification *)notification;
- (void)applicationWillTerminate:(NSNotification *)notification;
@@ -48,6 +53,8 @@
- (IBAction)eval:(id)sender;
+- (IBAction)displayTestsWindow:(id)sender;
+
- (id)testDelegate;
- (int)dummyValue;
- (id)testCallAPI;
View
85 TestsRunner/ApplicationController.m
@@ -12,6 +12,8 @@
@implementation ApplicationController
+@synthesize test_unit;
+
JSCocoaController* jsc = nil;
- (void)applicationDidFinishLaunching:(NSNotification *)notification
@@ -34,7 +36,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
[jsc garbageCollect];
*/
// Run tests
-// [self performSelector:@selector(runJSTests:) withObject:nil afterDelay:0];
+ [self performSelector:@selector(runJSTests:) withObject:nil afterDelay:0];
}
- (void)applicationWillTerminate:(NSNotification *)notification
@@ -51,7 +53,7 @@ - (void)applicationWillTerminate:(NSNotification *)notification
// Won't work under ObjC GC
#ifndef __OBJC_GC__
// Must be 2 with new release method
- if ([jsc retainCount] != 2) NSLog(@"***Invalid JSCocoa retainCount***");
+ if ([jsc retainCount] && [jsc retainCount] != 2) NSLog(@"***Invalid JSCocoa retainCount***");
#endif
[jsc release];
@@ -110,18 +112,16 @@ - (IBAction)runJSTests:(id)sender
// Test delegate
//
id error = nil;
+// NSLog(@"testing delegate ...");
error = [self testDelegate];
+// NSLog(@"delegate tests done");
+
if (error)
{
b = NO;
path = error;
}
jsc.delegate = nil;
-
- //
- // Test api
- //
- [self testCallAPI];
//
@@ -134,7 +134,7 @@ - (IBAction)runJSTests:(id)sender
[jsc loadFrameworkWithName:@"WebKit"];
webViewClass = objc_getClass("WebView");
}
- if (webViewClass && 1)
+ if (webViewClass)
{
// NSLog(@"Testing initing from a WebView");
// Load nib
@@ -143,18 +143,32 @@ - (IBAction)runJSTests:(id)sender
id webViewNib = [[NSNib alloc] initWithContentsOfURL:nibURL];
// Instantiate nib with ourselves as owner
+ // http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/LoadingResources.pdf
topObjects = nil;
+
[webViewNib instantiateNibWithOwner:self topLevelObjects:&topObjects];
+ // Release the raw nib data
[webViewNib release];
+
+ // Release the top-level objects so that they are just owned by the array
+ [topObjects makeObjectsPerformSelector:@selector(release)];
+ // Retain the array
[topObjects retain];
+
+ // Load webpage in the window's WebView
+ // webViewUsedAsContextSource is set when loading the NIB
[webViewUsedAsContextSource setFrameLoadDelegate:self];
- id pageURL = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/Tests/Resources/37 inited from webview.html"];
- [webViewUsedAsContextSource setMainFrameURL:pageURL];
+ id pagePath = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/Tests/Resources/37 inited from webview.html"];
+ id pageURL = [NSURL fileURLWithPath:pagePath];
+// NSLog(@"url=%@", [pageURL absoluteURL]);
+
+ [webViewUsedAsContextSource setMainFrameURL:[pageURL absoluteString]];
// Init JSCocoa from WebView's globalContext
JSGlobalContextRef ctx = [[webViewUsedAsContextSource mainFrame] globalContext];
-// NSLog(@"WebView contextGroup=%x context=%x", JSContextGetGroup(ctx), ctx);
+// NSLog(@"WebView contextGroup=%llx context=%llx", JSContextGetGroup(ctx), ctx);
+
jsc2 = [[JSCocoa alloc] initWithGlobalContext:ctx];
}
else
@@ -198,7 +212,7 @@ - (IBAction)runJSTests:(id)sender
[jsc setUseAutoCall:b];
[jsc setUseJSLint:YES];
if (![str isEqualToString:[JSCocoa runningArchitecture]]) NSLog(@"!!!!!!!!!!ObjJ syntax with autocall disabled failed");
-
+
/*
id class = objc_getClass([@"ファイナンス" UTF8String]);
id o = [class new];
@@ -229,6 +243,13 @@ - (IBAction)stopContinuousJSTestsRun:(id)sender
runningContinuously = NO;
}
+- (BOOL)validateMenuItem:(NSMenuItem *) menuItem {
+ NSLog(@"%@", menuItem);
+ SEL itemAction = [menuItem action];
+ if (itemAction == @selector(displayTestsWindow:))
+ return YES;
+ return NO;
+}
//
@@ -243,8 +264,9 @@ - (IBAction)stopContinuousJSTestsRun:(id)sender
//
- (IBAction)garbageCollect:(id)sender
{
- NSLog(@"Collecting ...");
+// NSLog(@"Collecting ...");
[jsc garbageCollect];
+// NSLog(@"Collected");
}
- (IBAction)logInstanceStats:(id)sender
@@ -481,7 +503,7 @@ - (id)testDelegate
canSet = YES;
canGetGlobal= NO;
ret = [jsc evalJSString:@"NSWorkspace"];
-// NSLog(@"ret=%x %x", ret, JSValueIsNull([jsc ctx], ret));
+// NSLog(@"ret=%llx %llx", ret, JSValueIsNull([jsc ctx], ret));
if (ret) return @"delegate canGetGlobalProperty failed (1)";
//
@@ -667,7 +689,7 @@ - (BOOL) JSCocoa:(JSCocoaController*)controller canGetProperty:(NSString*)_prope
}
- (JSValueRef) JSCocoa:(JSCocoaController*)controller getProperty:(NSString*)_propertyName ofObject:(id)_object inContext:(JSContextRef)ctx exception:(JSValueRef*)exception
{
-// NSLog(@"delegate get %@(%@).%@ customValueGet=%x", _object, [_object class], _propertyName, customValueGet);
+// NSLog(@"delegate get %@(%@).%@ customValueGet=%llx", _object, [_object class], _propertyName, customValueGet);
object = _object;
propertyName = _propertyName;
return customValueGet;
@@ -745,7 +767,7 @@ - (BOOL) JSCocoa:(JSCocoaController*)controller canGetGlobalProperty:(NSString*)
}
- (JSValueRef) JSCocoa:(JSCocoaController*)controller getGlobalProperty:(NSString*)_propertyName inContext:(JSContextRef)ctx exception:(JSValueRef*)exception
{
-// NSLog(@"getGlobalProperty %@ %x", _propertyName, customValueGetGlobal);
+// NSLog(@"getGlobalProperty %@ %llx", _propertyName, customValueGetGlobal);
propertyName = _propertyName;
return customValueGetGlobal;
}
@@ -843,13 +865,15 @@ - (int)get5
- (IBAction)runSimpleTestFile:(id)sender
{
+ if (!jsc)
+ return;
id js = @"2+2";
js = @"NSWorkspace.sharedWorkspace.activeApplication";
js = @"var a = NSMakePoint(2, 3)";
- [JSCocoaController garbageCollect];
+ [jsc garbageCollect];
JSValueRef ret2 = [jsc evalJSString:js];
- [JSCocoaController garbageCollect];
+ [jsc garbageCollect];
JSStringRef resultStringJS = JSValueToStringCopy([jsc ctx], ret2, NULL);
NSString* r = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, resultStringJS);
@@ -909,12 +933,22 @@ - (void)finishTest37:(BOOL)b
if (!b) return;
[jsc callJSFunctionNamed:@"completeDelayedTest" withArguments:@"37 init from webview", [NSNumber numberWithInt:1], nil];
+ NSLog(@"COMMENTED test 37 !");
+ NSLog(@"jsc2 rc=%d (%llx)", [jsc2 retainCount], self);
+ NSLog(@"get1 %@", [jsc2 eval:@"__jsc__"]);
+// b = [jsc2 removeObjectWithName:@"__jsc__"];
+ [jsc2 garbageCollect];
+ NSLog(@"jsc2 rc=%d (POST REMOVE %d)", [jsc2 retainCount], b);
+ NSLog(@"get2 %@", [jsc2 eval:@"__jsc__"]);
[jsc2 release];
- for (id o in topObjects)
- [o release];
+
[topObjects release];
topObjects = nil;
jsc2 = nil;
+
+ NSLog(@"***COMMENTED test 37 !");
+
+ NSLog(@"AND, commented test37 html");
/*
NSLog(@"****************");
[JSCocoa logInstanceStats];
@@ -937,6 +971,11 @@ - (void)allTestsRanOK
[textField setStringValue:@"All tests ran OK"];
}
+- (IBAction)displayTestsWindow:(id)sender {
+ [window makeKeyAndOrderFront:nil];
+}
+
+
- (NSError*)testNSError
{
return testNSError;
@@ -950,7 +989,7 @@ - (BOOL)callbackNSErrorWithClass:(NSErrorTest*)o
testNSError = nil;
}
NSError* error = nil;
-// NSLog(@"calling with pointer %x", &error);
+// NSLog(@"calling with pointer %llx", &error);
BOOL r = [o someMethodReturningAnError:&error];
if (error)
@@ -991,7 +1030,7 @@ - (void)disposeShadowBindingsClasses
// Use JSValueRefAndContextRef
- (void)incorrectlySetJSValue:(JSValueRef)value
{
- NSLog(@"[%@ %s] got %x", [self class], _cmd, value);
+ NSLog(@"[%@ %s] got %llx", [self class], _cmd, value);
}
// Correctly set, testing holding on to it
@@ -1008,7 +1047,7 @@ - (void)setJSValue:(JSValueRefAndContextRef)vc
JSContextGroupRetain(JSContextGetGroup(vc.ctx));
JSGlobalContextRetain([jsc ctx]);
*/
- NSLog(@"ctx=%x value=%x globalctx=%x", vc.ctx, vc.value, [jsc ctx]);
+ NSLog(@"ctx=%llx value=%llx globalctx=%llx", vc.ctx, vc.value, [jsc ctx]);
}
- (JSValueRefAndContextRef)jsValue
{
View
1,299 TestsRunner/English.lproj/MainMenu.xib
@@ -2,18 +2,26 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10J567</string>
- <string key="IBDocument.InterfaceBuilderVersion">740</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">462.00</string>
+ <string key="IBDocument.SystemVersion">11A511</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1617</string>
+ <string key="IBDocument.AppKitVersion">1138</string>
+ <string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">740</string>
+ <string key="NS.object.0">1617</string>
</object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="372"/>
- <integer value="57"/>
+ <string>NSView</string>
+ <string>NSMenu</string>
+ <string>NSWindowTemplate</string>
+ <string>NSMenuItem</string>
+ <string>NSTextField</string>
+ <string>NSTextFieldCell</string>
+ <string>NSButtonCell</string>
+ <string>NSButton</string>
+ <string>NSUserDefaultsController</string>
+ <string>NSCustomObject</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -24,9 +32,7 @@
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1073,6 +1079,26 @@
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
+ <object class="NSMenuItem" id="759088071">
+ <reference key="NSMenu" ref="835318025"/>
+ <string key="NSTitle">Tests</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="35465992"/>
+ <reference key="NSMixedImage" ref="502551668"/>
+ </object>
+ <object class="NSMenuItem" id="1055326611">
+ <reference key="NSMenu" ref="835318025"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="35465992"/>
+ <reference key="NSMixedImage" ref="502551668"/>
+ </object>
<object class="NSMenuItem" id="625202149">
<reference key="NSMenu" ref="835318025"/>
<string key="NSTitle">Bring All to Front</string>
@@ -1117,12 +1143,13 @@
<object class="NSWindowTemplate" id="972006081">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{335, 328}, {417, 422}}</string>
+ <string key="NSWindowRect">{{335, 328}, {420, 421}}</string>
<int key="NSWTFlags">1946157056</int>
<string key="NSWindowTitle">JSCocoa Tests Runner</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <nil key="NSUserInterfaceItemIdentifier"/>
+ <string key="NSWindowContentMinSize">{420, 420}</string>
<object class="NSView" key="NSWindowView" id="439893737">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@@ -1131,8 +1158,10 @@
<object class="NSButton" id="879828882">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{31, 361}, {102, 32}}</string>
+ <string key="NSFrame">{{14, 373}, {102, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="167024620"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="651220884">
<int key="NSCellFlags">67239424</int>
@@ -1155,8 +1184,10 @@
<object class="NSButton" id="167024620">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{31, 330}, {190, 32}}</string>
+ <string key="NSFrame">{{14, 342}, {190, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="1051573598"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="753111761">
<int key="NSCellFlags">67239424</int>
@@ -1175,8 +1206,10 @@
<object class="NSButton" id="1051573598">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{220, 330}, {68, 32}}</string>
+ <string key="NSFrame">{{203, 342}, {68, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="24604618"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="438038691">
<int key="NSCellFlags">67239424</int>
@@ -1195,8 +1228,10 @@
<object class="NSButton" id="24604618">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{31, 268}, {127, 32}}</string>
+ <string key="NSFrame">{{14, 280}, {127, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="934852353"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="294957686">
<int key="NSCellFlags">67239424</int>
@@ -1215,8 +1250,10 @@
<object class="NSButton" id="197111648">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{31, 206}, {140, 32}}</string>
+ <string key="NSFrame">{{14, 218}, {140, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="481926543"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="500837676">
<int key="NSCellFlags">67239424</int>
@@ -1235,8 +1272,10 @@
<object class="NSButton" id="767469091">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{31, 237}, {140, 32}}</string>
+ <string key="NSFrame">{{14, 249}, {140, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="778899845"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="504028646">
<int key="NSCellFlags">67239424</int>
@@ -1255,8 +1294,10 @@
<object class="NSButton" id="701784859">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{31, 175}, {168, 32}}</string>
+ <string key="NSFrame">{{14, 187}, {168, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="460065620"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="629598208">
<int key="NSCellFlags">67239424</int>
@@ -1275,8 +1316,10 @@
<object class="NSButton" id="460065620">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{31, 144}, {169, 32}}</string>
+ <string key="NSFrame">{{14, 156}, {169, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="49564704"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="764919914">
<int key="NSCellFlags">67239424</int>
@@ -1295,8 +1338,10 @@
<object class="NSButton" id="872062680">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">265</int>
- <string key="NSFrame">{{317, 103}, {75, 32}}</string>
+ <string key="NSFrame">{{320, 115}, {86, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="118854190"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="609017964">
<int key="NSCellFlags">67239424</int>
@@ -1315,8 +1360,10 @@
<object class="NSTextField" id="835093140">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">290</int>
- <string key="NSFrame">{{31, 19}, {369, 12}}</string>
+ <string key="NSFrame">{{31, 19}, {372, 12}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="291550997">
<int key="NSCellFlags">68288064</int>
@@ -1328,7 +1375,7 @@
<int key="NSfFlags">3614</int>
</object>
<reference key="NSControlView" ref="835093140"/>
- <object class="NSColor" key="NSBackgroundColor">
+ <object class="NSColor" key="NSBackgroundColor" id="895343154">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
@@ -1337,7 +1384,7 @@
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
- <object class="NSColor" key="NSTextColor">
+ <object class="NSColor" key="NSTextColor" id="226410210">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
@@ -1351,8 +1398,10 @@
<object class="NSTextField" id="49564704">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">266</int>
- <string key="NSFrame">{{29, 109}, {286, 22}}</string>
+ <string key="NSFrame">{{20, 121}, {298, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="872062680"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="34294985">
<int key="NSCellFlags">-1804468671</int>
@@ -1381,8 +1430,10 @@
<object class="NSTextField" id="118854190">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">274</int>
- <string key="NSFrame">{{29, 37}, {357, 66}}</string>
+ <string key="NSFrame">{{20, 20}, {380, 95}}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="835093140"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="956287014">
<int key="NSCellFlags">-2073952767</int>
@@ -1395,13 +1446,146 @@
<reference key="NSTextColor" ref="1024827066"/>
</object>
</object>
+ <object class="NSButton" id="362537091">
+ <reference key="NSNextResponder" ref="439893737"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{266, 289}, {82, 18}}</string>
+ <reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="767469091"/>
+ <string key="NSReuseIdentifierKey">_NS:239</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="32788480">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Unit tests</string>
+ <reference key="NSSupport" ref="943665204"/>
+ <string key="NSCellIdentifier">_NS:239</string>
+ <reference key="NSControlView" ref="362537091"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <object class="NSCustomResource" key="NSNormalImage" id="898351944">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSSwitch</string>
+ </object>
+ <object class="NSButtonImageSource" key="NSAlternateImage" id="975151662">
+ <string key="NSImageName">NSSwitch</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="778899845">
+ <reference key="NSNextResponder" ref="439893737"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{266, 269}, {78, 18}}</string>
+ <reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="197111648"/>
+ <string key="NSReuseIdentifierKey">_NS:239</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="133464035">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Delegate</string>
+ <reference key="NSSupport" ref="943665204"/>
+ <string key="NSCellIdentifier">_NS:239</string>
+ <reference key="NSControlView" ref="778899845"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="898351944"/>
+ <reference key="NSAlternateImage" ref="975151662"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="481926543">
+ <reference key="NSNextResponder" ref="439893737"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{266, 249}, {78, 18}}</string>
+ <reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="835348829"/>
+ <string key="NSReuseIdentifierKey">_NS:239</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="277477591">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">WebView</string>
+ <reference key="NSSupport" ref="943665204"/>
+ <string key="NSCellIdentifier">_NS:239</string>
+ <reference key="NSControlView" ref="481926543"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>