Changeset 30395 in webkit
- Timestamp:
- Feb 18, 2008 9:19:04 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r30393 r30395 1 2008-02-18 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin 4 5 Fix for <rdar://5747529> - ObjC Exception can cause JSLock to never be released 6 7 * platform/mac-tiger/Skipped: Removed 2 hanging tests that now don't hang 8 * platform/mac/plugins/webScriptObject-exception-deadlock-expected.txt: Added. 9 * platform/mac/plugins/webScriptObject-exception-deadlock.html: Added. 10 1 11 2008-02-18 Darin Adler <darin@apple.com> 2 12 -
trunk/LayoutTests/platform/mac-tiger/Skipped
r30335 r30395 5 5 http/tests/xmlhttprequest/small-chunks-response-text.html 6 6 7 # Storage tests failing only on Tiger - <rdar://problem/5747529>8 storage/quota-tracking.html9 storage/success-callback.html10 11 7 # On Tiger, WebKit does not override the MIME type returned by NSHTTPURLResponse 12 8 http/tests/loading/text-content-type-with-binary-extension.html -
trunk/WebCore/ChangeLog
r30393 r30395 1 2008-02-18 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin 4 5 Fix for <rdar://5747529> - ObjC Exception can cause JSLock to never be released 6 7 Test: platform/mac/plugins/webScriptObject-exception-deadlock.html 8 9 * bindings/objc/WebScriptObject.mm: 10 (-[WebScriptObject valueForKey:]): The line `resultObj = [super valueForKey:key]; // defaults to throwing an exception` 11 says it all - it throws an exception. This method also happens to hold the JSLock. Problematically, when the exeception 12 is thrown and the method exited, the JSLock is never released. Fix that without otherwise changing behavior by holding the 13 JSLock in two individual scopes - Right before the exception and right after. 14 1 15 2008-02-18 Darin Adler <darin@apple.com> 2 16 -
trunk/WebCore/bindings/objc/WebScriptObject.mm
r29710 r30395 383 383 ASSERT(!exec->hadException()); 384 384 385 JSLock lock; 386 JSValue *result = [self _imp]->get(exec, String(key)); 387 388 if (exec->hadException()) { 389 LOG_EXCEPTION(exec); 390 result = jsUndefined(); 391 exec->clearException(); 392 } 393 394 id resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; 385 id resultObj; 386 { 387 // Need to scope this lock to ensure that we release the lock before calling 388 // [super valueForKey:key] which might throw an exception and bypass the JSLock destructor, 389 // leaving the lock permanently held 390 JSLock lock; 391 392 JSValue *result = [self _imp]->get(exec, String(key)); 393 394 if (exec->hadException()) { 395 LOG_EXCEPTION(exec); 396 result = jsUndefined(); 397 exec->clearException(); 398 } 399 400 resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; 401 } 402 395 403 if ([resultObj isKindOfClass:[WebUndefined class]]) 396 404 resultObj = [super valueForKey:key]; // defaults to throwing an exception 397 405 406 JSLock lock; 398 407 _didExecute(self); 399 408 -
trunk/WebKitTools/ChangeLog
r30394 r30395 1 2008-02-18 Brady Eidson <beidson@apple.com> 2 3 Changes by Geoff Garen, Reviewed by Darin 4 5 Fix for <rdar://5747529> - ObjC Exception can cause JSLock to never be released 6 7 DRT changes for test: platform/mac/plugins/webScriptObject-exception-deadlock.html 8 9 [WebScriptObject valueForKey:] might throw an exception, and previously might have "leaked" the global JSLock 10 This test calls valueForKey, then runs some arbitrary Javascript on a 2ndary thread. If the lock has leaked, 11 this series of method calls will deadlock. If things are good, it will complete successfully. 12 13 * DumpRenderTree/mac/ObjCController.m: 14 (runJavaScriptThread): 15 (+[ObjCController isSelectorExcludedFromWebScript:]): 16 (+[ObjCController webScriptNameForSelector:]): 17 (-[ObjCController testValueForKey]): 18 1 19 2008-02-18 Matt Lilek <webkit@mattlilek.com> 2 20 -
trunk/WebKitTools/DumpRenderTree/mac/ObjCController.m
r29663 r30395 29 29 #import "ObjCController.h" 30 30 31 #import <JavaScriptCore/JavaScriptCore.h> 31 32 #import <WebKit/DOMAbstractView.h> 32 33 #import <WebKit/WebScriptObject.h> 33 34 #import <WebKit/WebView.h> 35 #import <pthread.h> 34 36 #import <wtf/Assertions.h> 37 38 static void* runJavaScriptThread(void* arg) 39 { 40 JSGlobalContextRef ctx = JSGlobalContextCreate(0); 41 JSStringRef scriptRef = JSStringCreateWithUTF8CString("'Hello World!'"); 42 43 JSValueRef exception = 0; 44 JSEvaluateScript(ctx, scriptRef, 0, 0, 0, &exception); 45 ASSERT(!exception); 46 47 JSGlobalContextRelease(ctx); 48 JSStringRelease(scriptRef); 49 50 return 0; 51 } 35 52 36 53 @implementation ObjCController … … 47 64 || aSelector == @selector(accessStoredWebScriptObject) 48 65 || aSelector == @selector(storeWebScriptObject:) 66 || aSelector == @selector(testValueForKey) 49 67 ) 50 68 return NO; … … 68 86 if (aSelector == @selector(storeWebScriptObject:)) 69 87 return @"storeWebScriptObject"; 88 if (aSelector == @selector(testValueForKey)) 89 return @"testValueForKey"; 70 90 71 91 return nil; … … 116 136 } 117 137 138 - (void)testValueForKey 139 { 140 ASSERT(storedWebScriptObject); 141 142 @try { 143 [storedWebScriptObject valueForKey:@"ThisKeyDoesNotExist"]; 144 } @catch (NSException *e) { 145 } 146 147 pthread_t pthread; 148 pthread_create(&pthread, 0, &runJavaScriptThread, 0); 149 pthread_join(pthread, 0); 150 } 151 118 152 - (BOOL)testWrapperRoundTripping:(WebScriptObject *)webScriptObject 119 153 {
Note: See TracChangeset
for help on using the changeset viewer.