Skip to content

Commit

Permalink
[CEX] Fix native action promise crash
Browse files Browse the repository at this point in the history
(cherry picked from commit aa24f63)

Bug: 1326397
Change-Id: Idd3c72e3a5e4f6e40fdbf134fcc313a7166c0ee4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3650721
Reviewed-by: Clemens Arbesser <arbesser@google.com>
Auto-Submit: Florian Gauger <fga@google.com>
Commit-Queue: Florian Gauger <fga@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1004288}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3662940
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5060@{#213}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Florian Gauger authored and Chromium LUCI CQ committed May 24, 2022
1 parent 06b3364 commit 421c319
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ void JsFlowAction::InternalProcessAction(ProcessActionCallback callback) {
void JsFlowAction::OnFlowFinished(ProcessActionCallback callback,
const ClientStatus& status,
std::unique_ptr<base::Value> return_value) {
// Since we can not know in advance how many native actions need to be run
// we will create a dangling promise. By destroying the flow executor we make
// sure that these will not be executed.
js_flow_executor_.reset(nullptr);

UpdateProcessedAction(status);

// If the flow returned a value, we extract the status and possibly a flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ void JsFlowExecutorImpl::RunCallback(
VLOG(1) << "Flow failed with " << status
<< " and result: " << *result_value;
}

std::move(callback_).Run(status, std::move(result_value));
}

Expand Down

0 comments on commit 421c319

Please sign in to comment.