Changeset 60390 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- May 28, 2010, 11:16:25 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSObject.cpp
r59811 r60390 105 105 if (!value.isObject() && !value.isNull()) 106 106 return; 107 108 JSValue nextPrototypeValue = value; 109 while (nextPrototypeValue && nextPrototypeValue.isObject()) { 110 JSObject* nextPrototype = asObject(nextPrototypeValue)->unwrappedObject(); 111 if (nextPrototype == this) { 112 throwError(exec, GeneralError, "cyclic __proto__ value"); 113 return; 114 } 115 nextPrototypeValue = nextPrototype->prototype(); 116 } 117 118 setPrototype(value); 107 if (!setPrototypeWithCycleCheck(value)) 108 throwError(exec, GeneralError, "cyclic __proto__ value"); 119 109 return; 120 110 } -
trunk/JavaScriptCore/runtime/JSObject.h
r59941 r60390 89 89 JSValue prototype() const; 90 90 void setPrototype(JSValue prototype); 91 bool setPrototypeWithCycleCheck(JSValue prototype); 91 92 92 93 void setStructure(NonNullPassRefPtr<Structure>); … … 311 312 { 312 313 return m_structure->storedPrototype(); 314 } 315 316 inline bool JSObject::setPrototypeWithCycleCheck(JSValue prototype) 317 { 318 JSValue nextPrototypeValue = prototype; 319 while (nextPrototypeValue && nextPrototypeValue.isObject()) { 320 JSObject* nextPrototype = asObject(nextPrototypeValue)->unwrappedObject(); 321 if (nextPrototype == this) 322 return false; 323 nextPrototypeValue = nextPrototype->prototype(); 324 } 325 setPrototype(prototype); 326 return true; 313 327 } 314 328
Note:
See TracChangeset
for help on using the changeset viewer.