Changeset 43157 in webkit for trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h
- Timestamp:
- May 3, 2009, 12:27:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h
r43153 r43157 126 126 if (!propertyNameRef) 127 127 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 128 JSLock::DropAllLocks dropAllLocks(exec); 129 JSValueRef exception = 0; 130 JSValueRef value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); 131 exec->setException(toJS(exception)); 128 JSValueRef exception = 0; 129 JSValueRef value; 130 { 131 JSLock::DropAllLocks dropAllLocks(exec); 132 value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); 133 } 134 exec->setException(toJS(exec, exception)); 132 135 if (value) { 133 slot.setValue(toJS( value));136 slot.setValue(toJS(exec, value)); 134 137 return true; 135 138 } … … 170 173 JSObjectRef thisRef = toRef(this); 171 174 RefPtr<OpaqueJSString> propertyNameRef; 172 JSValueRef valueRef = toRef( value);175 JSValueRef valueRef = toRef(exec, value); 173 176 174 177 for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { … … 176 179 if (!propertyNameRef) 177 180 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 178 JSLock::DropAllLocks dropAllLocks(exec); 179 JSValueRef exception = 0; 180 bool result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 181 exec->setException(toJS(exception)); 181 JSValueRef exception = 0; 182 bool result; 183 { 184 JSLock::DropAllLocks dropAllLocks(exec); 185 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 186 } 187 exec->setException(toJS(exec, exception)); 182 188 if (result || exception) 183 189 return; … … 191 197 if (!propertyNameRef) 192 198 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 193 JSLock::DropAllLocks dropAllLocks(exec);194 199 JSValueRef exception = 0; 195 bool result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 196 exec->setException(toJS(exception)); 200 bool result; 201 { 202 JSLock::DropAllLocks dropAllLocks(exec); 203 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); 204 } 205 exec->setException(toJS(exec, exception)); 197 206 if (result || exception) 198 207 return; … … 226 235 if (!propertyNameRef) 227 236 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 228 JSLock::DropAllLocks dropAllLocks(exec); 229 JSValueRef exception = 0; 230 bool result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); 231 exec->setException(toJS(exception)); 237 JSValueRef exception = 0; 238 bool result; 239 { 240 JSLock::DropAllLocks dropAllLocks(exec); 241 result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); 242 } 243 exec->setException(toJS(exec, exception)); 232 244 if (result || exception) 233 245 return true; … … 283 295 Vector<JSValueRef, 16> arguments(argumentCount); 284 296 for (int i = 0; i < argumentCount; i++) 285 arguments[i] = toRef(args.at(i)); 286 JSLock::DropAllLocks dropAllLocks(exec); 287 JSValueRef exception = 0; 288 JSObject* result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); 289 exec->setException(toJS(exception)); 297 arguments[i] = toRef(exec, args.at(i)); 298 JSValueRef exception = 0; 299 JSObject* result; 300 { 301 JSLock::DropAllLocks dropAllLocks(exec); 302 result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); 303 } 304 exec->setException(toJS(exec, exception)); 290 305 return result; 291 306 } … … 304 319 for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { 305 320 if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) { 306 JSLock::DropAllLocks dropAllLocks(exec); 307 JSValueRef exception = 0; 308 bool result = hasInstance(execRef, thisRef, toRef(value), &exception); 309 exec->setException(toJS(exception)); 321 JSValueRef exception = 0; 322 bool result; 323 { 324 JSLock::DropAllLocks dropAllLocks(exec); 325 result = hasInstance(execRef, thisRef, toRef(exec, value), &exception); 326 } 327 exec->setException(toJS(exec, exception)); 310 328 return result; 311 329 } … … 338 356 Vector<JSValueRef, 16> arguments(argumentCount); 339 357 for (int i = 0; i < argumentCount; i++) 340 arguments[i] = toRef(args.at(i)); 341 JSLock::DropAllLocks dropAllLocks(exec); 342 JSValueRef exception = 0; 343 JSValue result = toJS(callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); 344 exec->setException(toJS(exception)); 358 arguments[i] = toRef(exec, args.at(i)); 359 JSValueRef exception = 0; 360 JSValue result; 361 { 362 JSLock::DropAllLocks dropAllLocks(exec); 363 result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); 364 } 365 exec->setException(toJS(exec, exception)); 345 366 return result; 346 367 } … … 402 423 for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) 403 424 if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) { 404 JSLock::DropAllLocks dropAllLocks(exec); 405 406 JSValueRef exception = 0; 407 JSValueRef value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); 408 exec->setException(toJS(exception)); 425 JSValueRef exception = 0; 426 JSValueRef value; 427 { 428 JSLock::DropAllLocks dropAllLocks(exec); 429 value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); 430 } 431 exec->setException(toJS(exec, exception)); 409 432 if (value) { 410 433 double dValue; 411 return toJS( value).getNumber(dValue) ? dValue : NaN;434 return toJS(exec, value).getNumber(dValue) ? dValue : NaN; 412 435 } 413 436 } … … 424 447 for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) 425 448 if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) { 449 JSValueRef exception = 0; 426 450 JSValueRef value; 427 JSValueRef exception = 0;428 451 { 429 452 JSLock::DropAllLocks dropAllLocks(exec); 430 453 value = convertToType(ctx, thisRef, kJSTypeString, &exception); 431 exec->setException(toJS(exception));432 }454 } 455 exec->setException(toJS(exec, exception)); 433 456 if (value) 434 return toJS( value).getString();457 return toJS(exec, value).getString(); 435 458 if (exception) 436 459 return ""; … … 476 499 if (!propertyNameRef) 477 500 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 478 JSLock::DropAllLocks dropAllLocks(exec);479 501 JSValueRef exception = 0; 480 JSValueRef value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 481 exec->setException(toJS(exception)); 502 JSValueRef value; 503 { 504 JSLock::DropAllLocks dropAllLocks(exec); 505 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 506 } 507 exec->setException(toJS(exec, exception)); 482 508 if (value) 483 return toJS( value);509 return toJS(exec, value); 484 510 if (exception) 485 511 return jsUndefined(); … … 526 552 if (!propertyNameRef) 527 553 propertyNameRef = OpaqueJSString::create(propertyName.ustring()); 528 JSLock::DropAllLocks dropAllLocks(exec); 529 530 JSValueRef exception = 0; 531 JSValueRef value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 532 exec->setException(toJS(exception)); 554 JSValueRef exception = 0; 555 JSValueRef value; 556 { 557 JSLock::DropAllLocks dropAllLocks(exec); 558 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); 559 } 560 exec->setException(toJS(exec, exception)); 533 561 if (value) 534 return toJS( value);562 return toJS(exec, value); 535 563 if (exception) 536 564 return jsUndefined();
Note:
See TracChangeset
for help on using the changeset viewer.