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

Unified Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 22604003: Make DataTransferItem.getAsString() argument mandatory and nullable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take Arv's feedback into consideration Created 7 years, 4 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/tests/idls/TestObject.idl ('k') | Source/core/dom/DataTransferItem.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
index 894ac1f18ab4c5f27cc4fe8eb02c8e9795e72e17..aeae38b97cbde62a2443a92312594f66e5d821df 100644
--- a/Source/bindings/tests/results/V8TestObject.cpp
+++ b/Source/bindings/tests/results/V8TestObject.cpp
@@ -3762,6 +3762,30 @@ static void methodWithCallbackAndOptionalArgMethodCallback(const v8::FunctionCal
TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
}
+static void methodWithNullableCallbackArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
+{
+ if (args.Length() < 1) {
+ throwNotEnoughArgumentsError(args.GetIsolate());
+ return;
+ }
+ TestObj* imp = V8TestObject::toNative(args.Holder());
+ if (args.Length() <= 0 || !(args[0]->IsFunction() || args[0]->IsNull())) {
+ throwTypeError(args.GetIsolate());
+ return;
+ }
+ RefPtr<TestCallback> callback = args[0]->IsNull() ? 0 : V8TestCallback::create(args[0], getScriptExecutionContext());
+ imp->methodWithNullableCallbackArg(callback);
+
+ return;
+}
+
+static void methodWithNullableCallbackArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
+ TestObjV8Internal::methodWithNullableCallbackArgMethod(args);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
static void staticMethodWithCallbackAndOptionalArgMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
{
RefPtr<TestCallback> callback;
@@ -5489,6 +5513,7 @@ static const V8DOMConfiguration::BatchedMethod V8TestObjectMethods[] = {
{"methodWithCallbackArg", TestObjV8Internal::methodWithCallbackArgMethodCallback, 0, 1},
{"methodWithNonCallbackArgAndCallbackArg", TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgMethodCallback, 0, 2},
{"methodWithCallbackAndOptionalArg", TestObjV8Internal::methodWithCallbackAndOptionalArgMethodCallback, 0, 0},
+ {"methodWithNullableCallbackArg", TestObjV8Internal::methodWithNullableCallbackArgMethodCallback, 0, 1},
{"methodWithEnforceRangeInt8", TestObjV8Internal::methodWithEnforceRangeInt8MethodCallback, 0, 1},
{"methodWithEnforceRangeUInt8", TestObjV8Internal::methodWithEnforceRangeUInt8MethodCallback, 0, 1},
{"methodWithEnforceRangeInt32", TestObjV8Internal::methodWithEnforceRangeInt32MethodCallback, 0, 1},
« no previous file with comments | « Source/bindings/tests/idls/TestObject.idl ('k') | Source/core/dom/DataTransferItem.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698