Commit c608fd19 authored by Pavel Feldman's avatar Pavel Feldman Committed by Commit Bot

DevTools: expose loaderId in the return value of Page.navigate protocol command.

Bug: 
Change-Id: Id6d1150ff524aa5b37f615b5b6cbbb0bb5000d65
Reviewed-on: https://chromium-review.googlesource.com/764880Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517901}
parent ff61d987
...@@ -359,7 +359,7 @@ void PageHandler::Navigate(const std::string& url, ...@@ -359,7 +359,7 @@ void PageHandler::Navigate(const std::string& url,
std::string frame_id = std::string frame_id =
web_contents->GetMainFrame()->GetDevToolsFrameToken().ToString(); web_contents->GetMainFrame()->GetDevToolsFrameToken().ToString();
std::string error_string = net::ErrorToString(net::ERR_ABORTED); std::string error_string = net::ErrorToString(net::ERR_ABORTED);
navigate_callback_->sendSuccess(frame_id, navigate_callback_->sendSuccess(frame_id, Maybe<std::string>(),
Maybe<std::string>(error_string)); Maybe<std::string>(error_string));
} }
navigate_callback_ = std::move(callback); navigate_callback_ = std::move(callback);
...@@ -384,6 +384,8 @@ void PageHandler::NavigationReset(NavigationRequest* navigation_request) { ...@@ -384,6 +384,8 @@ void PageHandler::NavigationReset(NavigationRequest* navigation_request) {
net::ErrorToString(navigation_request->net_error()); net::ErrorToString(navigation_request->net_error());
navigate_callback_->sendSuccess( navigate_callback_->sendSuccess(
frame_id, frame_id,
Maybe<std::string>(
navigation_request->devtools_navigation_token().ToString()),
success ? Maybe<std::string>(error_string) : Maybe<std::string>()); success ? Maybe<std::string>(error_string) : Maybe<std::string>());
navigate_callback_.reset(); navigate_callback_.reset();
} }
......
...@@ -598,9 +598,12 @@ Response InspectorPageAgent::navigate(const String& url, ...@@ -598,9 +598,12 @@ Response InspectorPageAgent::navigate(const String& url,
Maybe<String> referrer, Maybe<String> referrer,
Maybe<String> transitionType, Maybe<String> transitionType,
String* out_frame_id, String* out_frame_id,
Maybe<String>* out_loader_id,
Maybe<String>* errorText) { Maybe<String>* errorText) {
LocalFrame* frame = inspected_frames_->Root(); LocalFrame* frame = inspected_frames_->Root();
*out_frame_id = IdentifiersFactory::FrameId(frame); *out_frame_id = IdentifiersFactory::FrameId(frame);
DocumentLoader* loader = frame->Loader().GetDocumentLoader();
*out_loader_id = IdentifiersFactory::LoaderId(loader);
return Response::OK(); return Response::OK();
} }
......
...@@ -125,6 +125,7 @@ class CORE_EXPORT InspectorPageAgent final ...@@ -125,6 +125,7 @@ class CORE_EXPORT InspectorPageAgent final
Maybe<String> referrer, Maybe<String> referrer,
Maybe<String> transitionType, Maybe<String> transitionType,
String* frame_id, String* frame_id,
Maybe<String>* loader_id,
Maybe<String>* errorText) override; Maybe<String>* errorText) override;
protocol::Response stopLoading() override; protocol::Response stopLoading() override;
protocol::Response setAdBlockingEnabled(bool) override; protocol::Response setAdBlockingEnabled(bool) override;
......
...@@ -355,6 +355,7 @@ ...@@ -355,6 +355,7 @@
], ],
"returns": [ "returns": [
{ "name": "frameId", "$ref": "FrameId", "description": "Frame id that has navigated (or failed to navigate)" }, { "name": "frameId", "$ref": "FrameId", "description": "Frame id that has navigated (or failed to navigate)" },
{ "name": "loaderId", "$ref": "Network.LoaderId", "optional": true, "description": "Loader identifier.", "experimental": true },
{ "name": "errorText", "type": "string", "optional": true, "description": "User friendly error message, present if and only if navigation has failed." } { "name": "errorText", "type": "string", "optional": true, "description": "User friendly error message, present if and only if navigation has failed." }
], ],
"description": "Navigates current page to the given URL." "description": "Navigates current page to the given URL."
......
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