Commit 37e22c2c authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Fix WebStateDelegateTabHelperTest.GetJavaScriptDialogPresenter

The default cancellation handler is deleted after calling Cancel(),
so the observer needs to be removed before cancellation.

Bug: 1038514
Change-Id: I9a638b9ae7c6c44e4655fb5d80674285620c308d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032062Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Auto-Submit: Kurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737213}
parent aca28b2b
......@@ -43,16 +43,22 @@ void DefaultOverlayRequestCancelHandler::NavigationHelper::DidFinishNavigation(
if (navigation_context->HasCommitted() &&
!navigation_context->IsSameDocument()) {
cancel_handler_->Cancel();
// The cancel handler is destroyed after Cancel(), so no code can be added
// after this call.
}
}
void DefaultOverlayRequestCancelHandler::NavigationHelper::RenderProcessGone(
web::WebState* web_state) {
cancel_handler_->Cancel();
// The cancel handler is destroyed after Cancel(), so no code can be added
// after this call.
}
void DefaultOverlayRequestCancelHandler::NavigationHelper::WebStateDestroyed(
web::WebState* web_state) {
cancel_handler_->Cancel();
scoped_observer_.RemoveAll();
cancel_handler_->Cancel();
// The cancel handler is destroyed after Cancel(), so no code can be added
// after this call.
}
......@@ -66,8 +66,7 @@ TEST_F(WebStateDelegateTabHelperTest, OnAuthRequired) {
// Tests that GetJavaScriptDialogPresenter() returns an overlay-based JavaScript
// dialog presenter.
// TODO(crbug.com/1038514): Re-enable this test.
TEST_F(WebStateDelegateTabHelperTest, DISABLED_GetJavaScriptDialogPresenter) {
TEST_F(WebStateDelegateTabHelperTest, GetJavaScriptDialogPresenter) {
// Verify that the delegate returns a non-null presenter.
web::JavaScriptDialogPresenter* presenter =
delegate()->GetJavaScriptDialogPresenter(web_state());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment