TryCatchScope doesn't work as expected with V8TestingScope |
|||
Issue descriptionI tried to use the TryCatchScope helper class in one my Blink binding unit tests but found out that it doesn't seem to work with the V8TestingScope. TryCatchScope: https://cs.chromium.org/chromium/src/third_party/blink/renderer/bindings/core/v8/v8_extras_test_utils.h?q=TryCatchScope Here's a reproduction case: TEST(TryCatchScopeTest, TestFailure) { V8TestingScope scope; TryCatchScope try_catch_scope(scope.GetIsolate()); scope.GetExceptionState().ThrowDOMException( DOMExceptionCode::kInvalidStateError, "Invalid state"); } I would expect the test to fail, but it actually passes. Am I using it wrong?
,
Sep 7
Yes, the test is wrong. It's confusing. TryCatchScope is only effective on V8 exceptions. But ExceptionState doesn't throw V8 exceptions, it records its own exception state separately. Normally you'd use NonThrowableExceptionState in a test where nothing should throw, or the handy shortcut ASSERT_NO_EXCEPTION when you're passing an ExceptionState into some function.
,
Sep 7
ricea@, based on c#2 can we close this as WontFix?
,
Sep 7
Ok, thanks for the clarification. It looks like ASSERT_NO_EXCEPTION is what I want. |
|||
►
Sign in to add a comment |
|||
Comment 1 by dtapu...@chromium.org
, Sep 6