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

Unified Diff: Source/bindings/core/v8/ScriptController.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/ScriptController.cpp
diff --git a/Source/bindings/core/v8/ScriptController.cpp b/Source/bindings/core/v8/ScriptController.cpp
index dac562197a9427ea5059f6d46710f4a2b87a0028..bc90fc40411315284c253f49b20c3517dd7139be 100644
--- a/Source/bindings/core/v8/ScriptController.cpp
+++ b/Source/bindings/core/v8/ScriptController.cpp
@@ -353,6 +353,8 @@ static NPObject* createScriptObject(LocalFrame* frame, v8::Isolate* isolate)
ScriptState::Scope scope(scriptState);
LocalDOMWindow* window = frame->localDOMWindow();
v8::Local<v8::Value> global = toV8(window, scriptState->context()->Global(), scriptState->isolate());
+ if (global.IsEmpty())
+ return createNoScriptObject();
ASSERT(global->IsObject());
return npCreateV8ScriptObject(isolate, 0, v8::Local<v8::Object>::Cast(global), window);
}
@@ -389,7 +391,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
ScriptState::Scope scope(scriptState);
LocalDOMWindow* window = frame()->localDOMWindow();
v8::Local<v8::Value> v8plugin = toV8(plugin, scriptState->context()->Global(), scriptState->isolate());
- if (!v8plugin->IsObject())
+ if (v8plugin.IsEmpty() || !v8plugin->IsObject())
haraken 2015/04/28 04:24:59 I think we can remove the v8plugin->IsObject() che
Yuki 2015/04/28 04:47:57 For the code reader, it's not clear that the follo
bashi 2015/04/28 05:41:53 I'd also prefer keeping IsObject() check. Let's ke
return createNoScriptObject();
return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Local<v8::Object>::Cast(v8plugin), window);

Powered by Google App Engine
This is Rietveld 408576698