Changeset 30534 in webkit for trunk/JavaScriptCore/kjs/object.cpp
- Timestamp:
- Feb 23, 2008, 9:01:27 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/object.cpp
r29818 r30534 205 205 206 206 // ECMA 8.6.2.2 207 void JSObject::put(ExecState* exec, const Identifier &propertyName, JSValue *value , int attr)207 void JSObject::put(ExecState* exec, const Identifier &propertyName, JSValue *value) 208 208 { 209 209 ASSERT(value); … … 220 220 return; 221 221 } 222 223 // The put calls from JavaScript execution either have no attributes set, or in some cases224 // have DontDelete set. For those calls, respect the ReadOnly flag.225 bool checkReadOnly = !(attr & ~DontDelete);226 222 227 223 // Check if there are any setters or getters in the prototype chain … … 241 237 242 238 if (hasGettersOrSetters) { 243 if (checkReadOnly && !canPut(exec, propertyName)) 244 return; 239 unsigned attributes; 240 if (_prop.get(propertyName, attributes) && attributes & ReadOnly) 241 return; 245 242 246 243 obj = this; 247 244 while (true) { 248 unsigned attributes;249 245 if (JSValue *gs = obj->_prop.get(propertyName, attributes)) { 250 246 if (attributes & GetterSetter) { … … 275 271 } 276 272 277 _prop.put(propertyName, value, attr, checkReadOnly); 278 } 279 280 void JSObject::put(ExecState *exec, unsigned propertyName, 281 JSValue *value, int attr) 282 { 283 put(exec, Identifier::from(propertyName), value, attr); 284 } 285 286 // ECMA 8.6.2.3 287 bool JSObject::canPut(ExecState *, const Identifier &propertyName) const 288 { 289 unsigned attributes; 290 291 // Don't look in the prototype here. We can always put an override 292 // in the object, even if the prototype has a ReadOnly property. 293 // Also, there is no need to check the static property table, as this 294 // would have been done by the subclass already. 295 296 if (!_prop.get(propertyName, attributes)) 297 return true; 298 299 return !(attributes & ReadOnly); 273 _prop.put(propertyName, value, 0, true); 274 } 275 276 void JSObject::put(ExecState* exec, unsigned propertyName, JSValue* value) 277 { 278 put(exec, Identifier::from(propertyName), value); 300 279 } 301 280
Note:
See TracChangeset
for help on using the changeset viewer.