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

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

Issue 2060753002: Implement script-side of callback reactions for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@callback-ce
Patch Set: rebase Created 4 years, 6 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/ScriptCustomElementDefinitionBuilder.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp
index 158a6dfe6008f250db694e66517f97cd2e86a60c..616d518cfbd18ee83d4dfc2d7814e168efd3d805 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp
@@ -113,7 +113,7 @@ bool ScriptCustomElementDefinitionBuilder::checkPrototype()
}
bool ScriptCustomElementDefinitionBuilder::callableForName(const String& name,
- v8::Local<v8::Object>& callback) const
+ v8::Local<v8::Function>& callback) const
{
v8::Local<v8::Value> value;
if (!valueForName(m_prototype, name, value))
@@ -121,17 +121,12 @@ bool ScriptCustomElementDefinitionBuilder::callableForName(const String& name,
// "undefined" means "omitted", so return true.
if (value->IsUndefined())
return true;
- if (!value->IsObject()) {
+ if (!value->IsFunction()) {
m_exceptionState.throwTypeError(
- String::format("\"%s\" is not an object", name.ascii().data()));
- return false;
- }
- callback = value.As<v8::Object>();
- if (!callback->IsCallable()) {
- m_exceptionState.throwTypeError(
- String::format("\"%s\" is not callable", name.ascii().data()));
+ String::format("\"%s\" is not a callable object", name.ascii().data()));
return false;
}
+ callback = value.As<v8::Function>();
return true;
}
@@ -162,10 +157,10 @@ bool ScriptCustomElementDefinitionBuilder::rememberOriginalProperties()
const String kConnectedCallback = "connectedCallback";
const String kDisconnectedCallback = "disconnectedCallback";
const String kAttributeChangedCallback = "attributeChangedCallback";
- return retrieveObservedAttributes()
- && callableForName(kConnectedCallback, m_connectedCallback)
+ return callableForName(kConnectedCallback, m_connectedCallback)
&& callableForName(kDisconnectedCallback, m_disconnectedCallback)
- && callableForName(kAttributeChangedCallback, m_attributeChangedCallback);
+ && callableForName(kAttributeChangedCallback, m_attributeChangedCallback)
+ && (m_attributeChangedCallback.IsEmpty() || retrieveObservedAttributes());
}
CustomElementDefinition* ScriptCustomElementDefinitionBuilder::build(

Powered by Google App Engine
This is Rietveld 408576698