 Chromium Code Reviews
 Chromium Code Reviews Issue 232563003:
  API functions returning Promises should not throw exceptions.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 232563003:
  API functions returning Promises should not throw exceptions.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| 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..e34aa82b216038619cba67155e9deb790ba08813 100644 | 
| --- a/Source/bindings/core/v8/V8Binding.h | 
| +++ b/Source/bindings/core/v8/V8Binding.h | 
| @@ -952,27 +952,19 @@ PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio | 
| class V8RethrowTryCatchScope FINAL { | 
| public: | 
| - explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block) { } | 
| + explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block), m_isCanceled(false) { } | 
| + 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 { | 
| 
yhirano
2014/07/30 10:04:03
This class was introduced to cancel v8::TryCatch r
 | 
| -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 |