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

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
Index: Source/bindings/core/v8/NPV8Object.cpp
diff --git a/Source/bindings/core/v8/NPV8Object.cpp b/Source/bindings/core/v8/NPV8Object.cpp
index eb0ca4426233a1168fd13801d9cfc58a08c0f4cf..7b555bc624ea1adb117c96fe237a41e72b2c7498 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(arguments, argumentCount, npObject, isolate);
- 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);
@@ -317,16 +316,16 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments,
v8::Local<v8::Value> resultObject;
haraken 2015/04/18 23:10:46 Move this down to line 327.
bashi 2015/04/21 00:15:40 Done.
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(arguments, argumentCount, npObject, isolate);
- resultObject = frame->script().callFunction(function, functionObject, argumentCount, argv.get());
- }
+ LocalFrame* frame = v8NpObject->rootObject->frame();
+ ASSERT(frame);
+
+ OwnPtr<v8::Local<v8::Value>[]> argv = createValueListFromVariantArgs(arguments, argumentCount, npObject, isolate);
// 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())
+ if (!frame->script().callFunction(function, functionObject, argumentCount, argv.get()).ToLocal(&resultObject))
return false;
convertV8ObjectToNPVariant(isolate, resultObject, npObject, result);

Powered by Google App Engine
This is Rietveld 408576698