blob: 4b5380be502de8287bf10616c0bdcd7bd96af959 [file] [log] [blame]
[email protected]9b159a52013-10-03 17:24:551// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
danakjc492bf82020-09-09 20:02:445#include "content/browser/renderer_host/frame_tree_node.h"
[email protected]9b159a52013-10-03 17:24:556
Daniel Cheng6ca7f1c92017-08-09 21:45:417#include <math.h>
8
[email protected]9b159a52013-10-03 17:24:559#include <queue>
Takuto Ikutaadf31eb2019-01-05 00:32:4810#include <unordered_map>
dcheng36b6aec92015-12-26 06:16:3611#include <utility>
[email protected]9b159a52013-10-03 17:24:5512
Mustaq Ahmeda5dfa60b2018-12-08 00:30:1413#include "base/feature_list.h"
scottmg6ece5ae2017-02-01 18:25:1914#include "base/lazy_instance.h"
avib7348942015-12-25 20:57:1015#include "base/macros.h"
Liviu Tintad9391fb92020-09-28 23:50:0716#include "base/metrics/histogram_functions.h"
dcheng23ca947d2016-05-04 20:04:1517#include "base/metrics/histogram_macros.h"
[email protected]9b159a52013-10-03 17:24:5518#include "base/stl_util.h"
Daniel Cheng6ca7f1c92017-08-09 21:45:4119#include "base/strings/string_util.h"
Andrey Kosyakovf2d4ff72018-10-29 20:09:5920#include "content/browser/devtools/devtools_instrumentation.h"
danakjc492bf82020-09-09 20:02:4421#include "content/browser/renderer_host/navigation_controller_impl.h"
22#include "content/browser/renderer_host/navigation_request.h"
23#include "content/browser/renderer_host/navigator.h"
24#include "content/browser/renderer_host/navigator_delegate.h"
25#include "content/browser/renderer_host/render_frame_host_impl.h"
[email protected]94d0cc12013-12-18 00:07:4126#include "content/browser/renderer_host/render_view_host_impl.h"
clamyf73862c42015-07-08 12:31:3327#include "content/common/frame_messages.h"
Lucas Furukawa Gadanief8290a2019-07-29 20:27:5128#include "content/common/navigation_params.h"
29#include "content/common/navigation_params_utils.h"
dmazzonie950ea232015-03-13 21:39:4530#include "content/public/browser/browser_thread.h"
Mustaq Ahmeda5dfa60b2018-12-08 00:30:1431#include "content/public/common/content_features.h"
Arthur Sonzognif21fb512018-11-06 09:31:5832#include "content/public/common/navigation_policy.h"
arthursonzognib93a4472020-04-10 07:38:0033#include "services/network/public/cpp/web_sandbox_flags.h"
34#include "services/network/public/mojom/web_sandbox_flags.mojom-shared.h"
Antonio Gomes4b2c5132020-01-16 11:49:4835#include "third_party/blink/public/mojom/frame/user_activation_update_types.mojom.h"
Julie Jeongeun Kimd90e2dd2020-03-03 11:45:3736#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
[email protected]9b159a52013-10-03 17:24:5537
38namespace content {
39
dmazzonie950ea232015-03-13 21:39:4540namespace {
41
42// This is a global map between frame_tree_node_ids and pointers to
43// FrameTreeNodes.
Takuto Ikutaadf31eb2019-01-05 00:32:4844typedef std::unordered_map<int, FrameTreeNode*> FrameTreeNodeIdMap;
dmazzonie950ea232015-03-13 21:39:4545
scottmg5e65e3a2017-03-08 08:48:4646base::LazyInstance<FrameTreeNodeIdMap>::DestructorAtExit
47 g_frame_tree_node_id_map = LAZY_INSTANCE_INITIALIZER;
dmazzonie950ea232015-03-13 21:39:4548
fdegansa696e5112015-04-17 01:57:5949// These values indicate the loading progress status. The minimum progress
50// value matches what Blink's ProgressTracker has traditionally used for a
51// minimum progress value.
fdegansa696e5112015-04-17 01:57:5952const double kLoadingProgressMinimum = 0.1;
53const double kLoadingProgressDone = 1.0;
dmazzonie950ea232015-03-13 21:39:4554
fdegansa696e5112015-04-17 01:57:5955} // namespace
fdegans1d16355162015-03-26 11:58:3456
alexmose201c7cd2015-06-10 17:14:2157// This observer watches the opener of its owner FrameTreeNode and clears the
58// owner's opener if the opener is destroyed.
59class FrameTreeNode::OpenerDestroyedObserver : public FrameTreeNode::Observer {
60 public:
jochen6004a362017-02-04 00:11:4061 OpenerDestroyedObserver(FrameTreeNode* owner, bool observing_original_opener)
62 : owner_(owner), observing_original_opener_(observing_original_opener) {}
alexmose201c7cd2015-06-10 17:14:2163
64 // FrameTreeNode::Observer
65 void OnFrameTreeNodeDestroyed(FrameTreeNode* node) override {
jochen6004a362017-02-04 00:11:4066 if (observing_original_opener_) {
Avi Drissman36465f332017-09-11 20:49:3967 // The "original owner" is special. It's used for attribution, and clients
68 // walk down the original owner chain. Therefore, if a link in the chain
69 // is being destroyed, reconnect the observation to the parent of the link
70 // being destroyed.
jochen6004a362017-02-04 00:11:4071 CHECK_EQ(owner_->original_opener(), node);
Avi Drissman36465f332017-09-11 20:49:3972 owner_->SetOriginalOpener(node->original_opener());
73 // |this| is deleted at this point.
jochen6004a362017-02-04 00:11:4074 } else {
75 CHECK_EQ(owner_->opener(), node);
76 owner_->SetOpener(nullptr);
Avi Drissman36465f332017-09-11 20:49:3977 // |this| is deleted at this point.
jochen6004a362017-02-04 00:11:4078 }
alexmose201c7cd2015-06-10 17:14:2179 }
80
81 private:
82 FrameTreeNode* owner_;
jochen6004a362017-02-04 00:11:4083 bool observing_original_opener_;
alexmose201c7cd2015-06-10 17:14:2184
85 DISALLOW_COPY_AND_ASSIGN(OpenerDestroyedObserver);
86};
87
Kevin McNee88e61552020-10-22 20:41:1188const int FrameTreeNode::kFrameTreeNodeInvalidId = -1;
89
90static_assert(FrameTreeNode::kFrameTreeNodeInvalidId ==
91 RenderFrameHost::kNoFrameTreeNodeId,
92 "Have consistent sentinel values for an invalid FTN id.");
93
vishal.b782eb5d2015-04-29 12:22:5794int FrameTreeNode::next_frame_tree_node_id_ = 1;
[email protected]9b159a52013-10-03 17:24:5595
dmazzonie950ea232015-03-13 21:39:4596// static
vishal.b782eb5d2015-04-29 12:22:5797FrameTreeNode* FrameTreeNode::GloballyFindByID(int frame_tree_node_id) {
mostynb366eaf12015-03-26 00:51:1998 DCHECK_CURRENTLY_ON(BrowserThread::UI);
rob97250742015-12-10 17:45:1599 FrameTreeNodeIdMap* nodes = g_frame_tree_node_id_map.Pointer();
jdoerrie55ec69d2018-10-08 13:34:46100 auto it = nodes->find(frame_tree_node_id);
dmazzonie950ea232015-03-13 21:39:45101 return it == nodes->end() ? nullptr : it->second;
102}
103
Alexander Timin381e7e182020-04-28 19:04:03104// static
105FrameTreeNode* FrameTreeNode::From(RenderFrameHost* rfh) {
106 if (!rfh)
107 return nullptr;
108 return static_cast<RenderFrameHostImpl*>(rfh)->frame_tree_node();
109}
110
Julie Jeongeun Kim70a2e4e2020-02-21 05:09:54111FrameTreeNode::FrameTreeNode(
112 FrameTree* frame_tree,
Alexander Timin381e7e182020-04-28 19:04:03113 RenderFrameHostImpl* parent,
Antonio Gomes9d5c1ef2020-04-30 20:56:41114 blink::mojom::TreeScopeType scope,
Julie Jeongeun Kim70a2e4e2020-02-21 05:09:54115 const std::string& name,
116 const std::string& unique_name,
117 bool is_created_by_script,
118 const base::UnguessableToken& devtools_frame_token,
119 const blink::mojom::FrameOwnerProperties& frame_owner_properties,
Antonio Gomes58d38062020-04-30 01:50:14120 blink::mojom::FrameOwnerElementType owner_type)
[email protected]bffc8302014-01-23 20:52:16121 : frame_tree_(frame_tree),
Lucas Furukawa Gadani72cc21c2018-09-04 18:50:46122 render_manager_(this, frame_tree->manager_delegate()),
[email protected]bffc8302014-01-23 20:52:16123 frame_tree_node_id_(next_frame_tree_node_id_++),
xiaochengh98488162016-05-19 15:17:59124 parent_(parent),
Alexander Timin381e7e182020-04-28 19:04:03125 depth_(parent ? parent->frame_tree_node()->depth_ + 1 : 0u),
alexmose201c7cd2015-06-10 17:14:21126 opener_(nullptr),
jochen6004a362017-02-04 00:11:40127 original_opener_(nullptr),
creisf0f069a2015-07-23 23:51:53128 has_committed_real_load_(false),
engedy6e2e0992017-05-25 18:58:42129 is_collapsed_(false),
estarka886b8d2015-12-18 21:53:08130 replication_state_(
131 scope,
132 name,
lukasza464d8692016-02-22 19:26:32133 unique_name,
Julie Jeongeun Kimd90e2dd2020-03-03 11:45:37134 blink::mojom::InsecureRequestPolicy::
135 kLeaveInsecureRequestsAlone /* should enforce strict mixed content
136 checking */
137 ,
arthursonzogni4b62a5cb2018-01-17 14:14:26138 std::vector<uint32_t>()
139 /* hashes of hosts for insecure request upgrades */,
japhet61835ae12017-01-20 01:25:39140 false /* is a potentially trustworthy unique origin */,
danakj359a4342020-05-29 20:38:39141 false /* has an active user gesture */,
Ehsan Karamad192a8da2018-10-21 03:48:08142 false /* has received a user gesture before nav */,
143 owner_type),
Lukasz Anforowicz7bfb2e92017-11-22 17:19:45144 is_created_by_script_(is_created_by_script),
Pavel Feldman25234722017-10-11 02:49:06145 devtools_frame_token_(devtools_frame_token),
lazyboy70605c32015-11-03 01:27:31146 frame_owner_properties_(frame_owner_properties),
Shubhie Panickerddf2a4e2018-03-06 00:09:06147 was_discarded_(false),
Alexander Timin381e7e182020-04-28 19:04:03148 blame_context_(frame_tree_node_id_, FrameTreeNode::From(parent)) {
rob97250742015-12-10 17:45:15149 std::pair<FrameTreeNodeIdMap::iterator, bool> result =
dmazzonie950ea232015-03-13 21:39:45150 g_frame_tree_node_id_map.Get().insert(
151 std::make_pair(frame_tree_node_id_, this));
152 CHECK(result.second);
benjhaydend4da63d2016-03-11 21:29:33153
xiaochenghb9554bb2016-05-21 14:20:48154 // Note: this should always be done last in the constructor.
155 blame_context_.Initialize();
alexmos998581d2015-01-22 01:01:59156}
[email protected]9b159a52013-10-03 17:24:55157
158FrameTreeNode::~FrameTreeNode() {
Nasko Oskov252ae042018-10-04 21:44:12159 // Remove the children.
160 current_frame_host()->ResetChildren();
Lukasz Anforowicz7bfb2e92017-11-22 17:19:45161
Nate Chapin22ea6592019-03-05 22:29:02162 current_frame_host()->ResetLoadingState();
163
Lukasz Anforowicz7bfb2e92017-11-22 17:19:45164 // If the removed frame was created by a script, then its history entry will
165 // never be reused - we can save some memory by removing the history entry.
166 // See also https://crbug.com/784356.
167 if (is_created_by_script_ && parent_) {
168 NavigationEntryImpl* nav_entry = static_cast<NavigationEntryImpl*>(
Fergal Daly09d6c762020-05-29 02:05:18169 navigator().GetController()->GetLastCommittedEntry());
Lukasz Anforowicz7bfb2e92017-11-22 17:19:45170 if (nav_entry) {
171 nav_entry->RemoveEntryForFrame(this,
172 /* only_if_different_position = */ false);
173 }
174 }
175
dmazzonie950ea232015-03-13 21:39:45176 frame_tree_->FrameRemoved(this);
ericwilligers254597b2016-10-17 10:32:31177 for (auto& observer : observers_)
178 observer.OnFrameTreeNodeDestroyed(this);
alexmose201c7cd2015-06-10 17:14:21179
180 if (opener_)
181 opener_->RemoveObserver(opener_observer_.get());
jochen6004a362017-02-04 00:11:40182 if (original_opener_)
183 original_opener_->RemoveObserver(original_opener_observer_.get());
dmazzonie950ea232015-03-13 21:39:45184
185 g_frame_tree_node_id_map.Get().erase(frame_tree_node_id_);
jam39258caf2016-11-02 14:48:18186
danakjf9400602019-06-07 15:44:58187 bool did_stop_loading = false;
188
jam39258caf2016-11-02 14:48:18189 if (navigation_request_) {
danakjf9400602019-06-07 15:44:58190 navigation_request_.reset();
Arthur Hemery0dd65812019-08-01 14:18:45191 // If a frame with a pending navigation is detached, make sure the
192 // WebContents (and its observers) update their loading state.
danakjf9400602019-06-07 15:44:58193 did_stop_loading = true;
jam39258caf2016-11-02 14:48:18194 }
Nate Chapin22ea6592019-03-05 22:29:02195
danakjf9400602019-06-07 15:44:58196 // ~SiteProcessCountTracker DCHECKs in some tests if the speculative
197 // RenderFrameHostImpl is not destroyed last. Ideally this would be closer to
198 // (possible before) the ResetLoadingState() call above.
199 //
200 // There is an inherent race condition causing bugs 838348/915179/et al, where
201 // the renderer may have committed the speculative main frame and the browser
202 // has not heard about it yet. If this is a main frame, then in that case the
203 // speculative RenderFrame was unable to be deleted (it is owned by the
204 // renderer) and we should not be able to cancel the navigation at this point.
205 // CleanUpNavigation() would normally be called here but it will try to undo
206 // the navigation and expose the race condition. When it replaces the main
207 // frame with a RenderFrameProxy, that leaks the committed main frame, leaving
208 // the frame and its friend group with pointers that will become invalid
209 // shortly as we are shutting everything down and deleting the RenderView etc.
210 // We avoid this problematic situation by not calling CleanUpNavigation() or
211 // DiscardUnusedFrame() here. The speculative RenderFrameHost is simply
212 // returned and deleted immediately. This satisfies the requirement that the
213 // speculative RenderFrameHost is removed from the RenderFrameHostManager
214 // before it is destroyed.
215 if (render_manager_.speculative_frame_host()) {
216 did_stop_loading |= render_manager_.speculative_frame_host()->is_loading();
217 render_manager_.UnsetSpeculativeRenderFrameHost();
218 }
219
220 if (did_stop_loading)
221 DidStopLoading();
222
Nate Chapin22ea6592019-03-05 22:29:02223 DCHECK(!IsLoading());
[email protected]9b159a52013-10-03 17:24:55224}
225
alexmose201c7cd2015-06-10 17:14:21226void FrameTreeNode::AddObserver(Observer* observer) {
227 observers_.AddObserver(observer);
228}
229
230void FrameTreeNode::RemoveObserver(Observer* observer) {
231 observers_.RemoveObserver(observer);
232}
233
[email protected]94d0cc12013-12-18 00:07:41234bool FrameTreeNode::IsMainFrame() const {
235 return frame_tree_->root() == this;
236}
237
Ian Clelland5cbaaf82017-11-27 22:00:03238void FrameTreeNode::ResetForNavigation() {
239 // Discard any CSP headers from the previous document.
240 replication_state_.accumulated_csp_headers.clear();
241 render_manager_.OnDidResetContentSecurityPolicy();
242
Ian Clellandedb8c5dd2018-03-01 17:01:37243 // Clear any CSP-set sandbox flags, and the declared feature policy for the
244 // frame.
arthursonzognib93a4472020-04-10 07:38:00245 UpdateFramePolicyHeaders(network::mojom::WebSandboxFlags::kNone, {});
Shivani Sharmac4f561582018-11-15 15:58:39246
Mustaq Ahmedc53e4c562019-01-29 19:05:09247 // This frame has had its user activation bits cleared in the renderer
248 // before arriving here. We just need to clear them here and in the other
249 // renderer processes that may have a reference to this frame.
Antonio Gomes4b2c5132020-01-16 11:49:48250 UpdateUserActivationState(
Mustaq Ahmeddc195e5b2020-08-04 18:45:11251 blink::mojom::UserActivationUpdateType::kClearActivation,
252 blink::mojom::UserActivationNotificationType::kNone);
Ian Clelland5cbaaf82017-11-27 22:00:03253}
254
yilkal34a3d752019-08-30 18:20:30255size_t FrameTreeNode::GetFrameTreeSize() const {
256 if (is_collapsed())
257 return 0;
258
259 size_t size = 0;
260 for (size_t i = 0; i < child_count(); i++) {
261 size += child_at(i)->GetFrameTreeSize();
262 }
263
264 // Account for this node.
265 size++;
266 return size;
267}
268
alexmose201c7cd2015-06-10 17:14:21269void FrameTreeNode::SetOpener(FrameTreeNode* opener) {
270 if (opener_) {
271 opener_->RemoveObserver(opener_observer_.get());
272 opener_observer_.reset();
273 }
274
275 opener_ = opener;
276
277 if (opener_) {
Jeremy Roman04f27c372017-10-27 15:20:55278 opener_observer_ = std::make_unique<OpenerDestroyedObserver>(this, false);
alexmose201c7cd2015-06-10 17:14:21279 opener_->AddObserver(opener_observer_.get());
280 }
281}
282
Wolfgang Beyerd8809db2020-09-30 15:29:39283void FrameTreeNode::SetOpenerDevtoolsFrameToken(
284 base::UnguessableToken opener_devtools_frame_token) {
285 DCHECK(!opener_devtools_frame_token_ ||
286 opener_devtools_frame_token_->is_empty());
287 opener_devtools_frame_token_ = std::move(opener_devtools_frame_token);
288}
289
jochen6004a362017-02-04 00:11:40290void FrameTreeNode::SetOriginalOpener(FrameTreeNode* opener) {
Avi Drissman36465f332017-09-11 20:49:39291 // The original opener tracks main frames only.
avi8d1aa162017-03-27 18:27:37292 DCHECK(opener == nullptr || !opener->parent());
jochen6004a362017-02-04 00:11:40293
Avi Drissman36465f332017-09-11 20:49:39294 if (original_opener_) {
295 original_opener_->RemoveObserver(original_opener_observer_.get());
296 original_opener_observer_.reset();
297 }
298
jochen6004a362017-02-04 00:11:40299 original_opener_ = opener;
300
301 if (original_opener_) {
jochen6004a362017-02-04 00:11:40302 original_opener_observer_ =
Jeremy Roman04f27c372017-10-27 15:20:55303 std::make_unique<OpenerDestroyedObserver>(this, true);
jochen6004a362017-02-04 00:11:40304 original_opener_->AddObserver(original_opener_observer_.get());
305 }
306}
307
creisf0f069a2015-07-23 23:51:53308void FrameTreeNode::SetCurrentURL(const GURL& url) {
Balazs Engedyc8a7cccf2018-03-12 23:00:49309 if (!has_committed_real_load_ && !url.IsAboutBlank())
creisf0f069a2015-07-23 23:51:53310 has_committed_real_load_ = true;
Erik Chen173bf3042017-07-31 06:06:21311 current_frame_host()->SetLastCommittedUrl(url);
xiaochenghb9554bb2016-05-21 14:20:48312 blame_context_.TakeSnapshot();
creisf0f069a2015-07-23 23:51:53313}
314
estarkbd8e26f2016-03-16 23:30:37315void FrameTreeNode::SetCurrentOrigin(
316 const url::Origin& origin,
317 bool is_potentially_trustworthy_unique_origin) {
318 if (!origin.IsSameOriginWith(replication_state_.origin) ||
319 replication_state_.has_potentially_trustworthy_unique_origin !=
320 is_potentially_trustworthy_unique_origin) {
321 render_manager_.OnDidUpdateOrigin(origin,
322 is_potentially_trustworthy_unique_origin);
323 }
alexmosa7a4ff822015-04-27 17:59:56324 replication_state_.origin = origin;
estarkbd8e26f2016-03-16 23:30:37325 replication_state_.has_potentially_trustworthy_unique_origin =
326 is_potentially_trustworthy_unique_origin;
alexmosa7a4ff822015-04-27 17:59:56327}
alexmosbe2f4c32015-03-10 02:30:23328
engedy6e2e0992017-05-25 18:58:42329void FrameTreeNode::SetCollapsed(bool collapsed) {
330 DCHECK(!IsMainFrame());
331 if (is_collapsed_ == collapsed)
332 return;
333
334 is_collapsed_ = collapsed;
335 render_manager_.OnDidChangeCollapsedState(collapsed);
336}
337
lukasza464d8692016-02-22 19:26:32338void FrameTreeNode::SetFrameName(const std::string& name,
339 const std::string& unique_name) {
340 if (name == replication_state_.name) {
341 // |unique_name| shouldn't change unless |name| changes.
342 DCHECK_EQ(unique_name, replication_state_.unique_name);
343 return;
344 }
lukasza5140a412016-09-15 21:12:30345
346 if (parent()) {
347 // Non-main frames should have a non-empty unique name.
348 DCHECK(!unique_name.empty());
349 } else {
350 // Unique name of main frames should always stay empty.
351 DCHECK(unique_name.empty());
352 }
353
Daniel Cheng6ca7f1c92017-08-09 21:45:41354 // Note the unique name should only be able to change before the first real
355 // load is committed, but that's not strongly enforced here.
lukasza464d8692016-02-22 19:26:32356 render_manager_.OnDidUpdateName(name, unique_name);
alexmosa7a4ff822015-04-27 17:59:56357 replication_state_.name = name;
lukasza464d8692016-02-22 19:26:32358 replication_state_.unique_name = unique_name;
alexmosbe2f4c32015-03-10 02:30:23359}
360
arthursonzogni662aa652017-03-28 11:09:50361void FrameTreeNode::AddContentSecurityPolicies(
arthursonzogni35a95c72020-01-15 17:49:43362 std::vector<network::mojom::ContentSecurityPolicyHeaderPtr> headers) {
363 for (auto& header : headers)
364 replication_state_.accumulated_csp_headers.push_back(*header);
365 render_manager_.OnDidAddContentSecurityPolicies(std::move(headers));
lukasza8e1c02e42016-05-17 20:05:10366}
367
mkwstf672e7ef2016-06-09 20:51:07368void FrameTreeNode::SetInsecureRequestPolicy(
Julie Jeongeun Kimd90e2dd2020-03-03 11:45:37369 blink::mojom::InsecureRequestPolicy policy) {
mkwstf672e7ef2016-06-09 20:51:07370 if (policy == replication_state_.insecure_request_policy)
estarka886b8d2015-12-18 21:53:08371 return;
mkwstf672e7ef2016-06-09 20:51:07372 render_manager_.OnEnforceInsecureRequestPolicy(policy);
373 replication_state_.insecure_request_policy = policy;
estarka886b8d2015-12-18 21:53:08374}
375
arthursonzogni4b62a5cb2018-01-17 14:14:26376void FrameTreeNode::SetInsecureNavigationsSet(
377 const std::vector<uint32_t>& insecure_navigations_set) {
378 DCHECK(std::is_sorted(insecure_navigations_set.begin(),
379 insecure_navigations_set.end()));
380 if (insecure_navigations_set == replication_state_.insecure_navigations_set)
381 return;
382 render_manager_.OnEnforceInsecureNavigationsSet(insecure_navigations_set);
383 replication_state_.insecure_navigations_set = insecure_navigations_set;
384}
385
Luna Luc3fdacdf2017-11-08 04:48:53386void FrameTreeNode::SetPendingFramePolicy(blink::FramePolicy frame_policy) {
Ian Clellandcdc4f312017-10-13 22:24:12387 pending_frame_policy_.sandbox_flags = frame_policy.sandbox_flags;
Dave Tapuska9b153a942020-02-10 19:35:10388 pending_frame_policy_.disallow_document_access =
389 frame_policy.disallow_document_access;
alexmos6e940102016-01-19 22:47:25390
Ian Clellandcdc4f312017-10-13 22:24:12391 if (parent()) {
392 // Subframes should always inherit their parent's sandbox flags.
Alexander Timin381e7e182020-04-28 19:04:03393 pending_frame_policy_.sandbox_flags |=
394 parent()->frame_tree_node()->active_sandbox_flags();
Charlie Hue1b77ac2019-12-13 21:30:17395 // This is only applied on subframes; container policy and required document
396 // policy are not mutable on main frame.
Ian Clellandcdc4f312017-10-13 22:24:12397 pending_frame_policy_.container_policy = frame_policy.container_policy;
Charlie Hue1b77ac2019-12-13 21:30:17398 pending_frame_policy_.required_document_policy =
399 frame_policy.required_document_policy;
Ian Clellandcdc4f312017-10-13 22:24:12400 }
iclelland92f8c0b2017-04-19 12:43:05401}
402
alexmos9f8705a2015-05-06 19:58:59403FrameTreeNode* FrameTreeNode::PreviousSibling() const {
paulmeyer322777fb2016-05-16 23:15:39404 return GetSibling(-1);
405}
alexmos9f8705a2015-05-06 19:58:59406
paulmeyer322777fb2016-05-16 23:15:39407FrameTreeNode* FrameTreeNode::NextSibling() const {
408 return GetSibling(1);
alexmos9f8705a2015-05-06 19:58:59409}
410
fdegans4a49ce932015-03-12 17:11:37411bool FrameTreeNode::IsLoading() const {
412 RenderFrameHostImpl* current_frame_host =
413 render_manager_.current_frame_host();
fdegans4a49ce932015-03-12 17:11:37414
415 DCHECK(current_frame_host);
fdegans39ff0382015-04-29 19:04:39416
clamy610c63b32017-12-22 15:05:18417 if (navigation_request_)
418 return true;
clamy11e11512015-07-07 16:42:17419
clamy610c63b32017-12-22 15:05:18420 RenderFrameHostImpl* speculative_frame_host =
421 render_manager_.speculative_frame_host();
422 if (speculative_frame_host && speculative_frame_host->is_loading())
423 return true;
fdegans4a49ce932015-03-12 17:11:37424 return current_frame_host->is_loading();
425}
426
Charlie Hu5ffc0152019-12-06 15:59:53427bool FrameTreeNode::CommitFramePolicy(
428 const blink::FramePolicy& new_frame_policy) {
429 bool did_change_flags = new_frame_policy.sandbox_flags !=
Ian Clellandcdc4f312017-10-13 22:24:12430 replication_state_.frame_policy.sandbox_flags;
iclelland92f8c0b2017-04-19 12:43:05431 bool did_change_container_policy =
Charlie Hu5ffc0152019-12-06 15:59:53432 new_frame_policy.container_policy !=
Ian Clellandcdc4f312017-10-13 22:24:12433 replication_state_.frame_policy.container_policy;
Charlie Hue1b77ac2019-12-13 21:30:17434 bool did_change_required_document_policy =
435 pending_frame_policy_.required_document_policy !=
436 replication_state_.frame_policy.required_document_policy;
Dave Tapuska9b153a942020-02-10 19:35:10437 bool did_change_document_access =
438 new_frame_policy.disallow_document_access !=
439 replication_state_.frame_policy.disallow_document_access;
iclelland92f8c0b2017-04-19 12:43:05440 if (did_change_flags)
Ian Clellandcdc4f312017-10-13 22:24:12441 replication_state_.frame_policy.sandbox_flags =
Charlie Hu5ffc0152019-12-06 15:59:53442 new_frame_policy.sandbox_flags;
iclelland92f8c0b2017-04-19 12:43:05443 if (did_change_container_policy)
Ian Clellandcdc4f312017-10-13 22:24:12444 replication_state_.frame_policy.container_policy =
Charlie Hu5ffc0152019-12-06 15:59:53445 new_frame_policy.container_policy;
Charlie Hue1b77ac2019-12-13 21:30:17446 if (did_change_required_document_policy)
447 replication_state_.frame_policy.required_document_policy =
448 new_frame_policy.required_document_policy;
Dave Tapuska9b153a942020-02-10 19:35:10449 if (did_change_document_access)
450 replication_state_.frame_policy.disallow_document_access =
451 new_frame_policy.disallow_document_access;
Charlie Hue1b77ac2019-12-13 21:30:17452
Charlie Hu5ffc0152019-12-06 15:59:53453 UpdateFramePolicyHeaders(new_frame_policy.sandbox_flags,
Ian Clellandedb8c5dd2018-03-01 17:01:37454 replication_state_.feature_policy_header);
Charlie Hue1b77ac2019-12-13 21:30:17455 return did_change_flags || did_change_container_policy ||
Dave Tapuska9b153a942020-02-10 19:35:10456 did_change_required_document_policy || did_change_document_access;
alexmos6b294562015-03-05 19:24:10457}
458
Arthur Hemeryc3380172018-01-22 14:00:17459void FrameTreeNode::TransferNavigationRequestOwnership(
460 RenderFrameHostImpl* render_frame_host) {
Andrey Kosyakovf2d4ff72018-10-29 20:09:59461 devtools_instrumentation::OnResetNavigationRequest(navigation_request_.get());
Arthur Hemeryc3380172018-01-22 14:00:17462 render_frame_host->SetNavigationRequest(std::move(navigation_request_));
463}
464
carloskc49005eb2015-06-16 11:25:07465void FrameTreeNode::CreatedNavigationRequest(
dcheng9bfa5162016-04-09 01:00:57466 std::unique_ptr<NavigationRequest> navigation_request) {
arthursonzognic79c251c2016-08-18 15:00:37467 // This is never called when navigating to a Javascript URL. For the loading
468 // state, this matches what Blink is doing: Blink doesn't send throbber
469 // notifications for Javascript URLS.
470 DCHECK(!navigation_request->common_params().url.SchemeIs(
471 url::kJavaScriptScheme));
472
clamy44e84ce2016-02-22 15:38:25473 bool was_previously_loading = frame_tree()->IsLoading();
474
clamy82a2f4d2016-02-02 14:20:41475 // There's no need to reset the state: there's still an ongoing load, and the
476 // RenderFrameHostManager will take care of updates to the speculative
477 // RenderFrameHost in DidCreateNavigationRequest below.
jamcd0b7b22017-03-24 22:13:05478 if (was_previously_loading) {
Mohamed Abdelhalimf03d4a22019-10-01 13:34:31479 if (navigation_request_ && navigation_request_->IsNavigationStarted()) {
jamcd0b7b22017-03-24 22:13:05480 // Mark the old request as aborted.
Mohamed Abdelhalimb4db22a2019-06-18 10:46:52481 navigation_request_->set_net_error(net::ERR_ABORTED);
jamcd0b7b22017-03-24 22:13:05482 }
Arthur Hemery241b9392019-10-24 11:08:41483 ResetNavigationRequest(true);
jamcd0b7b22017-03-24 22:13:05484 }
clamy44e84ce2016-02-22 15:38:25485
486 navigation_request_ = std::move(navigation_request);
Shubhie Panickerddf2a4e2018-03-06 00:09:06487 if (was_discarded_) {
488 navigation_request_->set_was_discarded();
489 was_discarded_ = false;
490 }
clamy8e2e299202016-04-05 11:44:59491 render_manager()->DidCreateNavigationRequest(navigation_request_.get());
fdegans39ff0382015-04-29 19:04:39492
Lucas Furukawa Gadanief8290a2019-07-29 20:27:51493 bool to_different_document = !NavigationTypeUtils::IsSameDocument(
arthursonzogni92f18682017-02-08 23:00:04494 navigation_request_->common_params().navigation_type);
495
496 DidStartLoading(to_different_document, was_previously_loading);
clamydcb434c12015-04-16 19:29:16497}
498
Arthur Hemery241b9392019-10-24 11:08:41499void FrameTreeNode::ResetNavigationRequest(bool keep_state) {
fdegans39ff0382015-04-29 19:04:39500 if (!navigation_request_)
501 return;
John Abd-El-Malekdcc7bf42017-09-12 22:30:23502
Andrey Kosyakovf2d4ff72018-10-29 20:09:59503 devtools_instrumentation::OnResetNavigationRequest(navigation_request_.get());
clamydcb434c12015-04-16 19:29:16504 navigation_request_.reset();
fdegans39ff0382015-04-29 19:04:39505
clamy82a2f4d2016-02-02 14:20:41506 if (keep_state)
fdegans39ff0382015-04-29 19:04:39507 return;
508
clamy82a2f4d2016-02-02 14:20:41509 // The RenderFrameHostManager should clean up any speculative RenderFrameHost
510 // it created for the navigation. Also register that the load stopped.
fdegans39ff0382015-04-29 19:04:39511 DidStopLoading();
512 render_manager_.CleanUpNavigation();
clamydcb434c12015-04-16 19:29:16513}
514
clamy44e84ce2016-02-22 15:38:25515void FrameTreeNode::DidStartLoading(bool to_different_document,
516 bool was_previously_loading) {
Camille Lamyefd54b02018-10-04 16:54:14517 TRACE_EVENT2("navigation", "FrameTreeNode::DidStartLoading",
518 "frame_tree_node", frame_tree_node_id(), "to different document",
519 to_different_document);
fdegansa696e5112015-04-17 01:57:59520 // Any main frame load to a new document should reset the load progress since
521 // it will replace the current page and any frames. The WebContents will
522 // be notified when DidChangeLoadProgress is called.
523 if (to_different_document && IsMainFrame())
524 frame_tree_->ResetLoadProgress();
525
526 // Notify the WebContents.
clamy44e84ce2016-02-22 15:38:25527 if (!was_previously_loading)
Fergal Daly09d6c762020-05-29 02:05:18528 navigator().GetDelegate()->DidStartLoading(this, to_different_document);
fdegansa696e5112015-04-17 01:57:59529
530 // Set initial load progress and update overall progress. This will notify
531 // the WebContents of the load progress change.
532 DidChangeLoadProgress(kLoadingProgressMinimum);
533
534 // Notify the RenderFrameHostManager of the event.
535 render_manager()->OnDidStartLoading();
536}
537
538void FrameTreeNode::DidStopLoading() {
Camille Lamyefd54b02018-10-04 16:54:14539 TRACE_EVENT1("navigation", "FrameTreeNode::DidStopLoading", "frame_tree_node",
540 frame_tree_node_id());
fdegansa696e5112015-04-17 01:57:59541 // Set final load progress and update overall progress. This will notify
542 // the WebContents of the load progress change.
543 DidChangeLoadProgress(kLoadingProgressDone);
544
Lucas Furukawa Gadani6faef602019-05-06 21:16:03545 // Notify the RenderFrameHostManager of the event.
546 render_manager()->OnDidStopLoading();
547
fdegansa696e5112015-04-17 01:57:59548 // Notify the WebContents.
549 if (!frame_tree_->IsLoading())
Fergal Daly09d6c762020-05-29 02:05:18550 navigator().GetDelegate()->DidStopLoading();
fdegansa696e5112015-04-17 01:57:59551}
552
553void FrameTreeNode::DidChangeLoadProgress(double load_progress) {
Nate Chapin93536702018-02-07 00:12:21554 DCHECK_GE(load_progress, kLoadingProgressMinimum);
555 DCHECK_LE(load_progress, kLoadingProgressDone);
556 if (IsMainFrame())
557 frame_tree_->UpdateLoadProgress(load_progress);
fdegansa696e5112015-04-17 01:57:59558}
559
clamyf73862c42015-07-08 12:31:33560bool FrameTreeNode::StopLoading() {
arthursonzogni66f711c2019-10-08 14:40:36561 if (navigation_request_ && navigation_request_->IsNavigationStarted())
562 navigation_request_->set_net_error(net::ERR_ABORTED);
Arthur Hemery241b9392019-10-24 11:08:41563 ResetNavigationRequest(false);
clamyf73862c42015-07-08 12:31:33564
565 // TODO(nasko): see if child frames should send IPCs in site-per-process
566 // mode.
567 if (!IsMainFrame())
568 return true;
569
570 render_manager_.Stop();
571 return true;
572}
573
alexmos21acae52015-11-07 01:04:43574void FrameTreeNode::DidFocus() {
575 last_focus_time_ = base::TimeTicks::Now();
ericwilligers254597b2016-10-17 10:32:31576 for (auto& observer : observers_)
577 observer.OnFrameTreeNodeFocused(this);
alexmos21acae52015-11-07 01:04:43578}
579
clamy44e84ce2016-02-22 15:38:25580void FrameTreeNode::BeforeUnloadCanceled() {
581 // TODO(clamy): Support BeforeUnload in subframes.
582 if (!IsMainFrame())
583 return;
584
585 RenderFrameHostImpl* current_frame_host =
586 render_manager_.current_frame_host();
587 DCHECK(current_frame_host);
588 current_frame_host->ResetLoadingState();
589
clamy610c63b32017-12-22 15:05:18590 RenderFrameHostImpl* speculative_frame_host =
591 render_manager_.speculative_frame_host();
592 if (speculative_frame_host)
593 speculative_frame_host->ResetLoadingState();
594 // Note: there is no need to set an error code on the NavigationHandle here
595 // as it has not been created yet. It is only created when the
Antonio Gomes8678a202020-03-02 20:03:25596 // BeforeUnloadCompleted callback is invoked.
clamy610c63b32017-12-22 15:05:18597 if (navigation_request_)
Arthur Hemery241b9392019-10-24 11:08:41598 ResetNavigationRequest(false);
clamy44e84ce2016-02-22 15:38:25599}
600
Mustaq Ahmedecb5c38e2020-07-29 00:34:30601bool FrameTreeNode::NotifyUserActivation(
602 blink::mojom::UserActivationNotificationType notification_type) {
Alexander Timina1dfadaa2020-04-28 13:30:06603 for (RenderFrameHostImpl* rfh = current_frame_host(); rfh;
604 rfh = rfh->GetParent()) {
605 if (!rfh->frame_tree_node()->user_activation_state_.HasBeenActive())
606 rfh->DidReceiveFirstUserActivation();
Mustaq Ahmedecb5c38e2020-07-29 00:34:30607 rfh->frame_tree_node()->user_activation_state_.Activate(notification_type);
John Delaneyedd8d6c2019-01-25 00:23:57608 }
danakj359a4342020-05-29 20:38:39609 replication_state_.has_active_user_gesture = true;
Mustaq Ahmeda5dfa60b2018-12-08 00:30:14610
Mustaq Ahmed0180320f2019-03-21 16:07:01611 // See the "Same-origin Visibility" section in |UserActivationState| class
612 // doc.
Mustaq Ahmede5f12562019-10-30 18:02:03613 if (base::FeatureList::IsEnabled(
Mustaq Ahmeda5dfa60b2018-12-08 00:30:14614 features::kUserActivationSameOriginVisibility)) {
615 const url::Origin& current_origin =
616 this->current_frame_host()->GetLastCommittedOrigin();
617 for (FrameTreeNode* node : frame_tree()->Nodes()) {
618 if (node->current_frame_host()->GetLastCommittedOrigin().IsSameOriginWith(
619 current_origin)) {
Mustaq Ahmedecb5c38e2020-07-29 00:34:30620 node->user_activation_state_.Activate(notification_type);
Mustaq Ahmeda5dfa60b2018-12-08 00:30:14621 }
622 }
623 }
624
Shivani Sharma20749e922019-03-11 17:00:26625 NavigationControllerImpl* controller =
Fergal Daly09d6c762020-05-29 02:05:18626 static_cast<NavigationControllerImpl*>(navigator().GetController());
Shivani Sharma20749e922019-03-11 17:00:26627 if (controller)
628 controller->NotifyUserActivation();
Shivani Sharma194877032019-03-07 17:52:47629
Mustaq Ahmedc4cb7162018-06-05 16:28:36630 return true;
631}
632
633bool FrameTreeNode::ConsumeTransientUserActivation() {
634 bool was_active = user_activation_state_.IsActive();
635 for (FrameTreeNode* node : frame_tree()->Nodes())
636 node->user_activation_state_.ConsumeIfActive();
danakj359a4342020-05-29 20:38:39637 replication_state_.has_active_user_gesture = false;
Mustaq Ahmedc4cb7162018-06-05 16:28:36638 return was_active;
639}
640
Shivani Sharmac4f561582018-11-15 15:58:39641bool FrameTreeNode::ClearUserActivation() {
Shivani Sharmac4f561582018-11-15 15:58:39642 for (FrameTreeNode* node : frame_tree()->SubtreeNodes(this))
643 node->user_activation_state_.Clear();
danakj359a4342020-05-29 20:38:39644 replication_state_.has_active_user_gesture = false;
Shivani Sharmac4f561582018-11-15 15:58:39645 return true;
646}
647
Ella Ge9caed612019-08-09 16:17:25648bool FrameTreeNode::VerifyUserActivation() {
Ella Gea78f6772019-12-11 10:35:25649 DCHECK(base::FeatureList::IsEnabled(
650 features::kBrowserVerifiedUserActivationMouse) ||
651 base::FeatureList::IsEnabled(
652 features::kBrowserVerifiedUserActivationKeyboard));
653
Ella Ge9caed612019-08-09 16:17:25654 return render_manager_.current_frame_host()
655 ->GetRenderWidgetHost()
Mustaq Ahmed83bb1722019-10-22 20:00:10656 ->RemovePendingUserActivationIfAvailable();
Ella Ge9caed612019-08-09 16:17:25657}
658
Mustaq Ahmedc4cb7162018-06-05 16:28:36659bool FrameTreeNode::UpdateUserActivationState(
Mustaq Ahmeddc195e5b2020-08-04 18:45:11660 blink::mojom::UserActivationUpdateType update_type,
661 blink::mojom::UserActivationNotificationType notification_type) {
Ella Ge9caed612019-08-09 16:17:25662 bool update_result = false;
Mustaq Ahmedc4cb7162018-06-05 16:28:36663 switch (update_type) {
Antonio Gomes4b2c5132020-01-16 11:49:48664 case blink::mojom::UserActivationUpdateType::kConsumeTransientActivation:
Ella Ge9caed612019-08-09 16:17:25665 update_result = ConsumeTransientUserActivation();
666 break;
Antonio Gomes4b2c5132020-01-16 11:49:48667 case blink::mojom::UserActivationUpdateType::kNotifyActivation:
Mustaq Ahmeddc195e5b2020-08-04 18:45:11668 update_result = NotifyUserActivation(notification_type);
Ella Ge9caed612019-08-09 16:17:25669 break;
Antonio Gomes4b2c5132020-01-16 11:49:48670 case blink::mojom::UserActivationUpdateType::
Liviu Tintad9391fb92020-09-28 23:50:07671 kNotifyActivationPendingBrowserVerification: {
672 const bool user_activation_verified = VerifyUserActivation();
673 // Add UMA metric for when browser user activation verification succeeds
674 base::UmaHistogramBoolean("Event.BrowserVerifiedUserActivation",
675 user_activation_verified);
676 if (user_activation_verified) {
Mustaq Ahmedecb5c38e2020-07-29 00:34:30677 update_result = NotifyUserActivation(
Mustaq Ahmed2cfb0402020-09-29 19:24:35678 blink::mojom::UserActivationNotificationType::kInteraction);
Antonio Gomes4b2c5132020-01-16 11:49:48679 update_type = blink::mojom::UserActivationUpdateType::kNotifyActivation;
Ella Ge9caed612019-08-09 16:17:25680 } else {
681 // TODO(crbug.com/848778): We need to decide what to do when user
682 // activation verification failed. NOTREACHED here will make all
683 // unrelated tests that inject event to renderer fail.
684 return false;
685 }
Liviu Tintad9391fb92020-09-28 23:50:07686 } break;
Antonio Gomes4b2c5132020-01-16 11:49:48687 case blink::mojom::UserActivationUpdateType::kClearActivation:
Ella Ge9caed612019-08-09 16:17:25688 update_result = ClearUserActivation();
689 break;
Mustaq Ahmedc4cb7162018-06-05 16:28:36690 }
Mustaq Ahmeddc195e5b2020-08-04 18:45:11691 render_manager_.UpdateUserActivationState(update_type, notification_type);
Ella Ge9caed612019-08-09 16:17:25692 return update_result;
japhet61835ae12017-01-20 01:25:39693}
694
Mustaq Ahmed01261742019-12-16 15:49:06695void FrameTreeNode::OnSetHadStickyUserActivationBeforeNavigation(bool value) {
696 render_manager_.OnSetHadStickyUserActivationBeforeNavigation(value);
Becca Hughes60af7d42017-12-12 10:53:15697 replication_state_.has_received_user_gesture_before_nav = value;
698}
699
paulmeyer322777fb2016-05-16 23:15:39700FrameTreeNode* FrameTreeNode::GetSibling(int relative_offset) const {
paulmeyerf3119f52016-05-17 17:37:19701 if (!parent_ || !parent_->child_count())
paulmeyer322777fb2016-05-16 23:15:39702 return nullptr;
703
704 for (size_t i = 0; i < parent_->child_count(); ++i) {
705 if (parent_->child_at(i) == this) {
706 if ((relative_offset < 0 && static_cast<size_t>(-relative_offset) > i) ||
707 i + relative_offset >= parent_->child_count()) {
708 return nullptr;
709 }
710 return parent_->child_at(i + relative_offset);
711 }
712 }
713
714 NOTREACHED() << "FrameTreeNode not found in its parent's children.";
715 return nullptr;
716}
717
Ian Clellandedb8c5dd2018-03-01 17:01:37718void FrameTreeNode::UpdateFramePolicyHeaders(
arthursonzognib93a4472020-04-10 07:38:00719 network::mojom::WebSandboxFlags sandbox_flags,
Ian Clellandedb8c5dd2018-03-01 17:01:37720 const blink::ParsedFeaturePolicy& parsed_header) {
721 bool changed = false;
722 if (replication_state_.feature_policy_header != parsed_header) {
723 replication_state_.feature_policy_header = parsed_header;
724 changed = true;
725 }
Ian Clelland5cbaaf82017-11-27 22:00:03726 // TODO(iclelland): Kill the renderer if sandbox flags is not a subset of the
727 // currently effective sandbox flags from the frame. https://crbug.com/740556
arthursonzognib93a4472020-04-10 07:38:00728 network::mojom::WebSandboxFlags updated_flags =
Ian Clelland5cbaaf82017-11-27 22:00:03729 sandbox_flags | effective_frame_policy().sandbox_flags;
Ian Clellandedb8c5dd2018-03-01 17:01:37730 if (replication_state_.active_sandbox_flags != updated_flags) {
731 replication_state_.active_sandbox_flags = updated_flags;
732 changed = true;
733 }
734 // Notify any proxies if the policies have been changed.
735 if (changed)
736 render_manager()->OnDidSetFramePolicyHeaders();
Ian Clelland5cbaaf82017-11-27 22:00:03737}
738
Arthur Sonzognif8840b92018-11-07 14:10:35739void FrameTreeNode::PruneChildFrameNavigationEntries(
740 NavigationEntryImpl* entry) {
741 for (size_t i = 0; i < current_frame_host()->child_count(); ++i) {
742 FrameTreeNode* child = current_frame_host()->child_at(i);
743 if (child->is_created_by_script_) {
744 entry->RemoveEntryForFrame(child,
745 /* only_if_different_position = */ false);
746 } else {
747 child->PruneChildFrameNavigationEntries(entry);
748 }
749 }
750}
751
Ehsan Karamad39407082019-02-19 23:38:19752void FrameTreeNode::SetOpenerFeaturePolicyState(
Kent Tamura326c2db2020-07-20 06:28:05753 const blink::FeaturePolicyFeatureState& feature_state) {
Ehsan Karamad39407082019-02-19 23:38:19754 DCHECK(IsMainFrame());
755 if (base::FeatureList::IsEnabled(features::kFeaturePolicyForSandbox)) {
756 replication_state_.opener_feature_state = feature_state;
757 }
758}
759
Yao Xiao24ec9aa2020-01-28 16:36:00760void FrameTreeNode::SetAdFrameType(blink::mojom::AdFrameType ad_frame_type) {
761 DCHECK_NE(ad_frame_type, blink::mojom::AdFrameType::kNonAd);
762 if (replication_state_.ad_frame_type == blink::mojom::AdFrameType::kNonAd) {
763 replication_state_.ad_frame_type = ad_frame_type;
764 render_manager()->OnDidSetAdFrameType(ad_frame_type);
765 } else {
766 DCHECK_EQ(ad_frame_type, replication_state_.ad_frame_type);
767 }
768}
769
arthursonzogni034bb9c2020-10-01 08:29:56770void FrameTreeNode::SetInitialPopupURL(const GURL& initial_popup_url) {
771 DCHECK(initial_popup_url_.is_empty());
772 DCHECK(!has_committed_real_load_);
773 initial_popup_url_ = initial_popup_url;
774}
775
776void FrameTreeNode::SetPopupCreatorOrigin(
777 const url::Origin& popup_creator_origin) {
778 DCHECK(!has_committed_real_load_);
779 popup_creator_origin_ = popup_creator_origin;
780}
781
[email protected]9b159a52013-10-03 17:24:55782} // namespace content