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

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 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 ScriptPromise promise = resolver->promise(); 2435 ScriptPromise promise = resolver->promise();
2436 resolver->reject(value); 2436 resolver->reject(value);
2437 return promise; 2437 return promise;
2438 } 2438 }
2439 2439
2440 ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromis e promise) 2440 ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromis e promise)
2441 { 2441 {
2442 return promise.then(AddOneFunction::create(context)); 2442 return promise.then(AddOneFunction::create(context));
2443 } 2443 }
2444 2444
2445 ScriptPromise Internals::promiseCheck(ExecutionContext* context, long arg1, bool arg2, const Dictionary& arg3, const String& arg4, ExceptionState& es)
haraken 2014/04/11 13:57:13 es => exceptionState
yhirano 2014/04/14 01:03:37 Done.
2446 {
2447 if (arg2)
2448 return ScriptPromise::cast(v8String(toIsolate(context), "done"), toIsola te(context));
2449 es.throwDOMException(InvalidStateError, "Thrown from the native implementati on.");
2450 return ScriptPromise();
2451 }
2452
2453 ScriptPromise Internals::promiseCheckWithoutExceptionState(ExecutionContext* con text, const Dictionary& arg1, const String& arg2, const Vector<String>& arg3)
2454 {
2455 return ScriptPromise::cast(v8String(toIsolate(context), "done"), toIsolate(c ontext));
2456 }
2457
2458 ScriptPromise Internals::promiseCheckRange(ExecutionContext* context, long arg1)
2459 {
2460 return ScriptPromise::cast(v8String(toIsolate(context), "done"), toIsolate(c ontext));
2461 }
2462
2445 void Internals::trace(Visitor* visitor) 2463 void Internals::trace(Visitor* visitor)
2446 { 2464 {
2447 visitor->trace(m_frontendWindow); 2465 visitor->trace(m_frontendWindow);
2448 visitor->trace(m_runtimeFlags); 2466 visitor->trace(m_runtimeFlags);
2449 visitor->trace(m_profilers); 2467 visitor->trace(m_profilers);
2450 } 2468 }
2451 2469
2452 void Internals::startSpeechInput(Element* element) 2470 void Internals::startSpeechInput(Element* element)
2453 { 2471 {
2454 #if ENABLE(INPUT_SPEECH) 2472 #if ENABLE(INPUT_SPEECH)
(...skipping 15 matching lines...) Expand all
2470 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2488 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2471 { 2489 {
2472 if (!node) 2490 if (!node)
2473 return String(); 2491 return String();
2474 blink::WebPoint point(x, y); 2492 blink::WebPoint point(x, y);
2475 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength); 2493 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2476 return surroundingText.content(); 2494 return surroundingText.content();
2477 } 2495 }
2478 2496
2479 } 2497 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698