Index: chrome/test/chromedriver/chrome/navigation_tracker.cc |
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker.cc b/chrome/test/chromedriver/chrome/navigation_tracker.cc |
index 0f31e7813f397a02b1d429ceb2da60a03255f106..9ef6b2bd7e21616e9d2a30488853744dfe00860b 100644 |
--- a/chrome/test/chromedriver/chrome/navigation_tracker.cc |
+++ b/chrome/test/chromedriver/chrome/navigation_tracker.cc |
@@ -56,11 +56,17 @@ Status NavigationTracker::IsPendingNavigation(const std::string& frame_id, |
scoped_ptr<base::DictionaryValue> result; |
Status status = client_->SendCommandAndGetResult( |
"Runtime.evaluate", params, &result); |
- int value = 0; |
- if (status.IsError() || |
- !result->GetInteger("result.value", &value) || |
- value != 1) |
- return Status(kUnknownError, "cannot determine loading status", status); |
+ if (status.IsError()) { |
+ int value = 0; |
+ if (status.code() == kDisconnected) { |
+ // If we receive a kDisconnected status code from Runtime.evaluate, it |
+ // might have been because the target window closed or has crashed. |
+ *is_pending = false; |
+ return Status(kOk); |
+ } else if (!result->GetInteger("result.value", &value) || value != 1) { |
+ return Status(kUnknownError, "cannot determine loading status", status); |
+ } |
+ } |
} |
if (loading_state_ == kUnknown) { |