Ignore:
Timestamp:
Aug 15, 2008, 12:43:48 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Geoff Garen.

JSStringRef is created context-free, but can get linked to one via an identifier table,
breaking an implicit API contract.

Made JSStringRef point to OpaqueJSString, which is a new string object separate from UString.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSValueRef.cpp

    r35478 r35775  
    189189    exec->globalData().heap->registerThread();
    190190
    191     UString::Rep* rep = toJS(string);
    192     return toRef(jsString(exec, UString(rep)));
     191    return toRef(jsString(exec, string->ustring()));
    193192}
    194193
     
    224223    JSValue* jsValue = toJS(value);
    225224   
    226     JSStringRef stringRef = toRef(jsValue->toString(exec).rep()->ref());
    227     if (exec->hadException()) {
    228         if (exception)
    229             *exception = toRef(exec->exception());
    230         exec->clearException();
    231         stringRef = 0;
    232     }
    233     return stringRef;
     225    RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue->toString(exec)));
     226    if (exec->hadException()) {
     227        if (exception)
     228            *exception = toRef(exec->exception());
     229        exec->clearException();
     230        stringRef.clear();
     231    }
     232    return stringRef.release().releaseRef();
    234233}
    235234
Note: See TracChangeset for help on using the changeset viewer.