Chromium Code Reviews| Index: Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp |
| diff --git a/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp b/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp |
| index 851eba6315cd5aa72d207ee7bf8a39b10ce730ae..5762c739073bbde9cfb18b611c56db681dc98b16 100644 |
| --- a/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp |
| +++ b/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp |
| @@ -153,9 +153,10 @@ void V8CustomElementLifecycleCallbacks::created(Element* element) |
| ScriptState::Scope scope(m_scriptState.get()); |
| v8::Isolate* isolate = m_scriptState->isolate(); |
| v8::Local<v8::Context> context = m_scriptState->context(); |
| - v8::Local<v8::Object> receiver = m_scriptState->world().domDataStore().get(element, isolate); |
| - if (receiver.IsEmpty()) |
| - receiver = toV8(element, context->Global(), isolate).As<v8::Object>(); |
| + v8::Local<v8::Value> receiverValue = toV8(element, context->Global(), isolate); |
| + if (receiverValue.IsEmpty()) |
| + return; |
| + v8::Local<v8::Object> receiver = receiverValue.As<v8::Object>(); |
| // Swizzle the prototype of the wrapper. |
| v8::Local<v8::Object> prototype = m_prototype.newLocal(isolate); |
| @@ -196,8 +197,9 @@ void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const |
| ScriptState::Scope scope(m_scriptState.get()); |
| v8::Isolate* isolate = m_scriptState->isolate(); |
| v8::Local<v8::Context> context = m_scriptState->context(); |
| - v8::Local<v8::Object> receiver = toV8(element, context->Global(), isolate).As<v8::Object>(); |
| - ASSERT(!receiver.IsEmpty()); |
| + v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate); |
| + if (receiver.IsEmpty()) |
| + return; |
| v8::Local<v8::Function> callback = m_attributeChanged.newLocal(isolate); |
| if (callback.IsEmpty()) |
| @@ -232,7 +234,8 @@ void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function |
| return; |
| v8::Local<v8::Object> receiver = toV8(element, context->Global(), isolate).As<v8::Object>(); |
|
haraken
2015/04/28 05:50:34
Should check the emptiness before calling As.
bashi
2015/04/28 06:41:14
I missed this. Thanks.
|
| - ASSERT(!receiver.IsEmpty()); |
| + if (receiver.IsEmpty()) |
| + return; |
| v8::TryCatch exceptionCatcher; |
| exceptionCatcher.SetVerbose(true); |