Ignore:
Timestamp:
Nov 13, 2009, 12:42:16 PM (16 years ago)
Author:
[email protected]
Message:

JSValueProtect and JSValueUnprotect don't protect API wrapper values
https://bugs.webkit.org/show_bug.cgi?id=31485

Reviewed by Geoff Garen.

Make JSValueProtect/Unprotect use a new 'toJS' function, 'toJSForGC' that
does not attempt to to strip out API wrapper objects.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/tests/testapi.c

    r49802 r50964  
    738738}
    739739
     740static JSValueRef jsNumberValue =  NULL;
     741
     742static void makeGlobalNumberValue(JSContextRef context) {
     743    JSValueRef v = JSValueMakeNumber(context, 420);
     744    JSValueProtect(context, v);
     745    jsNumberValue = v;
     746    v = NULL;
     747}
     748
    740749int main(int argc, char* argv[])
    741750{
     
    949958   
    950959    jsGlobalValue = JSObjectMake(context, NULL, NULL);
     960    makeGlobalNumberValue(context);
    951961    JSValueProtect(context, jsGlobalValue);
    952962    JSGarbageCollect(context);
    953963    ASSERT(JSValueIsObject(context, jsGlobalValue));
    954964    JSValueUnprotect(context, jsGlobalValue);
     965    JSValueUnprotect(context, jsNumberValue);
    955966
    956967    JSStringRef goodSyntax = JSStringCreateWithUTF8CString("x = 1;");
Note: See TracChangeset for help on using the changeset viewer.