blob: b6f7ca636d4cf4ea8d5cf678a5939e5aaa1deeb6 [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2013 The Chromium Authors
danakjc492bf82020-09-09 20:02:442// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_NODE_H_
6#define CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_NODE_H_
7
8#include <stddef.h>
9
10#include <memory>
11#include <string>
David Sanders2c1194d92022-04-19 23:32:3212#include <utility>
danakjc492bf82020-09-09 20:02:4413
14#include "base/gtest_prod_util.h"
Keishi Hattori0e45c022021-11-27 09:25:5215#include "base/memory/raw_ptr.h"
David Sanders2c1194d92022-04-19 23:32:3216#include "base/memory/scoped_refptr.h"
David Sandersd4bf5eb2022-03-17 07:12:0517#include "base/observer_list.h"
Daniel Cheng390e2a72022-09-28 06:07:5318#include "content/browser/renderer_host/navigation_discard_reason.h"
danakjc492bf82020-09-09 20:02:4419#include "content/browser/renderer_host/navigator.h"
20#include "content/browser/renderer_host/render_frame_host_impl.h"
21#include "content/browser/renderer_host/render_frame_host_manager.h"
Miyoung Shin7cf88b42022-11-07 13:22:3022#include "content/browser/renderer_host/render_frame_host_owner.h"
danakjc492bf82020-09-09 20:02:4423#include "content/common/content_export.h"
Julie Jeongeun Kimf38c1eca2021-12-14 07:46:5524#include "content/public/browser/frame_type.h"
danakjc492bf82020-09-09 20:02:4425#include "services/network/public/mojom/content_security_policy.mojom-forward.h"
Lei Zhang698df03c2021-05-21 04:23:3426#include "third_party/abseil-cpp/absl/types/optional.h"
Kevin McNee43fe8292021-10-04 22:59:4127#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
danakjc492bf82020-09-09 20:02:4428#include "third_party/blink/public/common/frame/frame_policy.h"
29#include "third_party/blink/public/common/frame/user_activation_state.h"
danakjc492bf82020-09-09 20:02:4430#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom.h"
Gyuyoung Kimc16e52e92021-03-19 02:45:3731#include "third_party/blink/public/mojom/frame/frame_replication_state.mojom-forward.h"
Daniel Cheng6ac128172021-05-25 18:49:0132#include "third_party/blink/public/mojom/frame/tree_scope_type.mojom.h"
David Sanders2c1194d92022-04-19 23:32:3233#include "third_party/blink/public/mojom/frame/user_activation_update_types.mojom-forward.h"
danakjc492bf82020-09-09 20:02:4434
Gabriel Charetted87f10f2022-03-31 00:44:2235#include "base/time/time.h"
danakjc492bf82020-09-09 20:02:4436#include "url/gurl.h"
37#include "url/origin.h"
38
39namespace content {
40
41class NavigationRequest;
42class RenderFrameHostImpl;
43class NavigationEntryImpl;
Paul Semel3e241042022-10-11 12:57:3144class FrameTree;
danakjc492bf82020-09-09 20:02:4445
46// When a page contains iframes, its renderer process maintains a tree structure
47// of those frames. We are mirroring this tree in the browser process. This
48// class represents a node in this tree and is a wrapper for all objects that
49// are frame-specific (as opposed to page-specific).
50//
51// Each FrameTreeNode has a current RenderFrameHost, which can change over
52// time as the frame is navigated. Any immediate subframes of the current
53// document are tracked using FrameTreeNodes owned by the current
54// RenderFrameHost, rather than as children of FrameTreeNode itself. This
55// allows subframe FrameTreeNodes to stay alive while a RenderFrameHost is
56// still alive - for example while pending deletion, after a new current
57// RenderFrameHost has replaced it.
Miyoung Shin7cf88b42022-11-07 13:22:3058class CONTENT_EXPORT FrameTreeNode : public RenderFrameHostOwner {
danakjc492bf82020-09-09 20:02:4459 public:
60 class Observer {
61 public:
62 // Invoked when a FrameTreeNode is being destroyed.
63 virtual void OnFrameTreeNodeDestroyed(FrameTreeNode* node) {}
64
65 // Invoked when a FrameTreeNode becomes focused.
66 virtual void OnFrameTreeNodeFocused(FrameTreeNode* node) {}
67
Arthur Hemerye4659282022-03-28 08:36:1568 // Invoked when a FrameTreeNode moves to a different BrowsingInstance and
69 // the popups it opened should be disowned.
70 virtual void OnFrameTreeNodeDisownedOpenee(FrameTreeNode* node) {}
71
Fergal Dalya1d569972021-03-16 03:24:5372 virtual ~Observer() = default;
danakjc492bf82020-09-09 20:02:4473 };
74
75 static const int kFrameTreeNodeInvalidId;
76
77 // Returns the FrameTreeNode with the given global |frame_tree_node_id|,
78 // regardless of which FrameTree it is in.
79 static FrameTreeNode* GloballyFindByID(int frame_tree_node_id);
80
81 // Returns the FrameTreeNode for the given |rfh|. Same as
82 // rfh->frame_tree_node(), but also supports nullptrs.
83 static FrameTreeNode* From(RenderFrameHost* rfh);
84
85 // Callers are are expected to initialize sandbox flags separately after
86 // calling the constructor.
87 FrameTreeNode(
88 FrameTree* frame_tree,
89 RenderFrameHostImpl* parent,
Daniel Cheng6ac128172021-05-25 18:49:0190 blink::mojom::TreeScopeType tree_scope_type,
danakjc492bf82020-09-09 20:02:4491 bool is_created_by_script,
92 const base::UnguessableToken& devtools_frame_token,
93 const blink::mojom::FrameOwnerProperties& frame_owner_properties,
Kevin McNee43fe8292021-10-04 22:59:4194 blink::FrameOwnerElementType owner_type,
Dominic Farolino08662c82021-06-11 07:36:3495 const blink::FramePolicy& frame_owner);
danakjc492bf82020-09-09 20:02:4496
Peter Boström828b9022021-09-21 02:28:4397 FrameTreeNode(const FrameTreeNode&) = delete;
98 FrameTreeNode& operator=(const FrameTreeNode&) = delete;
99
Miyoung Shin7cf88b42022-11-07 13:22:30100 ~FrameTreeNode() override;
danakjc492bf82020-09-09 20:02:44101
102 void AddObserver(Observer* observer);
103 void RemoveObserver(Observer* observer);
104
Ian Vollick25a9d032022-04-12 23:20:17105 // Frame trees may be nested so it can be the case that IsMainFrame() is true,
106 // but is not the outermost main frame. In particular, !IsMainFrame() cannot
107 // be used to check if the frame is an embedded frame -- use
108 // !IsOutermostMainFrame() instead. NB: this does not escape guest views;
109 // IsOutermostMainFrame will be true for the outermost main frame in an inner
110 // guest view.
danakjc492bf82020-09-09 20:02:44111 bool IsMainFrame() const;
Ian Vollick25a9d032022-04-12 23:20:17112 bool IsOutermostMainFrame();
danakjc492bf82020-09-09 20:02:44113
arthursonzogni76098e52020-11-25 14:18:45114 // Clears any state in this node which was set by the document itself (CSP &
115 // UserActivationState) and notifies proxies as appropriate. Invoked after
116 // committing navigation to a new document (since the new document comes with
117 // a fresh set of CSP).
118 // TODO(arthursonzogni): Remove this function. The frame/document must not be
119 // left temporarily with lax state.
Hiroki Nakagawaab309622021-05-19 16:38:13120 void ResetForNavigation();
danakjc492bf82020-09-09 20:02:44121
122 FrameTree* frame_tree() const { return frame_tree_; }
Paul Semel3e241042022-10-11 12:57:31123 Navigator& navigator();
danakjc492bf82020-09-09 20:02:44124
125 RenderFrameHostManager* render_manager() { return &render_manager_; }
Alexander Timin33e2e2c12022-03-03 04:21:33126 const RenderFrameHostManager* render_manager() const {
127 return &render_manager_;
128 }
danakjc492bf82020-09-09 20:02:44129 int frame_tree_node_id() const { return frame_tree_node_id_; }
Yuzu Saijo03dbf9b2022-07-22 04:29:45130 // This reflects window.name, which is initially set to the the "name"
131 // attribute. But this won't reflect changes of 'name' attribute and instead
132 // reflect changes to the Window object's name property.
133 // This is different from IframeAttributes' name in that this will not get
134 // updated when 'name' attribute gets updated.
Harkiran Bolaria4eacb3a2021-12-13 20:03:47135 const std::string& frame_name() const {
136 return render_manager_.current_replication_state().name;
137 }
danakjc492bf82020-09-09 20:02:44138
139 const std::string& unique_name() const {
Harkiran Bolaria4eacb3a2021-12-13 20:03:47140 return render_manager_.current_replication_state().unique_name;
danakjc492bf82020-09-09 20:02:44141 }
142
143 // See comment on the member declaration.
144 const base::UnguessableToken& devtools_frame_token() const {
145 return devtools_frame_token_;
146 }
147
Andrey Kosyakov6e82c3b2022-09-26 22:43:46148 // This may only change when an RFH changes host frame tree nodes
149 // during prerender activation.
150 // TODO(caseq,dsv): see if we can get rid of it.
151 void set_devtools_frame_token(const base::UnguessableToken& token) {
152 devtools_frame_token_ = token;
153 }
danakjc492bf82020-09-09 20:02:44154 size_t child_count() const { return current_frame_host()->child_count(); }
155
danakjc492bf82020-09-09 20:02:44156 RenderFrameHostImpl* parent() const { return parent_; }
157
Dave Tapuskac8de3b02021-12-03 21:51:01158 // See `RenderFrameHost::GetParentOrOuterDocument()` for
159 // documentation.
160 RenderFrameHostImpl* GetParentOrOuterDocument();
161
162 // See `RenderFrameHostImpl::GetParentOrOuterDocumentOrEmbedder()` for
163 // documentation.
164 RenderFrameHostImpl* GetParentOrOuterDocumentOrEmbedder();
165
danakjc492bf82020-09-09 20:02:44166 FrameTreeNode* opener() const { return opener_; }
167
Rakina Zata Amni3a48ae42022-05-05 03:39:56168 FrameTreeNode* first_live_main_frame_in_original_opener_chain() const {
169 return first_live_main_frame_in_original_opener_chain_;
170 }
danakjc492bf82020-09-09 20:02:44171
Anton Bikineevf62d1bf2021-05-15 17:56:07172 const absl::optional<base::UnguessableToken>& opener_devtools_frame_token() {
Wolfgang Beyerd8809db2020-09-30 15:29:39173 return opener_devtools_frame_token_;
174 }
175
Julie Jeongeun Kimf38c1eca2021-12-14 07:46:55176 // Returns the type of the frame. Refer to frame_type.h for the details.
177 FrameType GetFrameType() const;
178
danakjc492bf82020-09-09 20:02:44179 // Assigns a new opener for this node and, if |opener| is non-null, registers
180 // an observer that will clear this node's opener if |opener| is ever
181 // destroyed.
182 void SetOpener(FrameTreeNode* opener);
183
184 // Assigns the initial opener for this node, and if |opener| is non-null,
185 // registers an observer that will clear this node's opener if |opener| is
186 // ever destroyed. The value set here is the root of the tree.
187 //
188 // It is not possible to change the opener once it was set.
189 void SetOriginalOpener(FrameTreeNode* opener);
190
Wolfgang Beyerd8809db2020-09-30 15:29:39191 // Assigns an opener frame id for this node. This string id is only set once
192 // and cannot be changed. It persists, even if the |opener| is destroyed. It
193 // is used for attribution in the DevTools frontend.
194 void SetOpenerDevtoolsFrameToken(
195 base::UnguessableToken opener_devtools_frame_token);
196
danakjc492bf82020-09-09 20:02:44197 FrameTreeNode* child_at(size_t index) const {
198 return current_frame_host()->child_at(index);
199 }
200
201 // Returns the URL of the last committed page in the current frame.
202 const GURL& current_url() const {
203 return current_frame_host()->GetLastCommittedURL();
204 }
205
Rakina Zata Amni90555282022-01-21 07:35:54206 // Sets `is_on_initial_empty_document_` to false.
207 void SetNotOnInitialEmptyDocument() { is_on_initial_empty_document_ = false; }
Rakina Zata Amni86c88fa2021-11-01 01:27:30208
Rakina Zata Amni91d485b42021-12-08 02:50:13209 // Returns false if the frame has committed a document that is not the initial
Rakina Zata Amni86c88fa2021-11-01 01:27:30210 // empty document, or if the current document's input stream has been opened
211 // with document.open(), causing the document to lose its "initial empty
212 // document" status. For more details, see the definition of
213 // `is_on_initial_empty_document_`.
214 bool is_on_initial_empty_document() const {
215 return is_on_initial_empty_document_;
Rakina Zata Amnifc4cc3d42021-06-10 09:03:56216 }
217
Rakina Zata Amni86c88fa2021-11-01 01:27:30218 // Sets `is_on_initial_empty_document_` to
Rakina Zata Amnifc4cc3d42021-06-10 09:03:56219 // false. Must only be called after the current document's input stream has
220 // been opened with document.open().
Rakina Zata Amni86c88fa2021-11-01 01:27:30221 void DidOpenDocumentInputStream() { is_on_initial_empty_document_ = false; }
Rakina Zata Amnid09b6112021-06-05 06:20:14222
danakjc492bf82020-09-09 20:02:44223 // Returns whether the frame's owner element in the parent document is
224 // collapsed, that is, removed from the layout as if it did not exist, as per
225 // request by the embedder (of the content/ layer).
226 bool is_collapsed() const { return is_collapsed_; }
227
228 // Sets whether to collapse the frame's owner element in the parent document,
229 // that is, to remove it from the layout as if it did not exist, as per
230 // request by the embedder (of the content/ layer). Cannot be called for main
231 // frames.
232 //
233 // This only has an effect for <iframe> owner elements, and is a no-op when
234 // called on sub-frames hosted in <frame>, <object>, and <embed> elements.
235 void SetCollapsed(bool collapsed);
236
237 // Returns the origin of the last committed page in this frame.
238 // WARNING: To get the last committed origin for a particular
239 // RenderFrameHost, use RenderFrameHost::GetLastCommittedOrigin() instead,
240 // which will behave correctly even when the RenderFrameHost is not the
241 // current one for this frame (such as when it's pending deletion).
242 const url::Origin& current_origin() const {
Harkiran Bolaria4eacb3a2021-12-13 20:03:47243 return render_manager_.current_replication_state().origin;
danakjc492bf82020-09-09 20:02:44244 }
245
danakjc492bf82020-09-09 20:02:44246 // Returns the latest frame policy (sandbox flags and container policy) for
247 // this frame. This includes flags inherited from parent frames and the latest
248 // flags from the <iframe> element hosting this frame. The returned policies
249 // may not yet have taken effect, since "sandbox" and "allow" attribute
250 // updates in an <iframe> element take effect on next navigation. To retrieve
251 // the currently active policy for this frame, use effective_frame_policy().
252 const blink::FramePolicy& pending_frame_policy() const {
253 return pending_frame_policy_;
254 }
255
256 // Update this frame's sandbox flags and container policy. This is called
257 // when a parent frame updates the "sandbox" attribute in the <iframe> element
258 // for this frame, or any of the attributes which affect the container policy
259 // ("allowfullscreen", "allowpaymentrequest", "allow", and "src".)
260 // These policies won't take effect until next navigation. If this frame's
261 // parent is itself sandboxed, the parent's sandbox flags are combined with
262 // those in |frame_policy|.
263 // Attempting to change the container policy on the main frame will have no
264 // effect.
265 void SetPendingFramePolicy(blink::FramePolicy frame_policy);
266
267 // Returns the currently active frame policy for this frame, including the
268 // sandbox flags which were present at the time the document was loaded, and
Charlie Hu5130d25e2021-03-05 21:53:39269 // the permissions policy container policy, which is set by the iframe's
danakjc492bf82020-09-09 20:02:44270 // allowfullscreen, allowpaymentrequest, and allow attributes, along with the
271 // origin of the iframe's src attribute (which may be different from the URL
272 // of the document currently loaded into the frame). This does not include
273 // policy changes that have been made by updating the containing iframe
274 // element attributes since the frame was last navigated; use
275 // pending_frame_policy() for those.
276 const blink::FramePolicy& effective_frame_policy() const {
Harkiran Bolaria4eacb3a2021-12-13 20:03:47277 return render_manager_.current_replication_state().frame_policy;
danakjc492bf82020-09-09 20:02:44278 }
279
danakjc492bf82020-09-09 20:02:44280 const blink::mojom::FrameOwnerProperties& frame_owner_properties() {
281 return frame_owner_properties_;
282 }
283
284 void set_frame_owner_properties(
285 const blink::mojom::FrameOwnerProperties& frame_owner_properties) {
286 frame_owner_properties_ = frame_owner_properties;
287 }
288
Yuzu Saijo03dbf9b2022-07-22 04:29:45289 // Reflects the attributes of the corresponding iframe html element, such
290 // as 'anonymous', 'id', 'name' and 'src'. These values should not be
291 // exposed to cross-origin renderers.
292 const network::mojom::ContentSecurityPolicy* csp_attribute() const {
293 return attributes_->parsed_csp_attribute.get();
danakjc492bf82020-09-09 20:02:44294 }
Yuzu Saijo03dbf9b2022-07-22 04:29:45295 bool anonymous() const { return attributes_->anonymous; }
296 const std::string& html_id() const { return attributes_->id; }
297 // This tracks iframe's 'name' attribute instead of window.name, which is
298 // tracked in FrameReplicationState. See the comment for frame_name() for
299 // more details.
300 const std::string& html_name() const { return attributes_->name; }
301 const std::string& html_src() const { return attributes_->src; }
danakjc492bf82020-09-09 20:02:44302
Yuzu Saijo03dbf9b2022-07-22 04:29:45303 void SetAttributes(blink::mojom::IframeAttributesPtr attributes);
Antonio Sartori5abc8de2021-07-13 08:42:47304
danakjc492bf82020-09-09 20:02:44305 bool HasSameOrigin(const FrameTreeNode& node) const {
Harkiran Bolaria4eacb3a2021-12-13 20:03:47306 return render_manager_.current_replication_state().origin.IsSameOriginWith(
307 node.current_replication_state().origin);
danakjc492bf82020-09-09 20:02:44308 }
309
Gyuyoung Kimc16e52e92021-03-19 02:45:37310 const blink::mojom::FrameReplicationState& current_replication_state() const {
Harkiran Bolaria4eacb3a2021-12-13 20:03:47311 return render_manager_.current_replication_state();
danakjc492bf82020-09-09 20:02:44312 }
313
314 RenderFrameHostImpl* current_frame_host() const {
315 return render_manager_.current_frame_host();
316 }
317
danakjc492bf82020-09-09 20:02:44318 // Returns true if this node is in a loading state.
319 bool IsLoading() const;
320
Alex Moshchuk9b0fd822020-10-26 23:08:15321 // Returns true if this node has a cross-document navigation in progress.
322 bool HasPendingCrossDocumentNavigation() const;
323
danakjc492bf82020-09-09 20:02:44324 NavigationRequest* navigation_request() { return navigation_request_.get(); }
325
326 // Transfers the ownership of the NavigationRequest to |render_frame_host|.
327 // From ReadyToCommit to DidCommit, the NavigationRequest is owned by the
328 // RenderFrameHost that is committing the navigation.
329 void TransferNavigationRequestOwnership(
330 RenderFrameHostImpl* render_frame_host);
331
332 // Takes ownership of |navigation_request| and makes it the current
333 // NavigationRequest of this frame. This corresponds to the start of a new
334 // navigation. If there was an ongoing navigation request before calling this
335 // function, it is canceled. |navigation_request| should not be null.
336 void CreatedNavigationRequest(
337 std::unique_ptr<NavigationRequest> navigation_request);
338
Daniel Cheng390e2a72022-09-28 06:07:53339 // Resets the current navigation request and any state created by it,
340 // including the speculative RenderFrameHost.
341 void ResetNavigationRequest(NavigationDiscardReason reason);
342
343 // Resets the current navigation request, but keeping state created by the
344 // NavigationRequest (e.g. speculative RenderFrameHost, loading state).
345 void ResetNavigationRequestButKeepState();
danakjc492bf82020-09-09 20:02:44346
347 // A RenderFrameHost in this node started loading.
Nate Chapin9aabf5f2021-11-12 00:31:19348 // |should_show_loading_ui| indicates whether this navigation should be
349 // visible in the UI. True for cross-document navigations and navigations
Nate Chapin24295252022-09-27 18:31:08350 // intercepted by the navigation API's intercept().
danakjc492bf82020-09-09 20:02:44351 // |was_previously_loading| is false if the FrameTree was not loading before.
352 // The caller is required to provide this boolean as the delegate should only
353 // be notified if the FrameTree went from non-loading to loading state.
354 // However, when it is called, the FrameTree should be in a loading state.
Nate Chapin9aabf5f2021-11-12 00:31:19355 void DidStartLoading(bool should_show_loading_ui,
356 bool was_previously_loading);
danakjc492bf82020-09-09 20:02:44357
358 // A RenderFrameHost in this node stopped loading.
359 void DidStopLoading();
360
361 // The load progress for a RenderFrameHost in this node was updated to
362 // |load_progress|. This will notify the FrameTree which will in turn notify
363 // the WebContents.
364 void DidChangeLoadProgress(double load_progress);
365
366 // Called when the user directed the page to stop loading. Stops all loads
367 // happening in the FrameTreeNode. This method should be used with
368 // FrameTree::ForEach to stop all loads in the entire FrameTree.
369 bool StopLoading();
370
371 // Returns the time this frame was last focused.
372 base::TimeTicks last_focus_time() const { return last_focus_time_; }
373
374 // Called when this node becomes focused. Updates the node's last focused
375 // time and notifies observers.
376 void DidFocus();
377
378 // Called when the user closed the modal dialogue for BeforeUnload and
379 // cancelled the navigation. This should stop any load happening in the
380 // FrameTreeNode.
381 void BeforeUnloadCanceled();
382
danakjc492bf82020-09-09 20:02:44383 // Updates the user activation state in the browser frame tree and in the
384 // frame trees in all renderer processes except the renderer for this node
385 // (which initiated the update). Returns |false| if the update tries to
386 // consume an already consumed/expired transient state, |true| otherwise. See
387 // the comment on user_activation_state_ below.
388 //
389 // The |notification_type| parameter is used for histograms, only for the case
390 // |update_state == kNotifyActivation|.
391 bool UpdateUserActivationState(
392 blink::mojom::UserActivationUpdateType update_type,
393 blink::mojom::UserActivationNotificationType notification_type);
394
danakjc492bf82020-09-09 20:02:44395 // Returns the sandbox flags currently in effect for this frame. This includes
396 // flags inherited from parent frames, the currently active flags from the
397 // <iframe> element hosting this frame, as well as any flags set from a
398 // Content-Security-Policy HTTP header. This does not include flags that have
399 // have been updated in an <iframe> element but have not taken effect yet; use
400 // pending_frame_policy() for those. To see the flags which will take effect
401 // on navigation (which does not include the CSP-set flags), use
402 // effective_frame_policy().
403 network::mojom::WebSandboxFlags active_sandbox_flags() const {
Harkiran Bolaria4eacb3a2021-12-13 20:03:47404 return render_manager_.current_replication_state().active_sandbox_flags;
danakjc492bf82020-09-09 20:02:44405 }
406
danakjc492bf82020-09-09 20:02:44407 // Returns whether the frame received a user gesture on a previous navigation
408 // on the same eTLD+1.
409 bool has_received_user_gesture_before_nav() const {
Harkiran Bolaria4eacb3a2021-12-13 20:03:47410 return render_manager_.current_replication_state()
411 .has_received_user_gesture_before_nav;
danakjc492bf82020-09-09 20:02:44412 }
413
414 // When a tab is discarded, WebContents sets was_discarded on its
415 // root FrameTreeNode.
416 // In addition, when a child frame is created, this bit is passed on from
417 // parent to child.
418 // When a navigation request is created, was_discarded is passed on to the
419 // request and reset to false in FrameTreeNode.
420 void set_was_discarded() { was_discarded_ = true; }
421 bool was_discarded() const { return was_discarded_; }
422
423 // Returns the sticky bit of the User Activation v2 state of the
424 // |FrameTreeNode|.
425 bool HasStickyUserActivation() const {
426 return user_activation_state_.HasBeenActive();
427 }
428
429 // Returns the transient bit of the User Activation v2 state of the
430 // |FrameTreeNode|.
431 bool HasTransientUserActivation() {
432 return user_activation_state_.IsActive();
433 }
434
435 // Remove history entries for all frames created by script in this frame's
436 // subtree. If a frame created by a script is removed, then its history entry
437 // will never be reused - this saves memory.
438 void PruneChildFrameNavigationEntries(NavigationEntryImpl* entry);
439
Abhijeet Kandalkarb43affa72022-09-27 16:48:01440 using FencedFrameStatus = RenderFrameHostImpl::FencedFrameStatus;
Abhijeet Kandalkar3f29bc42022-09-23 12:39:58441 FencedFrameStatus fenced_frame_status() const { return fenced_frame_status_; }
442
Kevin McNee43fe8292021-10-04 22:59:41443 blink::FrameOwnerElementType frame_owner_element_type() const {
Daniel Cheng9bd90f92021-04-23 20:49:45444 return frame_owner_element_type_;
danakjc492bf82020-09-09 20:02:44445 }
danakjc492bf82020-09-09 20:02:44446
Daniel Cheng6ac128172021-05-25 18:49:01447 blink::mojom::TreeScopeType tree_scope_type() const {
448 return tree_scope_type_;
449 }
450
arthursonzogni034bb9c2020-10-01 08:29:56451 // The initial popup URL for new window opened using:
452 // `window.open(initial_popup_url)`.
453 // An empty GURL otherwise.
454 //
455 // [WARNING] There is no guarantee the FrameTreeNode will ever host a
456 // document served from this URL. The FrameTreeNode always starts hosting the
457 // initial empty document and attempts a navigation toward this URL. However
458 // the navigation might be delayed, redirected and even cancelled.
459 void SetInitialPopupURL(const GURL& initial_popup_url);
460 const GURL& initial_popup_url() const { return initial_popup_url_; }
461
462 // The origin of the document that used window.open() to create this frame.
463 // Otherwise, an opaque Origin with a nonce different from all previously
464 // existing Origins.
465 void SetPopupCreatorOrigin(const url::Origin& popup_creator_origin);
466 const url::Origin& popup_creator_origin() const {
467 return popup_creator_origin_;
468 }
469
Harkiran Bolaria59290d62021-03-17 01:53:01470 // Sets the associated FrameTree for this node. The node can change FrameTrees
471 // when blink::features::Prerender2 is enabled, which allows a page loaded in
472 // the prerendered FrameTree to be used for a navigation in the primary frame
473 // tree.
474 void SetFrameTree(FrameTree& frame_tree);
475
Alexander Timin074cd182022-03-23 18:11:22476 using TraceProto = perfetto::protos::pbzero::FrameTreeNodeInfo;
Alexander Timinf785f342021-03-18 00:00:56477 // Write a representation of this object into a trace.
Alexander Timin074cd182022-03-23 18:11:22478 void WriteIntoTrace(perfetto::TracedProto<TraceProto> proto) const;
Alexander Timinf785f342021-03-18 00:00:56479
Carlos Caballero76711352021-03-24 17:38:21480 // Returns true the node is navigating, i.e. it has an associated
481 // NavigationRequest.
482 bool HasNavigation();
483
shivanigithubf3ddff52021-07-03 22:06:30484 // Fenced frames (meta-bug crbug.com/1111084):
shivanigithub4cd016a2021-09-20 21:10:30485 // Note that these two functions cannot be invoked from a FrameTree's or
486 // its root node's constructor since they require the frame tree and the
487 // root node to be completely constructed.
488 //
shivanigithubf3ddff52021-07-03 22:06:30489 // Returns false if fenced frames are disabled. Returns true if the feature is
490 // enabled and if |this| is a fenced frame. Returns false for
491 // iframes embedded in a fenced frame. To clarify: for the MPArch
492 // implementation this only returns true if |this| is the actual
493 // root node of the inner FrameTree and not the proxy FrameTreeNode in the
494 // outer FrameTree.
Dominic Farolino4bc10ee2021-08-31 00:37:36495 bool IsFencedFrameRoot() const;
shivanigithubf3ddff52021-07-03 22:06:30496
497 // Returns false if fenced frames are disabled. Returns true if the
498 // feature is enabled and if |this| or any of its ancestor nodes is a
499 // fenced frame.
500 bool IsInFencedFrameTree() const;
501
shivanigithub4cd016a2021-09-20 21:10:30502 // Returns a valid nonce if `IsInFencedFrameTree()` returns true for `this`.
Garrett Tanzer34cb92fe2022-09-28 17:50:54503 // Returns nullopt otherwise.
504 //
505 // Nonce used in the net::IsolationInfo and blink::StorageKey for a fenced
506 // frame and any iframes nested within it. Not set if this frame is not in a
507 // fenced frame's FrameTree. Note that this could be a field in FrameTree for
508 // the MPArch version but for the shadow DOM version we need to keep it here
509 // since the fenced frame root is not a main frame for the latter. The value
510 // of the nonce will be the same for all of the the iframes inside a fenced
511 // frame tree. If there is a nested fenced frame it will have a different
512 // nonce than its parent fenced frame. The nonce will stay the same across
513 // navigations initiated from the fenced frame tree because it is always used
514 // in conjunction with other fields of the keys and would be good to access
515 // the same storage across same-origin navigations. If the navigation is
516 // same-origin/site then the same network stack partition/storage will be
517 // reused and if it's cross-origin/site then other parts of the key will
518 // change and so, even with the same nonce, another partition will be used.
519 // But if the navigation is initiated from the embedder, the nonce will be
520 // reinitialized irrespective of same or cross origin such that there is no
521 // privacy leak via storage shared between two embedder initiated navigations.
522 // Note that this reinitialization is implemented for all embedder-initiated
523 // navigations in MPArch, but only urn:uuid navigations in ShadowDOM.
524 absl::optional<base::UnguessableToken> GetFencedFrameNonce();
shivanigithub4cd016a2021-09-20 21:10:30525
Garrett Tanzer34cb92fe2022-09-28 17:50:54526 // If applicable, initialize the default fenced frame properties. Right now,
527 // this means setting a new fenced frame nonce. See comment on
shivanigithub4cd016a2021-09-20 21:10:30528 // fenced_frame_nonce() for when it is set to a non-null value. Invoked
529 // by FrameTree::Init() or FrameTree::AddFrame().
Garrett Tanzer34cb92fe2022-09-28 17:50:54530 void SetFencedFramePropertiesIfNeeded();
shivanigithub4cd016a2021-09-20 21:10:30531
Garrett Tanzera42fdef2022-06-13 16:09:14532 // Returns the mode attribute set on the fenced frame root if this frame is
533 // in a fenced frame tree, otherwise returns `absl::nullopt`.
Nan Line376738a2022-03-25 22:05:41534 absl::optional<blink::mojom::FencedFrameMode> GetFencedFrameMode();
Nan Lin171fe9a2022-02-17 16:42:16535
Dave Tapuskac8de3b02021-12-03 21:51:01536 // Helper for GetParentOrOuterDocument/GetParentOrOuterDocumentOrEmbedder.
537 // Do not use directly.
538 RenderFrameHostImpl* GetParentOrOuterDocumentHelper(bool escape_guest_view);
539
Harkiran Bolariab4437fd2021-08-11 17:51:22540 // Sets the unique_name and name fields on replication_state_. To be used in
541 // prerender activation to make sure the FrameTreeNode replication state is
542 // correct after the RenderFrameHost is moved between FrameTreeNodes. The
543 // renderers should already have the correct value, so unlike
544 // FrameTreeNode::SetFrameName, we do not notify them here.
Harkiran Bolaria4eacb3a2021-12-13 20:03:47545 // TODO(https://crbug.com/1237091): Remove this once the BrowsingContextState
546 // is implemented to utilize the new path.
Harkiran Bolariab4437fd2021-08-11 17:51:22547 void set_frame_name_for_activation(const std::string& unique_name,
548 const std::string& name) {
Harkiran Bolaria0b3bdef02022-03-10 13:04:40549 current_frame_host()->browsing_context_state()->set_frame_name(unique_name,
550 name);
Harkiran Bolariab4437fd2021-08-11 17:51:22551 }
552
Nan Linaaf84f72021-12-02 22:31:56553 // Returns true if error page isolation is enabled.
554 bool IsErrorPageIsolationEnabled() const;
555
W. James MacLean81b8d01f2022-01-25 20:50:59556 // Functions to store and retrieve a frame's srcdoc value on this
557 // FrameTreeNode.
558 void SetSrcdocValue(const std::string& srcdoc_value);
559 const std::string& srcdoc_value() const { return srcdoc_value_; }
560
Garrett Tanzerc69f4642022-08-15 22:15:14561 void set_fenced_frame_properties(
562 absl::optional<FencedFrameURLMapping::FencedFrameProperties>&
563 fenced_frame_properties) {
Garrett Tanzer2975eeac2022-08-22 16:34:01564 // TODO(crbug.com/1262022): Reenable this DCHECK once ShadowDOM and
565 // loading urns in iframes (for FLEDGE OT) are gone.
566 // DCHECK_EQ(fenced_frame_status_,
567 // RenderFrameHostImpl::FencedFrameStatus::kFencedFrameRoot);
Garrett Tanzerc69f4642022-08-15 22:15:14568 fenced_frame_properties_ = fenced_frame_properties;
569 }
570
Garrett Tanzer34cb92fe2022-09-28 17:50:54571 // Return the fenced frame properties for this fenced frame tree (if any).
572 // That is to say, this function returns the `fenced_frame_properties_`
573 // variable attached to the fenced frame root FrameTreeNode, which may be
574 // either this node or an ancestor of it.
Garrett Tanzerc69f4642022-08-15 22:15:14575 const absl::optional<FencedFrameURLMapping::FencedFrameProperties>&
Garrett Tanzer34cb92fe2022-09-28 17:50:54576 GetFencedFrameProperties();
Garrett Tanzerc69f4642022-08-15 22:15:14577
Yao Xiaoa2337ad2022-10-12 20:59:29578 // Return the number of fenced frame boundaries above this frame. The
579 // outermost main frame's frame tree has fenced frame depth 0, a topmost
580 // fenced frame tree embedded in the outermost main frame has fenced frame
581 // depth 1, etc.
582 size_t GetFencedFrameDepth();
583
584 // Traverse up from this node. Return all valid
585 // `node->fenced_frame_properties_->shared_storage_budget_metadata` (i.e. this
586 // node is subjected to the shared storage budgeting associated with those
587 // metadata). Every node that originates from sharedStorage.selectURL() will
588 // have an associated metadata. This indicates that the metadata can only
589 // possibly be associated with a fenced frame root, unless when
590 // `kAllowURNsInIframes` is enabled in which case they could be be associated
591 // with any node.
592 std::vector<const FencedFrameURLMapping::SharedStorageBudgetMetadata*>
Yao Xiao1ac702d2022-06-08 17:20:49593 FindSharedStorageBudgetMetadata();
594
Harkiran Bolariaebbe7702022-02-22 19:19:03595 // Accessor to BrowsingContextState for subframes only. Only main frame
596 // navigations can change BrowsingInstances and BrowsingContextStates,
597 // therefore for subframes associated BrowsingContextState never changes. This
598 // helper method makes this more explicit and guards against calling this on
599 // main frames (there an appropriate BrowsingContextState should be obtained
600 // from RenderFrameHost or from RenderFrameProxyHost as e.g. during
601 // cross-BrowsingInstance navigations multiple BrowsingContextStates exist in
602 // the same frame).
603 const scoped_refptr<BrowsingContextState>&
604 GetBrowsingContextStateForSubframe() const;
605
Arthur Hemerye4659282022-03-28 08:36:15606 // Clears the opener property of popups referencing this FrameTreeNode as
607 // their opener.
608 void ClearOpenerReferences();
609
Liam Bradyd2a41e152022-07-19 13:58:48610 // Calculates whether one of the ancestor frames or this frame has a CSPEE
611 // in place. This is eventually sent over to LocalFrame in the renderer where
612 // it will be used by HTMLFencedFrameElement::canLoadOpaqueURL for information
613 // it can't get on its own.
614 bool AncestorOrSelfHasCSPEE() const;
615
Miyoung Shin7cf88b42022-11-07 13:22:30616 // RenderFrameHostOwner implementation:
617 void RestartNavigationAsCrossDocument(
618 std::unique_ptr<NavigationRequest> navigation_request) override;
Julie Jeongeun Kimc1b07c32022-11-11 10:26:32619 Navigator& GetCurrentNavigator() override;
Miyoung Shin7cf88b42022-11-07 13:22:30620
danakjc492bf82020-09-09 20:02:44621 private:
Yuzu Saijo03dbf9b2022-07-22 04:29:45622 friend class CSPEmbeddedEnforcementUnitTest;
Charlie Hubb5943d2021-03-09 19:46:12623 FRIEND_TEST_ALL_PREFIXES(SitePerProcessPermissionsPolicyBrowserTest,
danakjc492bf82020-09-09 20:02:44624 ContainerPolicyDynamic);
Charlie Hubb5943d2021-03-09 19:46:12625 FRIEND_TEST_ALL_PREFIXES(SitePerProcessPermissionsPolicyBrowserTest,
danakjc492bf82020-09-09 20:02:44626 ContainerPolicySandboxDynamic);
Yuzu Saijo03dbf9b2022-07-22 04:29:45627 FRIEND_TEST_ALL_PREFIXES(NavigationRequestTest, StorageKeyToCommit);
628 FRIEND_TEST_ALL_PREFIXES(NavigationRequestTest,
629 NavigationToAnonymousDocumentNetworkIsolationInfo);
630 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplTest,
631 ChildOfAnonymousIsAnonymous);
Yifan Luo86a79f42022-08-16 18:38:27632 FRIEND_TEST_ALL_PREFIXES(ContentPasswordManagerDriverTest,
633 PasswordAutofillDisabledOnAnonymousIframe);
danakjc492bf82020-09-09 20:02:44634
Dominic Farolino8a2187b2021-12-24 20:44:21635 // Called by the destructor. When `this` is an outer dummy FrameTreeNode
636 // representing an inner FrameTree, this method destroys said inner FrameTree.
637 void DestroyInnerFrameTreeIfExists();
638
danakjc492bf82020-09-09 20:02:44639 class OpenerDestroyedObserver;
640
danakjc492bf82020-09-09 20:02:44641 // The |notification_type| parameter is used for histograms only.
642 bool NotifyUserActivation(
643 blink::mojom::UserActivationNotificationType notification_type);
644
645 bool ConsumeTransientUserActivation();
646
647 bool ClearUserActivation();
648
649 // Verify that the renderer process is allowed to set user activation on this
650 // frame by checking whether this frame's RenderWidgetHost had previously seen
651 // an input event that might lead to user activation. If user activation
652 // should be allowed, this returns true and also clears corresponding pending
653 // user activation state in the widget. Otherwise, this returns false.
654 bool VerifyUserActivation();
655
656 // The next available browser-global FrameTreeNode ID.
657 static int next_frame_tree_node_id_;
658
659 // The FrameTree that owns us.
Keishi Hattori0e45c022021-11-27 09:25:52660 raw_ptr<FrameTree> frame_tree_; // not owned.
danakjc492bf82020-09-09 20:02:44661
danakjc492bf82020-09-09 20:02:44662 // A browser-global identifier for the frame in the page, which stays stable
663 // even if the frame does a cross-process navigation.
664 const int frame_tree_node_id_;
665
666 // The RenderFrameHost owning this FrameTreeNode, which cannot change for the
667 // life of this FrameTreeNode. |nullptr| if this node is the root.
Keishi Hattori0e45c022021-11-27 09:25:52668 const raw_ptr<RenderFrameHostImpl> parent_;
danakjc492bf82020-09-09 20:02:44669
danakjc492bf82020-09-09 20:02:44670 // The frame that opened this frame, if any. Will be set to null if the
671 // opener is closed, or if this frame disowns its opener by setting its
672 // window.opener to null.
Keishi Hattori0e45c022021-11-27 09:25:52673 raw_ptr<FrameTreeNode> opener_ = nullptr;
danakjc492bf82020-09-09 20:02:44674
675 // An observer that clears this node's |opener_| if the opener is destroyed.
676 // This observer is added to the |opener_|'s observer list when the |opener_|
677 // is set to a non-null node, and it is removed from that list when |opener_|
678 // changes or when this node is destroyed. It is also cleared if |opener_|
679 // is disowned.
680 std::unique_ptr<OpenerDestroyedObserver> opener_observer_;
681
Rakina Zata Amni3a48ae42022-05-05 03:39:56682 // Unlike `opener_`, the "original opener chain" doesn't reflect
683 // window.opener, which can be suppressed or updated. The "original opener"
684 // is the main frame of the actual opener of this frame. This traces the all
685 // the way back, so if the original opener was closed (deleted or severed due
686 // to COOP), but _it_ had an original opener, this will return the original
687 // opener's original opener, etc. So this value will always be set as long as
688 // there is at least one live frame in the chain whose connection is not
689 // severed due to COOP.
690 raw_ptr<FrameTreeNode> first_live_main_frame_in_original_opener_chain_ =
691 nullptr;
danakjc492bf82020-09-09 20:02:44692
Wolfgang Beyerd8809db2020-09-30 15:29:39693 // The devtools frame token of the frame which opened this frame. This is
694 // not cleared even if the opener is destroyed or disowns the frame.
Anton Bikineevf62d1bf2021-05-15 17:56:07695 absl::optional<base::UnguessableToken> opener_devtools_frame_token_;
Wolfgang Beyerd8809db2020-09-30 15:29:39696
Rakina Zata Amni3a48ae42022-05-05 03:39:56697 // An observer that updates this node's
698 // |first_live_main_frame_in_original_opener_chain_| to the next original
699 // opener in the chain if the original opener is destroyed.
danakjc492bf82020-09-09 20:02:44700 std::unique_ptr<OpenerDestroyedObserver> original_opener_observer_;
701
arthursonzogni034bb9c2020-10-01 08:29:56702 // When created by an opener, the URL specified in window.open(url)
703 // Please refer to {Get,Set}InitialPopupURL() documentation.
704 GURL initial_popup_url_;
705
706 // When created using window.open, the origin of the creator.
707 // Please refer to {Get,Set}PopupCreatorOrigin() documentation.
708 url::Origin popup_creator_origin_;
709
W. James MacLean81b8d01f2022-01-25 20:50:59710 // If the url from the the last BeginNavigation is about:srcdoc, this value
711 // stores the srcdoc_attribute's value for re-use in history navigations.
712 std::string srcdoc_value_;
713
Rakina Zata Amni86c88fa2021-11-01 01:27:30714 // Whether this frame is still on the initial about:blank document or the
715 // synchronously committed about:blank document committed at frame creation,
716 // and its "initial empty document"-ness is still true.
717 // This will be false if either of these has happened:
Arthur Sonzogni47c79cc2022-08-30 15:25:27718 // - The current RenderFrameHost commits a cross-document navigation that is
719 // not the synchronously committed about:blank document per:
Rakina Zata Amni86c88fa2021-11-01 01:27:30720 // https://html.spec.whatwg.org/multipage/browsers.html#creating-browsing-contexts:is-initial-about:blank
721 // - The document's input stream has been opened with document.open(), per
722 // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#opening-the-input-stream:is-initial-about:blank
723 // NOTE: we treat both the "initial about:blank document" and the
724 // "synchronously committed about:blank document" as the initial empty
725 // document. In the future, we plan to remove the synchronous about:blank
726 // commit so that this state will only be true if the frame is on the
727 // "initial about:blank document". See also:
728 // - https://github.com/whatwg/html/issues/6863
729 // - https://crbug.com/1215096
730 bool is_on_initial_empty_document_ = true;
Rakina Zata Amnifc4cc3d42021-06-10 09:03:56731
danakjc492bf82020-09-09 20:02:44732 // Whether the frame's owner element in the parent document is collapsed.
arthursonzogni9816b9192021-03-29 16:09:19733 bool is_collapsed_ = false;
danakjc492bf82020-09-09 20:02:44734
Daniel Cheng6ac128172021-05-25 18:49:01735 // The type of frame owner for this frame. This is only relevant for non-main
736 // frames.
Kevin McNee43fe8292021-10-04 22:59:41737 const blink::FrameOwnerElementType frame_owner_element_type_ =
738 blink::FrameOwnerElementType::kNone;
Daniel Cheng9bd90f92021-04-23 20:49:45739
Daniel Cheng6ac128172021-05-25 18:49:01740 // The tree scope type of frame owner element, i.e. whether the element is in
741 // the document tree (https://dom.spec.whatwg.org/#document-trees) or the
742 // shadow tree (https://dom.spec.whatwg.org/#shadow-trees). This is only
743 // relevant for non-main frames.
744 const blink::mojom::TreeScopeType tree_scope_type_ =
745 blink::mojom::TreeScopeType::kDocument;
746
danakjc492bf82020-09-09 20:02:44747 // Track the pending sandbox flags and container policy for this frame. When a
748 // parent frame dynamically updates 'sandbox', 'allow', 'allowfullscreen',
749 // 'allowpaymentrequest' or 'src' attributes, the updated policy for the frame
Harkiran Bolaria4eacb3a2021-12-13 20:03:47750 // is stored here, and transferred into
751 // render_manager_.current_replication_state().frame_policy when they take
752 // effect on the next frame navigation.
danakjc492bf82020-09-09 20:02:44753 blink::FramePolicy pending_frame_policy_;
754
755 // Whether the frame was created by javascript. This is useful to prune
756 // history entries when the frame is removed (because frames created by
757 // scripts are never recreated with the same unique name - see
758 // https://crbug.com/500260).
arthursonzogni9816b9192021-03-29 16:09:19759 const bool is_created_by_script_;
danakjc492bf82020-09-09 20:02:44760
761 // Used for devtools instrumentation and trace-ability. The token is
762 // propagated to Blink's LocalFrame and both Blink and content/
763 // can tag calls and requests with this token in order to attribute them
764 // to the context frame.
765 // |devtools_frame_token_| is only defined by the browser process and is never
766 // sent back from the renderer in the control calls. It should be never used
767 // to look up the FrameTreeNode instance.
Andrey Kosyakov6e82c3b2022-09-26 22:43:46768 base::UnguessableToken devtools_frame_token_;
danakjc492bf82020-09-09 20:02:44769
770 // Tracks the scrolling and margin properties for this frame. These
771 // properties affect the child renderer but are stored on its parent's
772 // frame element. When this frame's parent dynamically updates these
773 // properties, we update them here too.
774 //
775 // Note that dynamic updates only take effect on the next frame navigation.
776 blink::mojom::FrameOwnerProperties frame_owner_properties_;
777
Yuzu Saijo03dbf9b2022-07-22 04:29:45778 // Contains the tracked HTML attributes of the corresponding iframe element,
779 // such as 'id' and 'src'.
780 blink::mojom::IframeAttributesPtr attributes_;
Antonio Sartori5abc8de2021-07-13 08:42:47781
danakjc492bf82020-09-09 20:02:44782 // Owns an ongoing NavigationRequest until it is ready to commit. It will then
783 // be reset and a RenderFrameHost will be responsible for the navigation.
784 std::unique_ptr<NavigationRequest> navigation_request_;
785
786 // List of objects observing this FrameTreeNode.
787 base::ObserverList<Observer>::Unchecked observers_;
788
789 base::TimeTicks last_focus_time_;
790
arthursonzogni9816b9192021-03-29 16:09:19791 bool was_discarded_ = false;
danakjc492bf82020-09-09 20:02:44792
793 // The user activation state of the current frame. See |UserActivationState|
794 // for details on how this state is maintained.
795 blink::UserActivationState user_activation_state_;
796
Abhijeet Kandalkar3f29bc42022-09-23 12:39:58797 const FencedFrameStatus fenced_frame_status_ =
798 FencedFrameStatus::kNotNestedInFencedFrame;
Harkiran Bolaria16f2c48d2022-04-22 12:39:57799
Garrett Tanzerc69f4642022-08-15 22:15:14800 // If this is a fenced frame resulting from a urn:uuid navigation, this
801 // contains all the metadata specifying the resulting context.
Garrett Tanzer34cb92fe2022-09-28 17:50:54802 // TODO(crbug.com/1262022): Move this into the FrameTree once ShadowDOM
803 // and urn iframes are gone.
Garrett Tanzerc69f4642022-08-15 22:15:14804 absl::optional<FencedFrameURLMapping::FencedFrameProperties>
805 fenced_frame_properties_;
806
Lukasz Anforowicz147141962020-12-16 18:03:24807 // Manages creation and swapping of RenderFrameHosts for this frame.
808 //
809 // This field needs to be declared last, because destruction of
810 // RenderFrameHostManager may call arbitrary callbacks (e.g. via
811 // WebContentsObserver::DidFinishNavigation fired after RenderFrameHostManager
812 // destructs a RenderFrameHostImpl and its NavigationRequest). Such callbacks
813 // may try to use FrameTreeNode's fields above - this would be an undefined
814 // behavior if the fields (even trivially-destructible ones) were destructed
815 // before the RenderFrameHostManager's destructor runs. See also
816 // https://crbug.com/1157988.
817 RenderFrameHostManager render_manager_;
danakjc492bf82020-09-09 20:02:44818};
819
820} // namespace content
821
822#endif // CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_NODE_H_