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

Unified Diff: Source/bindings/core/v8/V8Binding.h

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, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/core/v8/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index 14cac2abf7a8479a83b545b4f787cd7f298cb3ff..cd03efc9e5d9b034d155efe03db82440efdef37f 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -952,27 +952,20 @@ PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio
class V8RethrowTryCatchScope FINAL {
haraken 2014/07/31 07:54:47 Just to confirm: Do you have a plan to remove V8Re
Jens Widell 2014/07/31 08:29:09 V8RethrowTryCatchScope isn't a workaround for the
haraken 2014/07/31 08:40:29 Understood. Then it makes sense to have a cancel()
public:
- explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block) { }
+ explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block), m_isCanceled(false) { }
haraken 2014/07/31 07:54:47 Drop explicit.
yhirano 2014/08/01 02:27:57 It should be explicit, shouldn't it?
haraken 2014/08/01 02:42:40 Sorry, I misread the code.
+ void cancel() { m_isCanceled = true; }
~V8RethrowTryCatchScope()
{
- // ReThrow() is a no-op if no exception has been caught, so always call.
- m_block.ReThrow();
- }
-
-private:
- v8::TryCatch& m_block;
-};
-
-class V8ResetTryCatchScope FINAL {
-public:
- explicit V8ResetTryCatchScope(v8::TryCatch& block) : m_block(block) { }
- ~V8ResetTryCatchScope()
- {
- m_block.Reset();
+ if (!m_isCanceled) {
+ // ReThrow() is a no-op if no exception has been caught, so always
+ // call.
+ m_block.ReThrow();
+ }
}
private:
v8::TryCatch& m_block;
+ bool m_isCanceled;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698