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

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

Issue 1061503005: bindings: Use Maybe version of Call() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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
« no previous file with comments | « Source/bindings/core/v8/Iterable.h ('k') | Source/bindings/core/v8/PrivateScriptRunner.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/NPV8Object.cpp
diff --git a/Source/bindings/core/v8/NPV8Object.cpp b/Source/bindings/core/v8/NPV8Object.cpp
index fa7b65099bd16a1d74af2b2cbd8d916d08c2f7e8..6135f1bb39ff82bc101dab8da048c30553f2df62 100644
--- a/Source/bindings/core/v8/NPV8Object.cpp
+++ b/Source/bindings/core/v8/NPV8Object.cpp
@@ -273,11 +273,10 @@ bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV
// Call the function object.
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(functionObject);
OwnPtr<v8::Local<v8::Value>[]> argv = createValueListFromVariantArgs(isolate, arguments, argumentCount, npObject);
- v8::Local<v8::Value> resultObject = frame->script().callFunction(function, v8Object, argumentCount, argv.get());
-
// If we had an error, return false. The spec is a little unclear here, but says "Returns true if the method was
// successfully invoked". If we get an error return value, was that successfully invoked?
- if (resultObject.IsEmpty())
+ v8::Local<v8::Value> resultObject;
+ if (!frame->script().callFunction(function, v8Object, argumentCount, argv.get()).ToLocal(&resultObject))
return false;
convertV8ObjectToNPVariant(isolate, resultObject, npObject, result);
@@ -315,18 +314,18 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments,
if (!functionObject->IsFunction())
return false;
- v8::Local<v8::Value> resultObject;
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(functionObject);
- if (!function->IsNull()) {
- LocalFrame* frame = v8NpObject->rootObject->frame();
- ASSERT(frame);
+ if (function->IsNull())
+ return false;
- OwnPtr<v8::Local<v8::Value>[]> argv = createValueListFromVariantArgs(isolate, arguments, argumentCount, npObject);
- resultObject = frame->script().callFunction(function, functionObject, argumentCount, argv.get());
- }
+ LocalFrame* frame = v8NpObject->rootObject->frame();
+ ASSERT(frame);
+
+ OwnPtr<v8::Local<v8::Value>[]> argv = createValueListFromVariantArgs(isolate, arguments, argumentCount, npObject);
// If we had an error, return false. The spec is a little unclear here, but says "Returns true if the method was
// successfully invoked". If we get an error return value, was that successfully invoked?
- if (resultObject.IsEmpty())
+ v8::Local<v8::Value> resultObject;
+ if (!frame->script().callFunction(function, functionObject, argumentCount, argv.get()).ToLocal(&resultObject))
return false;
convertV8ObjectToNPVariant(isolate, resultObject, npObject, result);
« no previous file with comments | « Source/bindings/core/v8/Iterable.h ('k') | Source/bindings/core/v8/PrivateScriptRunner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698