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

Side by Side Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 232563003: API functions returning Promises should not throw exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « Source/bindings/tests/idls/TestObject.idl ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestObject.h" 8 #include "V8TestObject.h"
9 9
10 #include "bindings/core/v8/BindingSecurity.h" 10 #include "bindings/core/v8/BindingSecurity.h"
(...skipping 6669 matching lines...) Expand 10 before | Expand all | Expand 10 after
6680 6680
6681 static void nodeFilterMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info) 6681 static void nodeFilterMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
6682 { 6682 {
6683 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 6683 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
6684 TestObjectV8Internal::nodeFilterMethodMethod(info); 6684 TestObjectV8Internal::nodeFilterMethodMethod(info);
6685 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 6685 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
6686 } 6686 }
6687 6687
6688 static void promiseMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 6688 static void promiseMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
6689 { 6689 {
6690 ExceptionState exceptionState(ExceptionState::ExecutionContext, "promiseMeth od", "TestObject", info.Holder(), info.GetIsolate());
6691 if (UNLIKELY(info.Length() < 3)) {
6692 v8SetReturnValue(info, ScriptPromise::rejectWithMinimumArityTypeError(Sc riptState::current(info.GetIsolate()), exceptionState, 3, info.Length()).v8Value ());
6693 return;
6694 }
6690 TestObject* impl = V8TestObject::toNative(info.Holder()); 6695 TestObject* impl = V8TestObject::toNative(info.Holder());
6691 v8SetReturnValue(info, impl->promiseMethod().v8Value()); 6696 int arg1;
6697 Dictionary arg2;
6698 V8StringResource<> arg3;
6699 Vector<String> variadic;
6700 {
6701 v8::TryCatch block;
6702 V8RethrowTryCatchScope rethrow(block);
6703 TONATIVE_VOID_EXCEPTIONSTATE_PROMISE_INTERNAL(arg1, toInt32(info[0], exc eptionState), exceptionState, info, ScriptState::current(info.GetIsolate()));
6704 TONATIVE_VOID_PROMISE_INTERNAL(arg2, Dictionary(info[1], info.GetIsolate ()), info);
6705 if (!arg2.isUndefinedOrNull() && !arg2.isObject()) {
6706 exceptionState.throwTypeError("parameter 2 ('arg2') is not an object .");
6707 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(in fo.GetIsolate())).v8Value());
6708 return;
6709 }
6710 TOSTRING_VOID_PROMISE_INTERNAL(arg3, info[2], info);
6711 TONATIVE_VOID_PROMISE_INTERNAL(variadic, toNativeArguments<String>(info, 3), info);
6712 }
6713 v8SetReturnValue(info, impl->promiseMethod(arg1, arg2, arg3, variadic).v8Val ue());
6692 } 6714 }
6693 6715
6694 static void promiseMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value >& info) 6716 static void promiseMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value >& info)
6695 { 6717 {
6696 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 6718 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
6697 TestObjectV8Internal::promiseMethodMethod(info); 6719 TestObjectV8Internal::promiseMethodMethod(info);
6698 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 6720 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
6699 } 6721 }
6700 6722
6723 static void promiseMethodWithoutExceptionStateMethod(const v8::FunctionCallbackI nfo<v8::Value>& info)
6724 {
6725 if (UNLIKELY(info.Length() < 1)) {
6726 v8SetReturnValue(info, ScriptPromise::rejectWithMinimumArityTypeErrorFor Method(ScriptState::current(info.GetIsolate()), "promiseMethodWithoutExceptionSt ate", "TestObject", 1, info.Length()).v8Value());
6727 return;
6728 }
6729 TestObject* impl = V8TestObject::toNative(info.Holder());
6730 Dictionary arg1;
6731 {
6732 v8::TryCatch block;
6733 V8RethrowTryCatchScope rethrow(block);
6734 TONATIVE_VOID_PROMISE_INTERNAL(arg1, Dictionary(info[0], info.GetIsolate ()), info);
6735 if (!arg1.isUndefinedOrNull() && !arg1.isObject()) {
6736 v8SetReturnValue(info, ScriptPromise::rejectWithTypeError(ScriptStat e::current(info.GetIsolate()), ExceptionMessages::failedToExecute("promiseMethod WithoutExceptionState", "TestObject", "parameter 1 ('arg1') is not an object.")) .v8Value());
6737 return;
6738 }
6739 }
6740 v8SetReturnValue(info, impl->promiseMethodWithoutExceptionState(arg1).v8Valu e());
6741 }
6742
6743 static void promiseMethodWithoutExceptionStateMethodCallback(const v8::FunctionC allbackInfo<v8::Value>& info)
6744 {
6745 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
6746 TestObjectV8Internal::promiseMethodWithoutExceptionStateMethod(info);
6747 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
6748 }
6749
6701 static void serializedScriptValueMethodMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 6750 static void serializedScriptValueMethodMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
6702 { 6751 {
6703 TestObject* impl = V8TestObject::toNative(info.Holder()); 6752 TestObject* impl = V8TestObject::toNative(info.Holder());
6704 v8SetReturnValue(info, impl->serializedScriptValueMethod() ? impl->serialize dScriptValueMethod()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIso late()))); 6753 v8SetReturnValue(info, impl->serializedScriptValueMethod() ? impl->serialize dScriptValueMethod()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIso late())));
6705 } 6754 }
6706 6755
6707 static void serializedScriptValueMethodMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 6756 static void serializedScriptValueMethodMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
6708 { 6757 {
6709 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 6758 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
6710 TestObjectV8Internal::serializedScriptValueMethodMethod(info); 6759 TestObjectV8Internal::serializedScriptValueMethodMethod(info);
(...skipping 3634 matching lines...) Expand 10 before | Expand all | Expand 10 after
10345 {"nullableTestInterfaceMethod", TestObjectV8Internal::nullableTestInterfaceM ethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, 10394 {"nullableTestInterfaceMethod", TestObjectV8Internal::nullableTestInterfaceM ethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
10346 {"nullableLongSequenceMethod", TestObjectV8Internal::nullableLongSequenceMet hodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, 10395 {"nullableLongSequenceMethod", TestObjectV8Internal::nullableLongSequenceMet hodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
10347 {"voidMethodTestInterfaceEmptyOrNullArg", TestObjectV8Internal::voidMethodTe stInterfaceEmptyOrNullArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllS cripts}, 10396 {"voidMethodTestInterfaceEmptyOrNullArg", TestObjectV8Internal::voidMethodTe stInterfaceEmptyOrNullArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllS cripts},
10348 {"voidMethodTestCallbackInterfaceArg", TestObjectV8Internal::voidMethodTestC allbackInterfaceArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts }, 10397 {"voidMethodTestCallbackInterfaceArg", TestObjectV8Internal::voidMethodTestC allbackInterfaceArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts },
10349 {"voidMethodOptionalTestCallbackInterfaceArg", TestObjectV8Internal::voidMet hodOptionalTestCallbackInterfaceArgMethodCallback, 0, 0, V8DOMConfiguration::Exp osedToAllScripts}, 10398 {"voidMethodOptionalTestCallbackInterfaceArg", TestObjectV8Internal::voidMet hodOptionalTestCallbackInterfaceArgMethodCallback, 0, 0, V8DOMConfiguration::Exp osedToAllScripts},
10350 {"voidMethodTestCallbackInterfaceOrNullArg", TestObjectV8Internal::voidMetho dTestCallbackInterfaceOrNullArgMethodCallback, 0, 1, V8DOMConfiguration::Exposed ToAllScripts}, 10399 {"voidMethodTestCallbackInterfaceOrNullArg", TestObjectV8Internal::voidMetho dTestCallbackInterfaceOrNullArgMethodCallback, 0, 1, V8DOMConfiguration::Exposed ToAllScripts},
10351 {"testEnumMethod", TestObjectV8Internal::testEnumMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, 10400 {"testEnumMethod", TestObjectV8Internal::testEnumMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
10352 {"voidMethodTestEnumArg", TestObjectV8Internal::voidMethodTestEnumArgMethodC allback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, 10401 {"voidMethodTestEnumArg", TestObjectV8Internal::voidMethodTestEnumArgMethodC allback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
10353 {"dictionaryMethod", TestObjectV8Internal::dictionaryMethodMethodCallback, 0 , 0, V8DOMConfiguration::ExposedToAllScripts}, 10402 {"dictionaryMethod", TestObjectV8Internal::dictionaryMethodMethodCallback, 0 , 0, V8DOMConfiguration::ExposedToAllScripts},
10354 {"nodeFilterMethod", TestObjectV8Internal::nodeFilterMethodMethodCallback, 0 , 0, V8DOMConfiguration::ExposedToAllScripts}, 10403 {"nodeFilterMethod", TestObjectV8Internal::nodeFilterMethodMethodCallback, 0 , 0, V8DOMConfiguration::ExposedToAllScripts},
10355 {"promiseMethod", TestObjectV8Internal::promiseMethodMethodCallback, 0, 0, V 8DOMConfiguration::ExposedToAllScripts}, 10404 {"promiseMethod", TestObjectV8Internal::promiseMethodMethodCallback, 0, 3, V 8DOMConfiguration::ExposedToAllScripts},
10405 {"promiseMethodWithoutExceptionState", TestObjectV8Internal::promiseMethodWi thoutExceptionStateMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts },
10356 {"serializedScriptValueMethod", TestObjectV8Internal::serializedScriptValueM ethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, 10406 {"serializedScriptValueMethod", TestObjectV8Internal::serializedScriptValueM ethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
10357 {"xPathNSResolverMethod", TestObjectV8Internal::xPathNSResolverMethodMethodC allback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, 10407 {"xPathNSResolverMethod", TestObjectV8Internal::xPathNSResolverMethodMethodC allback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
10358 {"voidMethodDictionaryArg", TestObjectV8Internal::voidMethodDictionaryArgMet hodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, 10408 {"voidMethodDictionaryArg", TestObjectV8Internal::voidMethodDictionaryArgMet hodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
10359 {"voidMethodNodeFilterArg", TestObjectV8Internal::voidMethodNodeFilterArgMet hodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, 10409 {"voidMethodNodeFilterArg", TestObjectV8Internal::voidMethodNodeFilterArgMet hodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
10360 {"voidMethodPromiseArg", TestObjectV8Internal::voidMethodPromiseArgMethodCal lback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, 10410 {"voidMethodPromiseArg", TestObjectV8Internal::voidMethodPromiseArgMethodCal lback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
10361 {"voidMethodSerializedScriptValueArg", TestObjectV8Internal::voidMethodSeria lizedScriptValueArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts }, 10411 {"voidMethodSerializedScriptValueArg", TestObjectV8Internal::voidMethodSeria lizedScriptValueArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts },
10362 {"voidMethodXPathNSResolverArg", TestObjectV8Internal::voidMethodXPathNSReso lverArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, 10412 {"voidMethodXPathNSResolverArg", TestObjectV8Internal::voidMethodXPathNSReso lverArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
10363 {"voidMethodDictionarySequenceArg", TestObjectV8Internal::voidMethodDictiona rySequenceArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, 10413 {"voidMethodDictionarySequenceArg", TestObjectV8Internal::voidMethodDictiona rySequenceArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
10364 {"voidMethodStringArgLongArg", TestObjectV8Internal::voidMethodStringArgLong ArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts}, 10414 {"voidMethodStringArgLongArg", TestObjectV8Internal::voidMethodStringArgLong ArgMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts},
10365 {"voidMethodOptionalStringArg", TestObjectV8Internal::voidMethodOptionalStri ngArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, 10415 {"voidMethodOptionalStringArg", TestObjectV8Internal::voidMethodOptionalStri ngArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
11203 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip tState->isolate(), exceptionState, block.Exception())) { 11253 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip tState->isolate(), exceptionState, block.Exception())) {
11204 // FIXME: We should support exceptions other than DOM exceptions. 11254 // FIXME: We should support exceptions other than DOM exceptions.
11205 RELEASE_ASSERT_NOT_REACHED(); 11255 RELEASE_ASSERT_NOT_REACHED();
11206 } 11256 }
11207 return false; 11257 return false;
11208 } 11258 }
11209 return true; 11259 return true;
11210 } 11260 }
11211 11261
11212 } // namespace blink 11262 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/idls/TestObject.idl ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698