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

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, 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 unified diff | Download patch
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 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2422 ScriptPromise promise = resolver->promise(); 2422 ScriptPromise promise = resolver->promise();
2423 resolver->reject(value); 2423 resolver->reject(value);
2424 return promise; 2424 return promise;
2425 } 2425 }
2426 2426
2427 ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromis e promise) 2427 ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromis e promise)
2428 { 2428 {
2429 return promise.then(AddOneFunction::create(context)); 2429 return promise.then(AddOneFunction::create(context));
2430 } 2430 }
2431 2431
2432 ScriptPromise Internals::promiseCheck(ExecutionContext* context, long arg1, bool arg2, const Dictionary& arg3, const String& arg4, ExceptionState& es)
2433 {
2434 if (arg2)
2435 return ScriptPromise::cast(v8String(toIsolate(context), "done"), toIsola te(context));
2436 es.throwDOMException(InvalidStateError, "Thrown from the native implementati on.");
2437 return ScriptPromise();
2438 }
2439
2440 ScriptPromise Internals::promiseCheckWithoutExceptionState(ExecutionContext* con text, const Dictionary& arg1, const String& arg2, const Vector<String>& arg3)
2441 {
2442 return ScriptPromise::cast(v8String(toIsolate(context), "done"), toIsolate(c ontext));
2443 }
2444
2445 ScriptPromise Internals::promiseCheckRange(ExecutionContext* context, long arg1)
2446 {
2447 return ScriptPromise::cast(v8String(toIsolate(context), "done"), toIsolate(c ontext));
2448 }
2449
2432 void Internals::trace(Visitor* visitor) 2450 void Internals::trace(Visitor* visitor)
2433 { 2451 {
2434 visitor->trace(m_frontendWindow); 2452 visitor->trace(m_frontendWindow);
2435 visitor->trace(m_runtimeFlags); 2453 visitor->trace(m_runtimeFlags);
2436 visitor->trace(m_profilers); 2454 visitor->trace(m_profilers);
2437 } 2455 }
2438 2456
2439 void Internals::startSpeechInput(Element* element) 2457 void Internals::startSpeechInput(Element* element)
2440 { 2458 {
2441 #if ENABLE(INPUT_SPEECH) 2459 #if ENABLE(INPUT_SPEECH)
(...skipping 15 matching lines...) Expand all
2457 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2475 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2458 { 2476 {
2459 if (!node) 2477 if (!node)
2460 return String(); 2478 return String();
2461 blink::WebPoint point(x, y); 2479 blink::WebPoint point(x, y);
2462 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength); 2480 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2463 return surroundingText.content(); 2481 return surroundingText.content();
2464 } 2482 }
2465 2483
2466 } 2484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698