summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime/JSObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/runtime/JSObject.cpp')
-rw-r--r--JavaScriptCore/runtime/JSObject.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp
index 3ac8a34..5cff4fa 100644
--- a/JavaScriptCore/runtime/JSObject.cpp
+++ b/JavaScriptCore/runtime/JSObject.cpp
@@ -104,18 +104,8 @@ void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue valu
// Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla.
if (!value.isObject() && !value.isNull())
return;
-
- JSValue nextPrototypeValue = value;
- while (nextPrototypeValue && nextPrototypeValue.isObject()) {
- JSObject* nextPrototype = asObject(nextPrototypeValue)->unwrappedObject();
- if (nextPrototype == this) {
- throwError(exec, GeneralError, "cyclic __proto__ value");
- return;
- }
- nextPrototypeValue = nextPrototype->prototype();
- }
-
- setPrototype(value);
+ if (!setPrototypeWithCycleCheck(value))
+ throwError(exec, GeneralError, "cyclic __proto__ value");
return;
}