Changeset 56189 in webkit for trunk/JavaScriptCore/API/JSValueRef.cpp
- Timestamp:
- Mar 18, 2010, 1:51:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSValueRef.cpp
r55633 r56189 32 32 33 33 #include <runtime/JSGlobalObject.h> 34 #include <runtime/JSONObject.h> 34 35 #include <runtime/JSString.h> 36 #include <runtime/LiteralParser.h> 35 37 #include <runtime/Operations.h> 36 38 #include <runtime/Protect.h> … … 222 224 } 223 225 226 JSValueRef JSValueMakeFromJSONString(JSContextRef ctx, JSStringRef string) 227 { 228 ExecState* exec = toJS(ctx); 229 APIEntryShim entryShim(exec); 230 LiteralParser parser(exec, string->ustring(), LiteralParser::StrictJSON); 231 return toRef(exec, parser.tryLiteralParse()); 232 } 233 234 JSStringRef JSValueCreateJSONString(JSContextRef ctx, JSValueRef apiValue, unsigned indent, JSValueRef* exception) 235 { 236 ExecState* exec = toJS(ctx); 237 APIEntryShim entryShim(exec); 238 JSValue value = toJS(exec, apiValue); 239 UString result = JSONStringify(exec, value, indent); 240 if (exception) 241 *exception = 0; 242 if (exec->hadException()) { 243 if (exception) 244 *exception = toRef(exec, exec->exception()); 245 exec->clearException(); 246 return 0; 247 } 248 return OpaqueJSString::create(result).releaseRef(); 249 } 250 224 251 bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) 225 252 {
Note:
See TracChangeset
for help on using the changeset viewer.