Changeset 108259 in webkit for trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
- Timestamp:
- Feb 20, 2012, 1:14:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r107625 r108259 715 715 } 716 716 717 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState* exec) 718 { 719 if (!exec->thisValue().isObject()) 720 return JSValue::encode(exec->thisValue().synthesizePrototype(exec)); 721 722 JSObject* thisObject = asObject(exec->thisValue()); 723 if (!thisObject->allowsAccessFrom(exec->trueCallerFrame())) 724 return JSValue::encode(jsUndefined()); 725 726 return JSValue::encode(thisObject->prototype()); 727 } 728 729 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState* exec) 730 { 731 JSValue value = exec->argument(0); 732 733 // Setting __proto__ of a primitive should have no effect. 734 if (!exec->thisValue().isObject()) 735 return JSValue::encode(jsUndefined()); 736 737 JSObject* thisObject = asObject(exec->thisValue()); 738 if (!thisObject->allowsAccessFrom(exec->trueCallerFrame())) 739 return JSValue::encode(jsUndefined()); 740 741 // Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla. 742 if (!value.isObject() && !value.isNull()) 743 return JSValue::encode(jsUndefined()); 744 745 if (!thisObject->isExtensible()) 746 return throwVMError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError)); 747 748 if (!thisObject->setPrototypeWithCycleCheck(exec->globalData(), value)) 749 throwError(exec, createError(exec, "cyclic __proto__ value")); 750 return JSValue::encode(jsUndefined()); 751 } 752 717 753 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.