Commit 239349ed authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com

r150199 is very wrong

https://bugs.webkit.org/show_bug.cgi?id=116876

JSValue needs to protect its internal JSValueRef.

Reviewed by Darin Adler.

* API/JSValue.mm:
(-[JSValue initWithValue:inContext:]):
(-[JSValue dealloc]):
* API/tests/testapi.mm: Added a simple test to make sure that we protect the
underlying JavaScript value across garbage collections.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7ee9096a
......@@ -971,6 +971,7 @@ JSValueRef valueInternalValue(JSValue * value)
_context = [context retain];
m_value = value;
JSValueProtect([_context JSGlobalContextRef], m_value);
return self;
}
......@@ -1088,6 +1089,7 @@ static StructTagHandler* handerForStructTag(const char* encodedType)
- (void)dealloc
{
JSValueUnprotect([_context JSGlobalContextRef], m_value);
[_context release];
_context = nil;
[super dealloc];
......
......@@ -802,6 +802,15 @@ void testObjectiveCAPI()
[TinyDOMNode clearSharedVirtualMachine];
}
@autoreleasepool {
JSContext *context = [[JSContext alloc] init];
JSValue *o = [JSValue valueWithNewObjectInContext:context];
o[@"foo"] = @"foo";
JSSynchronousGarbageCollectForDebugging([context JSGlobalContextRef]);
checkResult(@"JSValue correctly protected its internal value", [[o[@"foo"] toString] isEqualToString:@"foo"]);
}
}
#else
......
2013-05-28 Mark Hahnenberg <mhahnenberg@apple.com>
r150199 is very wrong
https://bugs.webkit.org/show_bug.cgi?id=116876
JSValue needs to protect its internal JSValueRef.
Reviewed by Darin Adler.
* API/JSValue.mm:
(-[JSValue initWithValue:inContext:]):
(-[JSValue dealloc]):
* API/tests/testapi.mm: Added a simple test to make sure that we protect the
underlying JavaScript value across garbage collections.
2013-05-27 Patrick Gansterer <paroga@webkit.org>
Use ICU_INCLUDE_DIRS in BlackBerry CMake files
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment