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

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: 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/Iterable.h ('k') | Source/bindings/core/v8/ScriptPromiseProperty.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptController.cpp
diff --git a/Source/bindings/core/v8/ScriptController.cpp b/Source/bindings/core/v8/ScriptController.cpp
index 1817fc016317750364605656416d8f9cf9cfa379..91ded0e53637bc8cb806c77a874f93c6b8f3fd35 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())
return createNoScriptObject();
return npCreateV8ScriptObject(scriptState->isolate(), 0, v8::Local<v8::Object>::Cast(v8plugin), window);
« no previous file with comments | « Source/bindings/core/v8/Iterable.h ('k') | Source/bindings/core/v8/ScriptPromiseProperty.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698