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

Side by Side Diff: Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp

Issue 675693002: An API returning a Promise should not throw an exceptions [overload version] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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/results/core/V8TestObject.cpp ('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 #if ENABLE(CONDITION) 8 #if ENABLE(CONDITION)
9 #include "V8TestInterfacePartial.h" 9 #include "V8TestInterfacePartial.h"
10 10
11 #include "bindings/core/v8/ExceptionState.h" 11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/PrivateScriptRunner.h" 12 #include "bindings/core/v8/PrivateScriptRunner.h"
13 #include "bindings/core/v8/ScriptPromise.h"
13 #include "bindings/core/v8/ScriptValue.h" 14 #include "bindings/core/v8/ScriptValue.h"
14 #include "bindings/core/v8/V8DOMConfiguration.h" 15 #include "bindings/core/v8/V8DOMConfiguration.h"
16 #include "bindings/core/v8/V8Document.h"
15 #include "bindings/core/v8/V8HiddenValue.h" 17 #include "bindings/core/v8/V8HiddenValue.h"
16 #include "bindings/core/v8/V8Node.h" 18 #include "bindings/core/v8/V8Node.h"
17 #include "bindings/core/v8/V8ObjectConstructor.h" 19 #include "bindings/core/v8/V8ObjectConstructor.h"
18 #include "bindings/core/v8/V8TestInterface.h" 20 #include "bindings/core/v8/V8TestInterface.h"
19 #include "bindings/core/v8/V8TestInterfaceEmpty.h" 21 #include "bindings/core/v8/V8TestInterfaceEmpty.h"
22 #include "bindings/core/v8/V8Window.h"
20 #include "bindings/tests/idls/modules/TestPartialInterfaceImplementation3.h" 23 #include "bindings/tests/idls/modules/TestPartialInterfaceImplementation3.h"
21 #include "core/dom/ContextFeatures.h" 24 #include "core/dom/ContextFeatures.h"
22 #include "core/dom/Document.h" 25 #include "core/dom/Document.h"
23 #include "core/frame/LocalFrame.h" 26 #include "core/frame/LocalFrame.h"
24 #include "platform/RuntimeEnabledFeatures.h" 27 #include "platform/RuntimeEnabledFeatures.h"
25 #include "platform/ScriptForbiddenScope.h" 28 #include "platform/ScriptForbiddenScope.h"
26 #include "platform/TraceEvent.h" 29 #include "platform/TraceEvent.h"
27 #include "wtf/GetPtr.h" 30 #include "wtf/GetPtr.h"
28 #include "wtf/RefPtr.h" 31 #include "wtf/RefPtr.h"
29 32
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 break; 88 break;
86 default: 89 default:
87 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length())); 90 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
88 exceptionState.throwIfNeeded(); 91 exceptionState.throwIfNeeded();
89 return; 92 return;
90 } 93 }
91 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); 94 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
92 exceptionState.throwIfNeeded(); 95 exceptionState.throwIfNeeded();
93 } 96 }
94 97
98 static void promiseMethodPartialOverload3Method(const v8::FunctionCallbackInfo<v 8::Value>& info)
99 {
100 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
101 Document* document;
102 {
103 if (info.Length() > 0 && !V8Document::hasInstance(info[0], info.GetIsola te())) {
104 v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), V 8ThrowException::createTypeError(ExceptionMessages::failedToExecute("promiseMeth odPartialOverload", "TestInterface", "parameter 1 is not of type 'Document'."), info.GetIsolate())));
105 return;
106 }
107 document = V8Document::toImpl(v8::Handle<v8::Object>::Cast(info[0]));
108 }
109 v8SetReturnValue(info, TestPartialInterfaceImplementation3::promiseMethodPar tialOverload(*impl, document).v8Value());
110 }
111
112 static void promiseMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8 ::Value>& info)
113 {
114 ExceptionState exceptionState(ExceptionState::ExecutionContext, "promiseMeth odPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
115 switch (std::min(1, info.Length())) {
116 case 0:
117 break;
118 case 1:
119 if (V8Document::hasInstance(info[0], info.GetIsolate())) {
120 promiseMethodPartialOverload3Method(info);
121 return;
122 }
123 break;
124 default:
125 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
126 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.G etIsolate())).v8Value());
127 return;
128 }
129 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
130 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIs olate())).v8Value());
131 }
132
133 static void staticPromiseMethodPartialOverload2Method(const v8::FunctionCallback Info<v8::Value>& info)
134 {
135 ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticPromi seMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
136 V8StringResource<> value;
137 {
138 TOSTRING_VOID_EXCEPTIONSTATE_PROMISE_INTERNAL(value, info[0], exceptionS tate, info, ScriptState::current(info.GetIsolate()));
139 }
140 v8SetReturnValue(info, TestPartialInterfaceImplementation3::staticPromiseMet hodPartialOverload(value).v8Value());
141 }
142
143 static void staticPromiseMethodPartialOverloadMethod(const v8::FunctionCallbackI nfo<v8::Value>& info)
144 {
145 ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticPromi seMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
146 switch (std::min(1, info.Length())) {
147 case 0:
148 break;
149 case 1:
150 if (true) {
151 staticPromiseMethodPartialOverload2Method(info);
152 return;
153 }
154 break;
155 default:
156 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
157 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.G etIsolate())).v8Value());
158 return;
159 }
160 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
161 v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIs olate())).v8Value());
162 }
163
95 static void partial2VoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 164 static void partial2VoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
96 { 165 {
97 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 166 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
98 V8StringResource<> value; 167 V8StringResource<> value;
99 { 168 {
100 TOSTRING_VOID_INTERNAL(value, info[0]); 169 TOSTRING_VOID_INTERNAL(value, info[0]);
101 } 170 }
102 TestPartialInterfaceImplementation3::partial2VoidMethod(*impl, value); 171 TestPartialInterfaceImplementation3::partial2VoidMethod(*impl, value);
103 } 172 }
104 173
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 301 }
233 302
234 void V8TestInterfacePartial::initialize() 303 void V8TestInterfacePartial::initialize()
235 { 304 {
236 // Should be invoked from initModules. 305 // Should be invoked from initModules.
237 V8TestInterface::updateWrapperTypeInfo( 306 V8TestInterface::updateWrapperTypeInfo(
238 &V8TestInterfacePartial::installV8TestInterfaceTemplate, 307 &V8TestInterfacePartial::installV8TestInterfaceTemplate,
239 &V8TestInterfacePartial::installConditionallyEnabledMethods); 308 &V8TestInterfacePartial::installConditionallyEnabledMethods);
240 V8TestInterface::registerVoidMethodPartialOverloadMethodForPartialInterface( &TestInterfaceImplementationPartialV8Internal::voidMethodPartialOverloadMethod); 309 V8TestInterface::registerVoidMethodPartialOverloadMethodForPartialInterface( &TestInterfaceImplementationPartialV8Internal::voidMethodPartialOverloadMethod);
241 V8TestInterface::registerStaticVoidMethodPartialOverloadMethodForPartialInte rface(&TestInterfaceImplementationPartialV8Internal::staticVoidMethodPartialOver loadMethod); 310 V8TestInterface::registerStaticVoidMethodPartialOverloadMethodForPartialInte rface(&TestInterfaceImplementationPartialV8Internal::staticVoidMethodPartialOver loadMethod);
311 V8TestInterface::registerPromiseMethodPartialOverloadMethodForPartialInterfa ce(&TestInterfaceImplementationPartialV8Internal::promiseMethodPartialOverloadMe thod);
312 V8TestInterface::registerStaticPromiseMethodPartialOverloadMethodForPartialI nterface(&TestInterfaceImplementationPartialV8Internal::staticPromiseMethodParti alOverloadMethod);
242 V8TestInterface::registerPartial2VoidMethodMethodForPartialInterface(&TestIn terfaceImplementationPartialV8Internal::partial2VoidMethodMethod); 313 V8TestInterface::registerPartial2VoidMethodMethodForPartialInterface(&TestIn terfaceImplementationPartialV8Internal::partial2VoidMethodMethod);
243 V8TestInterface::registerPartial2StaticVoidMethodMethodForPartialInterface(& TestInterfaceImplementationPartialV8Internal::partial2StaticVoidMethodMethod); 314 V8TestInterface::registerPartial2StaticVoidMethodMethodForPartialInterface(& TestInterfaceImplementationPartialV8Internal::partial2StaticVoidMethodMethod);
244 } 315 }
245 316
246 } // namespace blink 317 } // namespace blink
247 #endif // ENABLE(CONDITION) 318 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/core/V8TestObject.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698