Changeset 51068 in webkit for trunk/JavaScriptCore/API
- Timestamp:
- Nov 17, 2009, 12:41:10 AM (16 years ago)
- Location:
- trunk/JavaScriptCore/API
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/APICast.h
r50964 r51068 52 52 inline JSC::ExecState* toJS(JSContextRef c) 53 53 { 54 ASSERT(c); 54 55 return reinterpret_cast<JSC::ExecState*>(const_cast<OpaqueJSContext*>(c)); 55 56 } … … 57 58 inline JSC::ExecState* toJS(JSGlobalContextRef c) 58 59 { 60 ASSERT(c); 59 61 return reinterpret_cast<JSC::ExecState*>(c); 60 62 } 61 63 62 inline JSC::JSValue toJS(JSC::ExecState* , JSValueRef v)64 inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) 63 65 { 66 ASSERT_UNUSED(exec, exec); 67 ASSERT(v); 64 68 #if USE(JSVALUE32_64) 65 69 JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v)); … … 74 78 } 75 79 76 inline JSC::JSValue toJSForGC(JSC::ExecState* , JSValueRef v)80 inline JSC::JSValue toJSForGC(JSC::ExecState* exec, JSValueRef v) 77 81 { 82 ASSERT_UNUSED(exec, exec); 83 ASSERT(v); 78 84 #if USE(JSVALUE32_64) 79 85 JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v)); -
trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h
r48836 r51068 132 132 value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); 133 133 } 134 exec->setException(toJS(exec, exception)); 134 if (exception) { 135 exec->setException(toJS(exec, exception)); 136 slot.setValue(jsUndefined()); 137 return true; 138 } 135 139 if (value) { 136 140 slot.setValue(toJS(exec, value)); 137 return true;138 }139 if (exception) {140 slot.setValue(jsUndefined());141 141 return true; 142 142 } … … 185 185 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 186 186 } 187 exec->setException(toJS(exec, exception)); 187 if (exception) 188 exec->setException(toJS(exec, exception)); 188 189 if (result || exception) 189 190 return; … … 203 204 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 204 205 } 205 exec->setException(toJS(exec, exception)); 206 if (exception) 207 exec->setException(toJS(exec, exception)); 206 208 if (result || exception) 207 209 return; … … 241 243 result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); 242 244 } 243 exec->setException(toJS(exec, exception)); 245 if (exception) 246 exec->setException(toJS(exec, exception)); 244 247 if (result || exception) 245 248 return true; … … 302 305 result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); 303 306 } 304 exec->setException(toJS(exec, exception)); 307 if (exception) 308 exec->setException(toJS(exec, exception)); 305 309 return result; 306 310 } … … 326 330 result = hasInstance(execRef, thisRef, valueRef, &exception); 327 331 } 328 exec->setException(toJS(exec, exception)); 332 if (exception) 333 exec->setException(toJS(exec, exception)); 329 334 return result; 330 335 } … … 364 369 result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); 365 370 } 366 exec->setException(toJS(exec, exception)); 371 if (exception) 372 exec->setException(toJS(exec, exception)); 367 373 return result; 368 374 } … … 436 442 437 443 double dValue; 438 return toJS(exec, value).getNumber(dValue) ? dValue : NaN; 444 if (value) 445 return toJS(exec, value).getNumber(dValue) ? dValue : NaN; 439 446 } 440 447 … … 460 467 return ""; 461 468 } 462 return toJS(exec, value).getString(); 469 if (value) 470 return toJS(exec, value).getString(); 463 471 } 464 472 … … 508 516 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 509 517 } 510 exec->setException(toJS(exec, exception)); 518 if (exception) { 519 exec->setException(toJS(exec, exception)); 520 return jsUndefined(); 521 } 511 522 if (value) 512 523 return toJS(exec, value); 513 if (exception)514 return jsUndefined();515 524 } 516 525 517 526 return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback."); 518 527 } … … 561 570 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 562 571 } 563 exec->setException(toJS(exec, exception)); 572 if (exception) { 573 exec->setException(toJS(exec, exception)); 574 return jsUndefined(); 575 } 564 576 if (value) 565 577 return toJS(exec, value); 566 if (exception)567 return jsUndefined();568 578 } 569 579 -
trunk/JavaScriptCore/API/tests/testapi.c
r50964 r51068 167 167 return JSValueMakeUndefined(context); 168 168 } 169 170 if (JSStringIsEqualToUTF8CString(propertyName, "hasPropertyLie")) { 171 return 0; 172 } 169 173 170 174 if (JSStringIsEqualToUTF8CString(propertyName, "throwOnGet")) { … … 177 181 } 178 182 179 return NULL;183 return JSValueMakeNull(context); 180 184 } 181 185 … … 300 304 301 305 // string conversion -- forward to default object class 302 return NULL;306 return JSValueMakeNull(context); 303 307 } 304 308 … … 375 379 break; 376 380 default: 377 return NULL;381 return JSValueMakeNull(context); 378 382 break; 379 383 } … … 383 387 JSObjectRef function = JSValueToObject(context, func, exception); 384 388 if (!function) 385 return NULL;389 return JSValueMakeNull(context); 386 390 JSValueRef value = JSObjectCallAsFunction(context, function, object, 0, NULL, exception); 387 391 if (!value) {
Note:
See TracChangeset
for help on using the changeset viewer.