Changeset 146711 in webkit
- Timestamp:
- Mar 22, 2013 9:20:21 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/tests/testapi.c
r146708 r146711 135 135 } 136 136 137 #if !OS(WINDOWS)138 static int leakedObject = 1;139 140 static void leakFinalize(JSObjectRef object)141 {142 (void)object;143 leakedObject = 0;144 }145 146 // This is a hack to avoid the C++ stack keeping the original JSObject alive.147 static void nestedAllocateObject(JSContextRef context, JSClassRef class, unsigned n)148 {149 if (!n) {150 JSObjectRef object = JSObjectMake(context, class, 0);151 JSObjectRef globalObject = JSContextGetGlobalObject(context);152 JSStringRef propertyName = JSStringCreateWithUTF8CString("value");153 JSObjectSetProperty(context, globalObject, propertyName, object, kJSPropertyAttributeNone, 0);154 JSStringRelease(propertyName);155 return;156 }157 nestedAllocateObject(context, class, n - 1);158 }159 160 static void testLeakingPrototypesAcrossContexts()161 {162 JSClassDefinition leakDefinition = kJSClassDefinitionEmpty;163 leakDefinition.finalize = leakFinalize;164 JSClassRef leakClass = JSClassCreate(&leakDefinition);165 166 JSContextGroupRef group = JSContextGroupCreate();167 168 {169 JSGlobalContextRef context1 = JSGlobalContextCreateInGroup(group, NULL);170 nestedAllocateObject(context1, leakClass, 10);171 JSGlobalContextRelease(context1);172 }173 174 {175 JSGlobalContextRef context2 = JSGlobalContextCreateInGroup(group, NULL);176 JSObjectRef object2 = JSObjectMake(context2, leakClass, 0);177 JSValueProtect(context2, object2);178 JSSynchronousGarbageCollectForDebugging(context2);179 if (leakedObject) {180 printf("FAIL: Failed to finalize the original object after the first GC.\n");181 failed = 1;182 } else183 printf("PASS: Finalized the original object as expected.\n");184 JSValueUnprotect(context2, object2);185 JSGlobalContextRelease(context2);186 }187 188 JSContextGroupRelease(group);189 190 JSClassRelease(leakClass);191 }192 #endif193 194 137 static bool timeZoneIsPST() 195 138 { … … 1745 1688 } 1746 1689 1747 #if !OS(WINDOWS)1748 testLeakingPrototypesAcrossContexts();1749 #endif1750 1751 1690 // Clear out local variables pointing at JSObjectRefs to allow their values to be collected 1752 1691 function = NULL; -
trunk/Source/JavaScriptCore/ChangeLog
r146708 r146711 1 2013-03-22 Ryosuke Niwa <rniwa@webkit.org> 2 3 testLeakingPrototypesAcrossContexts added in r146682 doesn't compile on Win and fails on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=113125 5 6 Reviewed by Mark Hahnenberg 7 8 Remove the test added in r146682 as it's now failing on Mac. 9 This is the test that was causing a compilation failure on Windows. 10 11 * API/tests/testapi.c: 12 (main): 13 1 14 2013-03-22 Ryosuke Niwa <rniwa@webkit.org> 2 15
Note: See TracChangeset
for help on using the changeset viewer.