Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp

Issue 2005433002: [Origin Trials] Install origin trial bindings on V8 context conditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-ef-install
Patch Set: Clean up Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
index 0396898eebd7e46c7576985d3328c75425483b16..26aa5877b73708fb27f06e6619079a235347a037 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -68,13 +68,21 @@ void installAttributeInternal(v8::Isolate* isolate, v8::Local<v8::Object> instan
return;
v8::Local<v8::Name> name = v8AtomicString(isolate, attribute.name);
+ v8::AccessorNameGetterCallback getter = attribute.getter;
+ v8::AccessorNameSetterCallback setter = attribute.setter;
+ if (world.isMainWorld()) {
+ if (attribute.getterForMainWorld)
+ getter = attribute.getterForMainWorld;
+ if (attribute.setterForMainWorld)
+ setter = attribute.setterForMainWorld;
+ }
v8::Local<v8::Value> data = v8::External::New(isolate, const_cast<WrapperTypeInfo*>(attribute.data));
DCHECK(attribute.propertyLocationConfiguration);
if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnInstance)
- v8CallOrCrash(instance->DefineOwnProperty(isolate->GetCurrentContext(), name, data, static_cast<v8::PropertyAttribute>(attribute.attribute)));
+ v8CallOrCrash(instance->SetAccessor(isolate->GetCurrentContext(), name, getter, setter, data, static_cast<v8::AccessControl>(attribute.settings), static_cast<v8::PropertyAttribute>(attribute.attribute)));
if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype)
- v8CallOrCrash(prototype->DefineOwnProperty(isolate->GetCurrentContext(), name, data, static_cast<v8::PropertyAttribute>(attribute.attribute)));
+ v8CallOrCrash(prototype->SetAccessor(isolate->GetCurrentContext(), name, getter, setter, data, static_cast<v8::AccessControl>(attribute.settings), static_cast<v8::PropertyAttribute>(attribute.attribute)));
if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnInterface)
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698