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

Unified Diff: Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp

Issue 1100223003: bindings: Add empty checks for toV8() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/core/v8/V8ErrorHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..844fbc1f3c0fca881544a13dd2ffb4e63d36cdb7 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())
@@ -231,8 +233,9 @@ void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
if (callback.IsEmpty())
return;
- 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::TryCatch exceptionCatcher;
exceptionCatcher.SetVerbose(true);
« no previous file with comments | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/core/v8/V8ErrorHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698