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

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: Created 5 years, 8 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: Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp
diff --git a/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp b/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp
index 851eba6315cd5aa72d207ee7bf8a39b10ce730ae..7d54e1c9216c0d920604605f276b0330ac59ad6c 100644
--- a/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp
+++ b/Source/bindings/core/v8/V8CustomElementLifecycleCallbacks.cpp
@@ -156,6 +156,8 @@ void V8CustomElementLifecycleCallbacks::created(Element* element)
v8::Local<v8::Object> receiver = m_scriptState->world().domDataStore().get(element, isolate);
if (receiver.IsEmpty())
receiver = toV8(element, context->Global(), isolate).As<v8::Object>();
+ if (receiver.IsEmpty())
+ return;
haraken 2015/04/28 04:24:59 Not related to your CL, this code is doing somethi
Yuki 2015/04/28 04:47:57 and it should be done inside toV8(). I agree that
bashi 2015/04/28 05:41:53 As chatted offline, we can simply use toV8(). Done
// Swizzle the prototype of the wrapper.
v8::Local<v8::Object> prototype = m_prototype.newLocal(isolate);
@@ -197,7 +199,8 @@ void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const
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());
+ if (receiver.IsEmpty())
+ return;
v8::Local<v8::Function> callback = m_attributeChanged.newLocal(isolate);
if (callback.IsEmpty())
@@ -232,7 +235,8 @@ void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
return;
v8::Local<v8::Object> receiver = toV8(element, context->Global(), isolate).As<v8::Object>();
- ASSERT(!receiver.IsEmpty());
+ if (receiver.IsEmpty())
haraken 2015/04/28 04:24:59 Ditto. A bit too late to check the emptiness.
bashi 2015/04/28 05:41:53 Done.
+ return;
v8::TryCatch exceptionCatcher;
exceptionCatcher.SetVerbose(true);

Powered by Google App Engine
This is Rietveld 408576698