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

Side by Side Diff: Source/core/testing/Internals.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/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2175 } 2175 }
2176 2176
2177 ScriptPromise Internals::createRejectedPromise(ScriptState* scriptState, ScriptV alue value) 2177 ScriptPromise Internals::createRejectedPromise(ScriptState* scriptState, ScriptV alue value)
2178 { 2178 {
2179 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); 2179 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState);
2180 ScriptPromise promise = resolver->promise(); 2180 ScriptPromise promise = resolver->promise();
2181 resolver->reject(value); 2181 resolver->reject(value);
2182 return promise; 2182 return promise;
2183 } 2183 }
2184 2184
2185 ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromis e promise) 2185 ScriptPromise Internals::addOneToPromise(ScriptState* scriptState, ScriptPromise promise)
2186 { 2186 {
2187 return promise.then(AddOneFunction::create(context)); 2187 return promise.then(AddOneFunction::create(scriptState->executionContext())) ;
2188 }
2189
2190 ScriptPromise Internals::promiseCheck(ScriptState* scriptState, long arg1, bool arg2, const Dictionary& arg3, const String& arg4, const Vector<String>& arg5, Ex ceptionState& exceptionState)
2191 {
2192 if (arg2)
2193 return ScriptPromise::cast(scriptState, v8String(scriptState->isolate(), "done"));
2194 exceptionState.throwDOMException(InvalidStateError, "Thrown from the native implementation.");
2195 return ScriptPromise();
2196 }
2197
2198 ScriptPromise Internals::promiseCheckWithoutExceptionState(ScriptState* scriptSt ate, const Dictionary& arg1, const String& arg2, const Vector<String>& arg3)
2199 {
2200 return ScriptPromise::cast(scriptState, v8String(scriptState->isolate(), "do ne"));
2201 }
2202
2203 ScriptPromise Internals::promiseCheckRange(ScriptState* scriptState, long arg1)
2204 {
2205 return ScriptPromise::cast(scriptState, v8String(scriptState->isolate(), "do ne"));
2188 } 2206 }
2189 2207
2190 void Internals::trace(Visitor* visitor) 2208 void Internals::trace(Visitor* visitor)
2191 { 2209 {
2192 visitor->trace(m_runtimeFlags); 2210 visitor->trace(m_runtimeFlags);
2193 visitor->trace(m_profilers); 2211 visitor->trace(m_profilers);
2194 } 2212 }
2195 2213
2196 void Internals::setValueForUser(Element* element, const String& value) 2214 void Internals::setValueForUser(Element* element, const String& value)
2197 { 2215 {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 2277
2260 StringBuilder markup; 2278 StringBuilder markup;
2261 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2279 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
2262 for (; iter != elementData.end(); ++iter) 2280 for (; iter != elementData.end(); ++iter)
2263 markup.append(iter->markup); 2281 markup.append(iter->markup);
2264 2282
2265 return markup.toString(); 2283 return markup.toString();
2266 } 2284 }
2267 2285
2268 } // namespace blink 2286 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698