Changeset 30534 in webkit for trunk/JavaScriptCore/API/JSObjectRef.cpp
- Timestamp:
- Feb 23, 2008, 9:01:27 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSObjectRef.cpp
r30413 r30534 1 1 // -*- mode: c++; c-basic-offset: 4 -*- 2 2 /* 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 28 28 #include "JSObjectRef.h" 29 29 30 #include <wtf/Platform.h>31 30 #include "APICast.h" 32 #include "JSValueRef.h"33 31 #include "JSCallbackConstructor.h" 34 32 #include "JSCallbackFunction.h" … … 36 34 #include "JSClassRef.h" 37 35 #include "JSGlobalObject.h" 38 36 #include "JSValueRef.h" 39 37 #include "PropertyNameArray.h" 40 38 #include "function.h" … … 44 42 #include "object.h" 45 43 #include "object_object.h" 44 #include <wtf/Platform.h> 46 45 47 46 using namespace KJS; … … 178 177 ExecState* exec = toJS(ctx); 179 178 JSObject* jsObject = toJS(object); 180 UString::Rep* nameRep = toJS(propertyName);179 Identifier name(toJS(propertyName)); 181 180 JSValue* jsValue = toJS(value); 182 183 jsObject->put(exec, Identifier(nameRep), jsValue, attributes); 181 182 // If non-0 attributes were passed, we may need to use a lower-level call than 183 // the normal JSObject::put. If there is no existing property, then use either 184 // initializeVariable or putDirect instead, since those have the power to set attributes. 185 if (attributes && !jsObject->hasProperty(exec, name)) { 186 if (jsObject->isGlobalObject()) 187 static_cast<JSGlobalObject*>(jsObject)->initializeVariable(exec, name, jsValue, attributes); 188 else 189 jsObject->putDirect(name, jsValue, attributes); 190 return; 191 } 192 193 jsObject->put(exec, name, jsValue); 184 194 if (exec->hadException()) { 185 195 if (exception)
Note:
See TracChangeset
for help on using the changeset viewer.