bool toV8TestDictionaryDerivedImplementedAs(const TestDictionaryDerivedImplementedAs& impl, v8::Local<v8::Object> dictionary, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) { if (impl.hasDerivedStringMember()) { if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "derivedStringMember"), v8String(isolate, impl.derivedStringMember())))) return false; } if (impl.hasDerivedStringMemberWithDefault()) { if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "derivedStringMemberWithDefault"), v8String(isolate, impl.derivedStringMemberWithDefault())))) return false; } else { if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "derivedStringMemberWithDefault"), v8String(isolate, String("default string value"))))) return false; } if (impl.hasRequiredLongMember()) { if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "requiredLongMember"), v8::Integer::New(isolate, impl.requiredLongMember())))) return false; } else { ASSERT_NOT_REACHED(); } if (impl.hasStringOrDoubleSequenceMember()) { if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "stringOrDoubleSequenceMember"), toV8(impl.stringOrDoubleSequenceMember(), creationContext, isolate)))) return false; } return true; }
bool toV8TestInterfaceEventInit(const TestInterfaceEventInit& impl, v8::Local<v8::Object> dictionary, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) { if (impl.hasStringMember()) { if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, "stringMember"), v8String(isolate, impl.stringMember())))) return false; } return true; }
void V8TestInterfacePartial::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> context, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) { V8TestInterface::preparePrototypeAndInterfaceObject(context, prototypeObject, interfaceObject, interfaceTemplate); v8::Isolate* isolate = context->GetIsolate(); v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate)); v8::Local<v8::Object> unscopeables; if (v8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol))) unscopeables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked().As<v8::Object>(); else unscopeables = v8::Object::New(isolate); unscopeables->CreateDataProperty(context, v8AtomicString(isolate, "unscopeableVoidMethod"), v8::True(isolate)).FromJust(); prototypeObject->CreateDataProperty(context, unscopablesSymbol, unscopeables).FromJust(); }