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

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

Issue 2321073002: binding: Let indexed interceptor falls through to named interceptor. (Closed)
Patch Set: Updated global-interface-listing expectations. Created 4 years, 3 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/custom/V8HTMLPlugInElementCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp
index 41f12017a7210ecbc6941f7fef4017fa20807438..9362943e0365333cb9968e3192e2e725a5ad0cc4 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -41,8 +41,8 @@ namespace blink {
namespace {
-template <typename ElementType, typename PropertyType>
-void getScriptableObjectProperty(PropertyType property, const v8::PropertyCallbackInfo<v8::Value>& info)
+template <typename ElementType>
+void getScriptableObjectProperty(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
HTMLPlugInElement* impl = ElementType::toImpl(info.Holder());
RefPtr<SharedPersistent<v8::Object>> wrapper = impl->pluginWrapper();
@@ -53,18 +53,19 @@ void getScriptableObjectProperty(PropertyType property, const v8::PropertyCallba
if (instance.IsEmpty())
return;
- if (!v8CallBoolean(instance->HasOwnProperty(info.GetIsolate()->GetCurrentContext(), property)))
+ v8::Local<v8::String> v8Name = v8String(info.GetIsolate(), name);
+ if (!v8CallBoolean(instance->HasOwnProperty(info.GetIsolate()->GetCurrentContext(), v8Name)))
return;
v8::Local<v8::Value> value;
- if (!instance->Get(info.GetIsolate()->GetCurrentContext(), property).ToLocal(&value))
+ if (!instance->Get(info.GetIsolate()->GetCurrentContext(), v8Name).ToLocal(&value))
return;
v8SetReturnValue(info, value);
}
-template <typename ElementType, typename PropertyType>
-void setScriptableObjectProperty(PropertyType property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
+template <typename ElementType>
+void setScriptableObjectProperty(const AtomicString& name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
ASSERT(!value.IsEmpty());
HTMLPlugInElement* impl = ElementType::toImpl(info.Holder());
@@ -77,7 +78,8 @@ void setScriptableObjectProperty(PropertyType property, v8::Local<v8::Value> val
return;
// Don't intercept any of the properties of the HTMLPluginElement.
- if (v8CallBoolean(info.Holder()->Has(info.GetIsolate()->GetCurrentContext(), property)))
+ v8::Local<v8::String> v8Name = v8String(info.GetIsolate(), name);
+ if (v8CallBoolean(info.Holder()->Has(info.GetIsolate()->GetCurrentContext(), v8Name)))
return;
// FIXME: The gTalk pepper plugin is the only plugin to make use of
@@ -89,49 +91,30 @@ void setScriptableObjectProperty(PropertyType property, v8::Local<v8::Value> val
// DOM element will also be set. For plugin's that don't intercept the call
// (all except gTalk) this makes no difference at all. For gTalk the fact
// that the property on the DOM element also gets set is inconsequential.
- v8CallBoolean(instance->CreateDataProperty(info.GetIsolate()->GetCurrentContext(), property, value));
+ v8CallBoolean(instance->CreateDataProperty(info.GetIsolate()->GetCurrentContext(), v8Name, value));
v8SetReturnValue(info, value);
}
-} // namespace
-
-void V8HTMLEmbedElement::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
-{
- getScriptableObjectProperty<V8HTMLEmbedElement>(name.As<v8::String>(), info);
-}
-void V8HTMLObjectElement::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
-{
- getScriptableObjectProperty<V8HTMLObjectElement>(name.As<v8::String>(), info);
-}
-
-void V8HTMLEmbedElement::namedPropertySetterCustom(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
-{
- setScriptableObjectProperty<V8HTMLEmbedElement>(name.As<v8::String>(), value, info);
-}
-
-void V8HTMLObjectElement::namedPropertySetterCustom(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
-{
- setScriptableObjectProperty<V8HTMLObjectElement>(name.As<v8::String>(), value, info);
-}
+} // namespace
-void V8HTMLEmbedElement::indexedPropertyGetterCustom(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
+void V8HTMLEmbedElement::namedPropertyGetterCustom(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- getScriptableObjectProperty<V8HTMLEmbedElement>(index, info);
+ getScriptableObjectProperty<V8HTMLEmbedElement>(name, info);
}
-void V8HTMLObjectElement::indexedPropertyGetterCustom(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
+void V8HTMLObjectElement::namedPropertyGetterCustom(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- getScriptableObjectProperty<V8HTMLObjectElement>(index, info);
+ getScriptableObjectProperty<V8HTMLObjectElement>(name, info);
}
-void V8HTMLEmbedElement::indexedPropertySetterCustom(uint32_t index, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
+void V8HTMLEmbedElement::namedPropertySetterCustom(const AtomicString& name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- setScriptableObjectProperty<V8HTMLEmbedElement>(index, value, info);
+ setScriptableObjectProperty<V8HTMLEmbedElement>(name, value, info);
}
-void V8HTMLObjectElement::indexedPropertySetterCustom(uint32_t index, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
+void V8HTMLObjectElement::namedPropertySetterCustom(const AtomicString& name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- setScriptableObjectProperty<V8HTMLObjectElement>(index, value, info);
+ setScriptableObjectProperty<V8HTMLObjectElement>(name, value, info);
}
namespace {

Powered by Google App Engine
This is Rietveld 408576698