Changeset 107544 in webkit for trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
- Timestamp:
- Feb 13, 2012, 1:28:44 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r107498 r107544 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->methodTable()->allowsAccessFrom(thisObject, exec))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->methodTable()->allowsAccessFrom(thisObject, exec))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 JSValue::encode(jsUndefined());747 748 if (!thisObject->setPrototypeWithCycleCheck(exec->globalData(), value))749 throwError(exec, createError(exec, "cyclic __proto__ value"));750 751 return JSValue::encode(jsUndefined());752 }753 754 717 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.