Commit 0946cba1 authored by Mathias Carlen's avatar Mathias Carlen Committed by Commit Bot

[Autofill Assistant] WaitForDomProto inconsistent.

Before this patch, the client and server protos differed in the fields ids and the
structure of the element to wait for. This resulted in selectors being empty and
timeout values off.

This patch fixes the numbering and replaces the element field with a
repeated string field.

After this patch, WaitForDomProto messages can properly be parsed.

Props to szermatt@ for finding this difference.

R=rouslan@chromium.org

Bug: 806868
Change-Id: Ib2c9822c6ef24001706b78c339f3d4b97c3aa947
Reviewed-on: https://chromium-review.googlesource.com/1249274
Commit-Queue: Mathias Carlen <mcarlen@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595021}
parent b58a0f97
...@@ -32,8 +32,8 @@ void WaitForDomAction::ProcessAction(ActionDelegate* delegate, ...@@ -32,8 +32,8 @@ void WaitForDomAction::ProcessAction(ActionDelegate* delegate,
ProcessActionCallback callback) { ProcessActionCallback callback) {
processed_action_proto_ = std::make_unique<ProcessedActionProto>(); processed_action_proto_ = std::make_unique<ProcessedActionProto>();
// Fail the action if the selector is empty. // Fail the action if selectors is empty.
if (proto_.wait_for_dom().element().selectors().empty()) { if (proto_.wait_for_dom().selectors().empty()) {
UpdateProcessedAction(false); UpdateProcessedAction(false);
DLOG(ERROR) << "Empty selector, failing action."; DLOG(ERROR) << "Empty selector, failing action.";
std::move(callback).Run(std::move(processed_action_proto_)); std::move(callback).Run(std::move(processed_action_proto_));
...@@ -54,7 +54,7 @@ void WaitForDomAction::CheckElementExists(ActionDelegate* delegate, ...@@ -54,7 +54,7 @@ void WaitForDomAction::CheckElementExists(ActionDelegate* delegate,
ProcessActionCallback callback) { ProcessActionCallback callback) {
DCHECK(rounds > 0); DCHECK(rounds > 0);
std::vector<std::string> selectors; std::vector<std::string> selectors;
for (const auto& selector : proto_.wait_for_dom().element().selectors()) { for (const auto& selector : proto_.wait_for_dom().selectors()) {
selectors.emplace_back(selector); selectors.emplace_back(selector);
} }
delegate->ElementExists( delegate->ElementExists(
......
...@@ -340,11 +340,11 @@ message UseCreditCardProto { ...@@ -340,11 +340,11 @@ message UseCreditCardProto {
// Ask Chrome to wait for an element in the DOM. This can be used to only // Ask Chrome to wait for an element in the DOM. This can be used to only
// proceed to the next action once the page is ready. // proceed to the next action once the page is ready.
message WaitForDomProto { message WaitForDomProto {
// The element to wait.
optional ElementReferenceProto element = 1;
// Fail after waiting this amount of time. // Fail after waiting this amount of time.
optional int32 timeout_ms = 2; optional int32 timeout_ms = 1;
// The element to wait for.
repeated string selectors = 2;
} }
// Volatile upload of a portion of the dom for backend analysis, does not store // Volatile upload of a portion of the dom for backend analysis, does not store
......
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