Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 9d4356c5140777598b0c67ebc3d293fc3bcacc37..bc6031f4fcb07a1a382c2907a527fbdaa760b94e 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -3442,6 +3442,35 @@ bool v8::Object::ForceSet(v8::Handle<Value> key, v8::Handle<Value> value, |
| } |
| +MaybeLocal<Value> v8::Object::DefineObjectProperty( |
| + Local<Context> context, Local<Value> key, Local<Value> value, |
| + PropertyAttribute attribute) { |
| + PREPARE_FOR_EXECUTION(context, "v8::Object::DefineObjectProperty()", Value); |
| + auto self = Utils::OpenHandle(this); |
| + auto key_name = Utils::OpenHandle(*key); |
| + auto i_value = Utils::OpenHandle(*value); |
| + i::Handle<i::Object> configurable = |
|
adamk
2015/04/15 16:31:53
Seems weird for this to not be auto as well...
|
| + handle(attribute & DontDelete ? isolate->heap()->false_value() |
| + : isolate->heap()->true_value(), |
| + isolate); |
| + auto enumerable = handle(attribute & DontEnum ? isolate->heap()->false_value() |
| + : isolate->heap()->true_value(), |
| + isolate); |
| + auto writable = handle(attribute & ReadOnly ? isolate->heap()->false_value() |
| + : isolate->heap()->true_value(), |
| + isolate); |
| + i::Handle<i::Object> args[] = {self, key_name, i_value, |
| + configurable, enumerable, writable}; |
| + i::Handle<i::Object> result; |
| + has_pending_exception = |
| + !CallV8HeapFunction(isolate, "DefineObjectPropertyFromAPI", |
| + isolate->factory()->undefined_value(), |
| + arraysize(args), args).ToHandle(&result); |
| + RETURN_ON_FAILED_EXECUTION(Value); |
| + RETURN_ESCAPED(Utils::ToLocal(result)); |
| +} |
| + |
| + |
| bool v8::Object::SetPrivate(v8::Handle<Private> key, v8::Handle<Value> value) { |
| return ForceSet(v8::Handle<Value>(reinterpret_cast<Value*>(*key)), |
| value, DontEnum); |