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

Unified Diff: chrome/test/chromedriver/chrome/navigation_tracker.cc

Issue 1315473003: [chromedriver] Ignore response of Runtime.evaluate(1) if target closed or crashed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698