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

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

Issue 2326443002: [chromedriver] Discard pending frames except for the frame we just navigated to. (Closed)
Patch Set: dont use |tmp_set|, always clear scheduled frame set Created 4 years, 3 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 2089f9866530d256c7f4db4e7e488ffe8d782116..bebbc72f1f86e027a8c566cb237844de43d3fc13 100644
--- a/chrome/test/chromedriver/chrome/navigation_tracker.cc
+++ b/chrome/test/chromedriver/chrome/navigation_tracker.cc
@@ -281,15 +281,24 @@ Status NavigationTracker::OnEvent(DevToolsClient* client,
pending_frame_set_.clear();
scheduled_frame_set_.clear();
} else {
+ // Discard pending and scheduled frames, except for the frame that just
stgao 2016/09/20 23:44:19 It might worth mentioning this is the root frame.
samuong 2016/09/21 14:36:55 Done.
+ // navigated (which we should consider pending until we receive a
+ // Page.frameStoppedLoading event for it).
+ std::string frame_id;
+ if (!params.GetString("frame.id", &frame_id))
+ return Status(kUnknownError, "missing or invalid 'frame.id'");
+ bool frame_was_pending = pending_frame_set_.count(frame_id) > 0;
+ pending_frame_set_.clear();
+ scheduled_frame_set_.clear();
+ if (frame_was_pending)
+ pending_frame_set_.insert(frame_id);
// If the URL indicates that the web page is unreachable (the sad tab
- // page) then discard any pending or scheduled navigations.
+ // page) then discard all pending navigations.
std::string frame_url;
if (!params.GetString("frame.url", &frame_url))
return Status(kUnknownError, "missing or invalid 'frame.url'");
- if (frame_url == kUnreachableWebDataURL) {
+ if (frame_url == kUnreachableWebDataURL)
pending_frame_set_.clear();
- scheduled_frame_set_.clear();
- }
}
} else {
// If a child frame just navigated, check if it is the dummy frame that
« 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