void GetCrossDocumentScriptToolResult(Blink Style Guide: Dependencies. `core/` cannot depend on `public/web/`. The usage of `WebDocument::CrossDocumentScriptToolResultCallback` violates the dependency direction. Please define the callback type locally using `base::OnceCallback` and `WTF::String` (or `WebString` from `public/platform`).
To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason
_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
+David for chrome_render_frame_observer changes.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// navigation and the result wil be provided on the new Document.Can you just add a little more documentation here? Specifically, can you mention that `new_document_` will be null and `new_document_render_frame_` will be unbound UNTIL we're notified of the new document being committed, and finally once we determine that it is same-origin with its predecessor, these fields will be set?
if (target_document_render_frame_) {Why is this needed now?
<input id="echo" type="text" name="echo" required>Are these changes needed?
void GetCrossDocumentScriptToolResult(Blink Style Guide: Dependencies. `core/` cannot depend on `public/web/`. The usage of `WebDocument::CrossDocumentScriptToolResultCallback` violates the dependency direction. Please define the callback type locally using `base::OnceCallback` and `WTF::String` (or `WebString` from `public/platform`).
To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason
_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_
Amazing, one of the rare times the AI Code Reviewer is right...
| Auto-Submit | +1 |
| Commit-Queue | +1 |
// navigation and the result wil be provided on the new Document.Can you just add a little more documentation here? Specifically, can you mention that `new_document_` will be null and `new_document_render_frame_` will be unbound UNTIL we're notified of the new document being committed, and finally once we determine that it is same-origin with its predecessor, these fields will be set?
Done
Why is this needed now?
This notification only needs to be sent to the old Document to cancel ongoing async work for the tool execution. Earlier that was always set for `kInvokeSent` but now we tear down all connections to the old Document while we're waiting on the navigation commit/pending result.
<input id="echo" type="text" name="echo" required>Khushal SagarAre these changes needed?
Not strictly, I was trying to use the same input json in the tests as the imperative version.
void GetCrossDocumentScriptToolResult(Dominic FarolinoBlink Style Guide: Dependencies. `core/` cannot depend on `public/web/`. The usage of `WebDocument::CrossDocumentScriptToolResultCallback` violates the dependency direction. Please define the callback type locally using `base::OnceCallback` and `WTF::String` (or `WebString` from `public/platform`).
To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason
_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_
Amazing, one of the rare times the AI Code Reviewer is right...
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
GetCrossDocumentScriptToolResult() => (string result);nit: maybe explain what this string means/contains?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Commit-Queue | +1 |
nit: maybe explain what this string means/contains?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
third_party/blink/public/web/web_document.h LGTM
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
PostErrorResult(std::move(tool_done_callback_),Nit: I would put this first and return early for readability and to make adding to it slightly less error prone:
if (!new_host.GetLastCommittedOrigin().IsSameOriginWith(target_document_origin_)) {
PostErrorResult(...)
return;
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
Nit: I would put this first and return early for readability and to make adding to it slightly less error prone:
if (!new_host.GetLastCommittedOrigin().IsSameOriginWith(target_document_origin_)) {
PostErrorResult(...)
return;
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
6 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: chrome/browser/actor/tools/script_tool_host.cc
Insertions: 14, Deletions: 15.
@@ -207,24 +207,23 @@
}
auto& new_host = page.GetMainDocument();
- if (new_host.GetLastCommittedOrigin().IsSameOriginWith(
+ if (!new_host.GetLastCommittedOrigin().IsSameOriginWith(
target_document_origin_)) {
- // The new navigation has committed. Send a request to the renderer to
- // pull the result.
- lifecycle_ = Lifecycle::kPendingResultFromNewDocment;
- new_document_ = new_host.GetWeakDocumentPtr();
- new_host.GetRemoteAssociatedInterfaces()->GetInterface(
- &new_document_render_frame_);
- new_document_render_frame_->GetCrossDocumentScriptToolResult(
- base::BindOnce(&ScriptToolHost::OnResultReceivedFromNewDocument,
- weak_ptr_factory_.GetWeakPtr()));
+ // If we end with a cross-origin navigation, assume execution
+ // failure.
+ PostErrorResult(std::move(tool_done_callback_),
+ mojom::ActionResultCode::kScriptToolCrossOriginNavigation);
return;
}
-
- // If we end with a cross-origin navigation, assume execution
- // failure.
- PostErrorResult(std::move(tool_done_callback_),
- mojom::ActionResultCode::kScriptToolCrossOriginNavigation);
+ // The new navigation has committed. Send a request to the renderer to
+ // pull the result.
+ lifecycle_ = Lifecycle::kPendingResultFromNewDocment;
+ new_document_ = new_host.GetWeakDocumentPtr();
+ new_host.GetRemoteAssociatedInterfaces()->GetInterface(
+ &new_document_render_frame_);
+ new_document_render_frame_->GetCrossDocumentScriptToolResult(
+ base::BindOnce(&ScriptToolHost::OnResultReceivedFromNewDocument,
+ weak_ptr_factory_.GetWeakPtr()));
// TODO(khushalsagar): We need to address the case where this navigation never
// commits in which case PrimaryPageChanged won't be dispatched. See
```
webmcp/script tools: Support cross-document tools
The browser-side ScriptToolHost now waits for the new navigation to be
committed if the renderer's execution of a tool indicates that. This is
used when a form's default submit action triggers a navigation.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |