Changeset 50964 in webkit for trunk/JavaScriptCore/API/APICast.h


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/APICast.h

    r49802 r50964  
    7474}
    7575
     76inline JSC::JSValue toJSForGC(JSC::ExecState*, JSValueRef v)
     77{
     78#if USE(JSVALUE32_64)
     79    JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v));
     80    if (!jsCell)
     81        return JSC::JSValue();
     82    return jsCell;
     83#else
     84    return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
     85#endif
     86}
     87
    7688inline JSC::JSObject* toJS(JSObjectRef o)
    7789{
Note: See TracChangeset for help on using the changeset viewer.