-
Notifications
You must be signed in to change notification settings - Fork 65
/
render_frame_host_manager.cc
5171 lines (4694 loc) · 239 KB
/
render_frame_host_manager.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/renderer_host/render_frame_host_manager.h"
#include <stddef.h>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/adapters.h"
#include "base/containers/contains.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/base_tracing.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "base/types/expected.h"
#include "build/build_config.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/network/cross_origin_opener_policy_reporter.h"
#include "content/browser/process_lock.h"
#include "content/browser/renderer_host/agent_scheduling_group_host.h"
#include "content/browser/renderer_host/back_forward_cache_metrics.h"
#include "content/browser/renderer_host/debug_urls.h"
#include "content/browser/renderer_host/frame_navigation_entry.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/navigation_controller_impl.h"
#include "content/browser/renderer_host/navigation_discard_reason.h"
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/navigator.h"
#include "content/browser/renderer_host/render_frame_host_delegate.h"
#include "content/browser/renderer_host/render_frame_host_factory.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_frame_host_owner.h"
#include "content/browser/renderer_host/render_frame_proxy_host.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_enums.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/site_info.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/common/content_navigation_policy.h"
#include "content/common/navigation_params_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_host.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/disallow_activation_reason.h"
#include "content/public/browser/render_process_host_observer.h"
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "net/base/url_util.h"
#include "services/network/public/cpp/features.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom.h"
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
#include "third_party/blink/public/mojom/frame/user_activation_update_types.mojom.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
#if BUILDFLAG(IS_MAC)
#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
#endif // BUILDFLAG(IS_MAC)
namespace content {
using LifecycleStateImpl = RenderFrameHostImpl::LifecycleStateImpl;
using perfetto::protos::pbzero::ChromeTrackEvent;
namespace {
const char kBackForwardCachePageWithFormStorableHistogramName[] =
"BackForwardCache.PageWithForm.Storable";
bool IsAbout(const GURL& url) {
return url.IsAboutSrcdoc() || url.IsAboutBlank();
}
// Helper function to determine whether a navigation from `current_rfh` to
// `destination_effective_url_info` should swap BrowsingInstances to ensure that
// `destination_effective_url_info` ends up in a dedicated process. This is the
// case when `destination_effective_url` has an origin that was just isolated
// dynamically, where leaving the navigation in the current BrowsingInstance
// would leave `destination_effective_url_info` without a dedicated process,
// since dynamic origin isolation applies only to future BrowsingInstances. In
// the common case where `current_rfh` is a main frame, and there are no
// scripting references to it from other windows, it is safe to swap
// BrowsingInstances to ensure the new isolated origin takes effect. Note that
// this applies even to same-site navigations, as well as to renderer-initiated
// navigations.
bool ShouldSwapBrowsingInstancesForDynamicIsolation(
RenderFrameHostImpl* current_rfh,
const UrlInfo& destination_effective_url_info) {
// Only main frames are eligible to swap BrowsingInstances.
if (!current_rfh->is_main_frame())
return false;
// Skip cases when there are other windows that might script this one.
SiteInstanceImpl* current_instance = current_rfh->GetSiteInstance();
if (current_instance->GetRelatedActiveContentsCount() > 1u)
return false;
// Check whether `destination_effective_url_info` would require a dedicated
// process if we left it in the current BrowsingInstance. If so, there's no
// need to swap BrowsingInstances.
auto& current_isolation_context = current_instance->GetIsolationContext();
auto current_site_info = SiteInfo::Create(current_isolation_context,
destination_effective_url_info);
if (current_site_info.RequiresDedicatedProcess(current_isolation_context))
return false;
// Finally, check whether `destination_effective_url_info` would require a
// dedicated process if we were to swap to a fresh BrowsingInstance. To check
// this, use a new IsolationContext, rather than
// current_instance->GetIsolationContext().
IsolationContext future_isolation_context(
current_instance->GetBrowserContext());
auto future_site_info = SiteInfo::Create(future_isolation_context,
destination_effective_url_info);
return future_site_info.RequiresDedicatedProcess(future_isolation_context);
}
// Helper function to determine whether |dest_url_info| should be loaded in the
// same StoragePartition that |current_instance| is currently using.
bool DoesNavigationChangeStoragePartition(SiteInstanceImpl* current_instance,
const UrlInfo& dest_url_info) {
// Derive a new SiteInfo from |current_instance|, but don't treat the
// navigation as related to avoid StoragePartition propagation logic. Note
// that we discard WebExposedIsolationInfo in that computation, because we
// want to consider change in StoragePartition independently from it.
StoragePartitionConfig dest_partition_config =
current_instance
->DeriveSiteInfo(dest_url_info, /*is_related=*/false,
/*disregard_web_exposed_isolation_info=*/true)
.storage_partition_config();
StoragePartitionConfig current_partition_config =
current_instance->GetSiteInfo().storage_partition_config();
return current_partition_config != dest_partition_config;
}
bool IsSiteInstanceCompatibleWithErrorIsolation(
SiteInstanceImpl* site_instance,
const FrameTreeNode& frame_tree_node,
NavigationRequest::ErrorPageProcess error_page_process) {
if (error_page_process ==
NavigationRequest::ErrorPageProcess::kCurrentProcess) {
// If an error page must commit in the current process, the current
// SiteInstance must be reused.
return site_instance ==
frame_tree_node.current_frame_host()->GetSiteInstance();
}
if (!frame_tree_node.IsErrorPageIsolationEnabled()) {
// With no error isolation or current process requirement, all SiteInstances
// are compatible with any |error_page_process|.
CHECK(error_page_process ==
NavigationRequest::ErrorPageProcess::kNotErrorPage ||
error_page_process ==
NavigationRequest::ErrorPageProcess::kDestinationProcess);
return true;
}
// When error page isolation is enabled, don't reuse |site_instance| if it's
// an error page SiteInstance, but the navigation is not an error page
// navigation. Similarly, don't reuse `site_instance` if it's not an error
// page SiteInstance but the navigation will fail and actually need an error
// page SiteInstance.
bool is_site_instance_for_error_page =
site_instance->GetSiteInfo().is_error_page();
bool should_be_error_page_isolated =
(error_page_process !=
NavigationRequest::ErrorPageProcess::kNotErrorPage &&
error_page_process !=
NavigationRequest::ErrorPageProcess::kPostCommitErrorPage);
return is_site_instance_for_error_page == should_be_error_page_isolated;
}
// Simple wrapper around WebExposedIsolationInfo::AreCompatible for easier use
// within the process model.
bool IsSiteInstanceCompatibleWithWebExposedIsolation(
SiteInstanceImpl* site_instance,
const absl::optional<WebExposedIsolationInfo>& web_exposed_isolation_info) {
return WebExposedIsolationInfo::AreCompatible(
site_instance->GetWebExposedIsolationInfo(), web_exposed_isolation_info);
}
// Helper for appending more information to the optional |reason| parameter
// that some of the RenderFrameHostManager's methods expose for debugging /
// diagnostic purposes.
void AppendReason(std::string* reason, const char* value) {
if (!reason)
return;
if (!reason->empty())
reason->append("; ");
reason->append(value);
DCHECK_LT(reason->size(),
static_cast<size_t>(base::debug::CrashKeySize::Size256));
}
perfetto::protos::pbzero::ShouldSwapBrowsingInstance
ShouldSwapBrowsingInstanceToProto(ShouldSwapBrowsingInstance result) {
using ProtoLevel = perfetto::protos::pbzero::ShouldSwapBrowsingInstance;
switch (result) {
case ShouldSwapBrowsingInstance::kYes_ForceSwap:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_YES_FORCE_SWAP;
case ShouldSwapBrowsingInstance::kYes_CrossSiteProactiveSwap:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_YES_CROSS_SITE_PROACTIVE_SWAP;
case ShouldSwapBrowsingInstance::kYes_SameSiteProactiveSwap:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_YES_SAME_SITE_PROACTIVE_SWAP;
case ShouldSwapBrowsingInstance::kNo_ProactiveSwapDisabled:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_PROACTIVE_SWAP_DISABLED;
case ShouldSwapBrowsingInstance::kNo_NotMainFrame:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_NOT_MAIN_FRAME;
case ShouldSwapBrowsingInstance::kNo_HasRelatedActiveContents:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_HAS_RELATED_ACTIVE_CONTENTS;
case ShouldSwapBrowsingInstance::kNo_DoesNotHaveSite:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_DOES_NOT_HAVE_SITE;
case ShouldSwapBrowsingInstance::kNo_SourceURLSchemeIsNotHTTPOrHTTPS:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_SOURCE_URL_SCHEME_NOT_HTTP_OR_HTTPS;
case ShouldSwapBrowsingInstance::kNo_SameSiteNavigation:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_SAME_SITE_NAVIGATION;
case ShouldSwapBrowsingInstance::kNo_AlreadyHasMatchingBrowsingInstance:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_ALREADY_HAS_MATCHING_BROWSING_INSTANCE;
case ShouldSwapBrowsingInstance::kNo_RendererDebugURL:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_RENDERER_DEBUG_URL;
case ShouldSwapBrowsingInstance::kNo_NotNeededForBackForwardCache:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_NOT_NEEDED_FOR_BACK_FORWARD_CACHE;
case ShouldSwapBrowsingInstance::kNo_SameDocumentNavigation:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_SAME_DOCUMENT_NAVIGATION;
case ShouldSwapBrowsingInstance::kNo_SameUrlNavigation:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_SAME_URL_NAVIGATION;
case ShouldSwapBrowsingInstance::kNo_WillReplaceEntry:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_WILL_REPLACE_ENTRY;
case ShouldSwapBrowsingInstance::kNo_Reload:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_RELOAD;
case ShouldSwapBrowsingInstance::kNo_Guest:
return ProtoLevel::SHOULD_SWAP_BROWSING_INSTANCE_NO_GUEST;
case ShouldSwapBrowsingInstance::kNo_HasNotComittedAnyNavigation:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_HAS_NOT_COMMITTED_ANY_NAVIGATION;
case ShouldSwapBrowsingInstance::kNo_NotPrimaryMainFrame:
return ProtoLevel::
SHOULD_SWAP_BROWSING_INSTANCE_NO_NOT_PRIMARY_MAIN_FRAME;
}
}
void TraceShouldSwapBrowsingInstanceResult(int frame_tree_node_id,
ShouldSwapBrowsingInstance result) {
TRACE_EVENT_INSTANT(
"navigation",
"RenderFrameHostManager::GetSiteInstanceForNavigation_ShouldSwapResult",
[&](perfetto::EventContext ctx) {
auto* event = ctx.event<ChromeTrackEvent>();
auto* data = event->set_should_swap_browsing_instances_result();
data->set_frame_tree_node_id(frame_tree_node_id);
data->set_result(ShouldSwapBrowsingInstanceToProto(result));
});
}
// This method tries to find a process for |new_instance| to reuse by starting
// from |rfh|'s outermost main frame, and then iterating through all the
// embedded fenced frame FrameTrees and trying to reuse their BrowsingInstance's
// default process (if one is set). By setting a process for |new_instance|, it
// is also setting its BrowsingInstance's default process, and as a result, it
// gets these groups of BrowsingInstances to share the same default process.
//
// Note that it is possible for a fenced frame BrowsingInstance to get assigned
// a default process first, before its embedder (for example: if the embedder
// only had a frame at an isolated site, which embeds a fenced frame at a
// non-isolated site). If we were to assign the embedder BrowsingInstance a
// default process later (from the previous example, if the embedder added a
// non-isolated iframe), we would iterate through the entire set of FrameTrees
// and find and reuse the fenced frame BrowsingInstance's default process.
//
// TODO(crbug.com/1347235): There are certain scenarios where this won't work,
// see bug for an example scenario/proposed fix.
void ReuseDefaultProcessFromDifferentBrowsingInstanceIfPossible(
scoped_refptr<SiteInstanceImpl> new_instance,
RenderFrameHostImpl* rfh) {
DCHECK(!new_instance->RequiresDedicatedProcess());
DCHECK(!new_instance->HasProcess());
RenderFrameHostImpl* root = rfh->GetMainFrame();
// Note: We explicitly don't use |RenderFrameHost::GetOutermostMainFrame()|
// here so as to not escape the portal boundary.
while (root->IsFencedFrameRoot()) {
root = root->GetParentOrOuterDocument()->GetMainFrame();
}
root->ForEachRenderFrameHostWithAction(
[site_instance = std::move(new_instance),
root](RenderFrameHostImpl* rfhi) {
if (rfhi->GetParent())
return RenderFrameHost::FrameIterationAction::kContinue;
// Avoid traversing through any embedded pages that aren't fenced
// frames. Note that we use rfhi->GetParentOrOuterDocumentOrEmbedder()
// instead of rfhi->GetParentOrOuterDocument() to avoid traversing
// through guests.
if (rfhi != root && rfhi->GetParentOrOuterDocumentOrEmbedder() &&
!rfhi->IsNestedWithinFencedFrame())
return RenderFrameHost::FrameIterationAction::kSkipChildren;
if (RenderProcessHost* default_process =
rfhi->GetSiteInstance()
->GetDefaultProcessForBrowsingInstance()) {
site_instance->ReuseExistingProcessIfPossible(default_process);
if (site_instance->HasProcess())
return RenderFrameHost::FrameIterationAction::kStop;
}
return RenderFrameHost::FrameIterationAction::kContinue;
});
}
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class ProcessPerSiteWithMainFrameThresholdBlockReason {
kNotBlocked = 0,
kDisableProcessResuse = 1,
kDevToolsWasEverAttached = 2,
kDoesNotRequireDedicatedProcess = 3,
kIsIpAddressOrLocalHost = 4,
kSchemeIsNotHttpOrHttps = 5,
kMaxValue = kSchemeIsNotHttpOrHttps,
};
void RecordProcessPerSiteWithMainFrameThresholdBlockReason(
ProcessPerSiteWithMainFrameThresholdBlockReason reason) {
base::UmaHistogramEnumeration(
"SiteIsolation.ProcessPerSiteWithMainFrameThreshold.BlockReason", reason);
}
// If `site_instance` is for a main frame, try to reuse an existing process
// when an experimental process-per-site-up-to-main-frame-threshold feature is
// enabled, subject to a threshold for the maximum number of main frames that
// the process can host.
void UpdateProcessReusePolicyForProcessPerSiteWithMainFrameThreshold(
SiteInstanceImpl* site_instance,
FrameTreeNode* frame_tree_node) {
if (!base::FeatureList::IsEnabled(
features::kProcessPerSiteUpToMainFrameThreshold)) {
return;
}
if (!frame_tree_node->IsOutermostMainFrame()) {
return;
}
if (base::FeatureList::IsEnabled(features::kDisableProcessReuse)) {
RecordProcessPerSiteWithMainFrameThresholdBlockReason(
ProcessPerSiteWithMainFrameThresholdBlockReason::kDisableProcessResuse);
return;
}
if (!features::kProcessPerSiteMainFrameAllowDevToolsAttached.Get() &&
RenderFrameDevToolsAgentHost::WasEverAttachedToAnyFrame()) {
RecordProcessPerSiteWithMainFrameThresholdBlockReason(
ProcessPerSiteWithMainFrameThresholdBlockReason::
kDevToolsWasEverAttached);
return;
}
if (!site_instance->RequiresDedicatedProcess()) {
RecordProcessPerSiteWithMainFrameThresholdBlockReason(
ProcessPerSiteWithMainFrameThresholdBlockReason::
kDoesNotRequireDedicatedProcess);
return;
}
// ProcessPerSite doesn't work well when DevTools is attached because DevTools
// assumes that there is only one main frame per renderer process
// (https://crbug.com/1449114). Localhost and IP based host names are a common
// target for DevTools to attach to. Exclude localhost and IP based host name
// for process reuse to work around the problem, unless a field parameter
// explicitly allows it.
const GURL& site_url = site_instance->GetSiteURL();
if (!features::kProcessPerSiteMainFrameAllowIPAndLocalhost.Get() &&
(site_url.HostIsIPAddress() || net::IsLocalHostname(site_url.host()))) {
RecordProcessPerSiteWithMainFrameThresholdBlockReason(
ProcessPerSiteWithMainFrameThresholdBlockReason::
kIsIpAddressOrLocalHost);
return;
}
// Disallow process reuse when scheme is not HTTP(S).
if (!site_url.SchemeIsHTTPOrHTTPS()) {
RecordProcessPerSiteWithMainFrameThresholdBlockReason(
ProcessPerSiteWithMainFrameThresholdBlockReason::
kSchemeIsNotHttpOrHttps);
return;
}
RecordProcessPerSiteWithMainFrameThresholdBlockReason(
ProcessPerSiteWithMainFrameThresholdBlockReason::kNotBlocked);
site_instance->set_process_reuse_policy(
SiteInstanceImpl::ProcessReusePolicy::
REUSE_PENDING_OR_COMMITTED_SITE_WITH_MAIN_FRAME_THRESHOLD);
}
// Prepares the View and the DelegatedFrameHost when the page is restored from
// BackForwardCache with a ViewTransition (VT) on it.
void PrepareViewTransitionForBFCacheActivation(
RenderFrameHostImpl* rfh_to_show) {
// https://crbug.com/1415340: The View that's about to be restored from
// BFCache has the fallback surface set to the last surface drawn before the
// page entered the BFCache. If the ViewTransition's animation is delayed
// (e.g., a renderer slow to produce a new frame), the last surface will be
// embedded and displayed first. We will be showing the fallback surface
// first, then then VT aimation, causing a visual glitch.
//
// To address this:
// 1. We force a new allocation group of the browser's `viz::LocalSurfaceId`
// allocator. This arg ensures Viz doesn't draw any cached frames produced
// by this restored page by changing its allocation group.
// 2. With a VT, we let BFCache-restored View always steal the
// fallback surface from the current View, and let the BFCached
// View's fallback content persist after `Show()`.
auto* rwhv_base =
static_cast<RenderWidgetHostViewBase*>(rfh_to_show->GetView());
// Invalidates the current allocation group. For the next surface embedding,
// the browser will be using a fresh allocation group, yet to be registered
// with Viz.
rwhv_base->InvalidateLocalSurfaceIdAndAllocationGroup();
// Clears the fallback Surface so later on this BFCached new
// View/DelegatedFrameHost with VT can take the fallback from the old page.
rwhv_base->ClearFallbackSurfaceForCommitPending();
// Marks the View/DelegatedFrameHost as evicted. This forces this new View to
// take a fallback from the old page. If there isn't a fallback surface,
// `ClearFallbackSurfaceForCommitPending` won't trigger an eviction. In such
// cases we explicitly mark the View as evicted to force the View to take a
// fallback. This seems to occur on Mac's content_shell.
rwhv_base->set_is_evicted();
}
} // namespace
RenderFrameHostManager::IsSameSiteGetter::IsSameSiteGetter()
: is_same_site_(absl::nullopt) {}
RenderFrameHostManager::IsSameSiteGetter::IsSameSiteGetter(bool is_same_site)
: is_same_site_(is_same_site) {}
bool RenderFrameHostManager::IsSameSiteGetter::Get(
const RenderFrameHostImpl& render_frame_host,
const UrlInfo& url_info) {
if (!is_same_site_.has_value()) {
is_same_site_ = render_frame_host.IsNavigationSameSite(url_info);
} else {
DCHECK_EQ(is_same_site_.value(),
render_frame_host.IsNavigationSameSite(url_info));
}
return is_same_site_.value();
}
RenderFrameHostManager::RenderFrameHostManager(FrameTreeNode* frame_tree_node,
Delegate* delegate)
: frame_tree_node_(frame_tree_node), delegate_(delegate) {
DCHECK(frame_tree_node_);
}
RenderFrameHostManager::~RenderFrameHostManager() {
DCHECK(!speculative_render_frame_host_);
// Ensure that proxies associated with pending delete BrowsingContextStates
// are deleted as well, otherwise these proxies outlive the FrameTreeNode.
for (const auto& pending_delete_host : pending_delete_hosts_) {
pending_delete_host->browsing_context_state()->ResetProxyHosts();
}
// If the current RenderFrameHost doesn't exist, then there is no need to
// destroy proxies, as they are only accessible via RenderFrameHost. This
// only occurs in MPArch activation, as frame trees are destroyed even when
// the root has no associated RenderFrameHost, specifically when
// RenderFrameHost has been moved during activation and the source
// FrameTreeNode is being destroyed.
if (!render_frame_host_) {
return;
}
// Delete any RenderFrameProxyHosts. It is important to delete those prior to
// deleting the current RenderFrameHost, since the CrossProcessFrameConnector
// (owned by RenderFrameProxyHost) points to the RenderWidgetHostView
// associated with the current RenderFrameHost and uses it during its
// destructor.
render_frame_host_->browsing_context_state()->ResetProxyHosts();
SetRenderFrameHost(nullptr);
}
void RenderFrameHostManager::InitRoot(
SiteInstanceImpl* site_instance,
bool renderer_initiated_creation,
blink::FramePolicy initial_main_frame_policy,
const std::string& name,
const base::UnguessableToken& devtools_frame_token) {
bool is_legacy_browsing_context_state_mode =
features::GetBrowsingContextMode() ==
features::BrowsingContextStateImplementationType::
kLegacyOneToOneWithFrameTreeNode;
scoped_refptr<BrowsingContextState> browsing_context_state =
base::MakeRefCounted<BrowsingContextState>(
blink::mojom::FrameReplicationState::New(
url::Origin(), name, "", blink::ParsedPermissionsPolicy(),
network::mojom::WebSandboxFlags::kNone, initial_main_frame_policy,
// should enforce strict mixed content checking
blink::mojom::InsecureRequestPolicy::kLeaveInsecureRequestsAlone,
// hashes of hosts for insecure request upgrades
std::vector<uint32_t>(),
false /* has_potentially_trustworthy_unique_origin */,
false /* has_active_user_gesture */,
false /* has_received_user_gesture_before_nav */,
false /* is_ad_frame */),
frame_tree_node_->parent(),
is_legacy_browsing_context_state_mode
? static_cast<absl::optional<BrowsingInstanceId>>(absl::nullopt)
: site_instance->GetBrowsingInstanceId(),
is_legacy_browsing_context_state_mode
? static_cast<absl::optional<base::UnguessableToken>>(
absl::nullopt)
: site_instance->coop_related_group_token());
browsing_context_state->CommitFramePolicy(initial_main_frame_policy);
browsing_context_state->SetFrameName(name, "");
UpdateProcessReusePolicyForProcessPerSiteWithMainFrameThreshold(
site_instance, frame_tree_node_);
SetRenderFrameHost(CreateRenderFrameHost(
CreateFrameCase::kInitRoot, site_instance,
/*frame_routing_id=*/MSG_ROUTING_NONE,
mojo::PendingAssociatedRemote<mojom::Frame>(), blink::LocalFrameToken(),
blink::DocumentToken(), devtools_frame_token, renderer_initiated_creation,
browsing_context_state));
// Creating a main RenderFrameHost also creates a new Page, so notify the
// delegate about this.
render_frame_host_->GetPage().NotifyPageBecameCurrent();
}
void RenderFrameHostManager::InitChild(
SiteInstanceImpl* site_instance,
int32_t frame_routing_id,
mojo::PendingAssociatedRemote<mojom::Frame> frame_remote,
const blink::LocalFrameToken& frame_token,
const blink::DocumentToken& document_token,
const base::UnguessableToken& devtools_frame_token,
blink::FramePolicy frame_policy,
std::string frame_name,
std::string frame_unique_name) {
bool is_legacy_browsing_context_state_mode =
features::GetBrowsingContextMode() ==
features::BrowsingContextStateImplementationType::
kLegacyOneToOneWithFrameTreeNode;
scoped_refptr<BrowsingContextState> browsing_context_state =
base::MakeRefCounted<BrowsingContextState>(
blink::mojom::FrameReplicationState::New(
url::Origin(), frame_name, frame_unique_name,
blink::ParsedPermissionsPolicy(),
network::mojom::WebSandboxFlags::kNone, frame_policy,
// should enforce strict mixed content checking
blink::mojom::InsecureRequestPolicy::kLeaveInsecureRequestsAlone,
// hashes of hosts for insecure request upgrades
std::vector<uint32_t>(),
false /* has_potentially_trustworthy_unique_origin */,
false /* has_active_user_gesture */,
false /* has_received_user_gesture_before_nav */,
false /* is_ad_frame */),
frame_tree_node_->parent(),
is_legacy_browsing_context_state_mode
? static_cast<absl::optional<BrowsingInstanceId>>(absl::nullopt)
: site_instance->GetBrowsingInstanceId(),
is_legacy_browsing_context_state_mode
? static_cast<absl::optional<base::UnguessableToken>>(
absl::nullopt)
: site_instance->coop_related_group_token());
browsing_context_state->CommitFramePolicy(frame_policy);
SetRenderFrameHost(CreateRenderFrameHost(
CreateFrameCase::kInitChild, site_instance, frame_routing_id,
std::move(frame_remote), frame_token, document_token,
devtools_frame_token,
/*renderer_initiated_creation=*/false, browsing_context_state));
}
RenderWidgetHostViewBase* RenderFrameHostManager::GetRenderWidgetHostView()
const {
if (render_frame_host_)
return static_cast<RenderWidgetHostViewBase*>(
render_frame_host_->GetView());
return nullptr;
}
bool RenderFrameHostManager::IsMainFrameForInnerDelegate() {
return frame_tree_node_->IsMainFrame() &&
frame_tree_node_->frame_tree()
.delegate()
->GetOuterDelegateFrameTreeNodeId() !=
FrameTreeNode::kFrameTreeNodeInvalidId;
}
FrameTreeNode* RenderFrameHostManager::GetOuterDelegateNode() const {
int outer_contents_frame_tree_node_id =
frame_tree_node_->frame_tree()
.delegate()
->GetOuterDelegateFrameTreeNodeId();
return FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id);
}
RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() {
if (frame_tree_node_->IsMainFrame())
return nullptr;
return frame_tree_node_->GetBrowsingContextStateForSubframe()
->GetRenderFrameProxyHost(
frame_tree_node_->parent()->GetSiteInstance()->group());
}
RenderFrameProxyHost* RenderFrameHostManager::GetProxyToOuterDelegate() {
// Only the main frame should be able to reach the outer WebContents.
DCHECK(frame_tree_node_->IsMainFrame());
FrameTreeNode* outer_contents_frame_tree_node = GetOuterDelegateNode();
if (!outer_contents_frame_tree_node ||
!outer_contents_frame_tree_node->parent()) {
return nullptr;
}
// We will create an outer delegate proxy in each BrowsingContextState in this
// frame so it doesn't matter which BCS is used here.
return render_frame_host_->browsing_context_state()->GetRenderFrameProxyHost(
outer_contents_frame_tree_node->parent()->GetSiteInstance()->group(),
BrowsingContextState::ProxyAccessMode::kAllowOuterDelegate);
}
RenderFrameProxyHost*
RenderFrameHostManager::GetProxyToParentOrOuterDelegate() {
return IsMainFrameForInnerDelegate() ? GetProxyToOuterDelegate()
: GetProxyToParent();
}
void RenderFrameHostManager::RemoveOuterDelegateFrame() {
// Removing the outer delegate frame will destroy the inner WebContents. This
// should only be called on the main frame.
DCHECK(frame_tree_node_->IsMainFrame());
FrameTreeNode* outer_delegate_frame_tree_node = GetOuterDelegateNode();
DCHECK(outer_delegate_frame_tree_node->parent());
outer_delegate_frame_tree_node->frame_tree().RemoveFrame(
outer_delegate_frame_tree_node);
}
void RenderFrameHostManager::Stop() {
render_frame_host_->Stop();
// A loading speculative RenderFrameHost should also stop.
if (speculative_render_frame_host_ &&
speculative_render_frame_host_->is_loading()) {
speculative_render_frame_host_->GetAssociatedLocalFrame()->StopLoading();
}
}
void RenderFrameHostManager::SetIsLoading(bool is_loading) {
render_frame_host_->render_view_host()->GetWidget()->SetIsLoading(is_loading);
}
void RenderFrameHostManager::BeforeUnloadCompleted(bool proceed) {
// If beforeunload was dispatched as part of preparing this frame for
// attaching an inner delegate, continue attaching now.
if (is_attaching_inner_delegate()) {
DCHECK(frame_tree_node_->parent());
if (proceed) {
CreateNewFrameForInnerDelegateAttachIfNecessary();
} else {
NotifyPrepareForInnerDelegateAttachComplete(false /* success */);
}
return;
}
bool proceed_to_fire_unload = false;
delegate_->BeforeUnloadFiredFromRenderManager(proceed,
&proceed_to_fire_unload);
if (proceed_to_fire_unload) {
// If we're about to close the tab and there's a speculative RFH, cancel it.
// Otherwise, if the navigation in the speculative RFH completes before the
// close in the current RFH, we'll lose the tab close.
// TODO(https://crbug.com/1406023): This condition may no longer be needed.
if (speculative_render_frame_host_) {
DiscardSpeculativeRFH(NavigationDiscardReason::kWillRemoveFrame);
}
// TODO(https://crbug.com/1406023): This is not always browser-initiated, so
// we should track whether the close is browser or renderer-initiated and
// use that here.
render_frame_host_->ClosePage(
RenderFrameHostImpl::ClosePageSource::kBrowser);
}
}
void RenderFrameHostManager::DidNavigateFrame(
RenderFrameHostImpl* render_frame_host,
bool was_caused_by_user_gesture,
bool is_same_document_navigation,
bool clear_proxies_on_commit,
const blink::FramePolicy& frame_policy) {
CommitPendingIfNecessary(render_frame_host, was_caused_by_user_gesture,
is_same_document_navigation,
clear_proxies_on_commit);
// Make sure any dynamic changes to this frame's sandbox flags and permissions
// policy that were made prior to navigation take effect. This should only
// happen for cross-document navigations.
if (!is_same_document_navigation) {
if (!render_frame_host->browsing_context_state()->CommitFramePolicy(
frame_policy)) {
// The frame policy didn't change, no need to send updates to proxies.
return;
}
// There should be no children of this frame; any policy changes should only
// happen on navigation commit which will delete any child frames.
DCHECK(!frame_tree_node_->child_count());
if (!frame_tree_node_->parent()) {
// Policy updates for root node happens only when the frame is a fenced
// frame root.
// Note: SendFramePolicyUpdatesToProxies doesn't need to be invoked for
// MPArch fenced frames, because the root fenced frame must use a static
// policy not to introduce a communication channel.
CHECK(frame_tree_node_->IsFencedFrameRoot());
} else {
render_frame_host_->browsing_context_state()
->SendFramePolicyUpdatesToProxies(
frame_tree_node_->parent()->GetSiteInstance()->group(),
frame_policy);
}
}
}
void RenderFrameHostManager::CommitPendingIfNecessary(
RenderFrameHostImpl* render_frame_host,
bool was_caused_by_user_gesture,
bool is_same_document_navigation,
bool clear_proxies_on_commit) {
if (!speculative_render_frame_host_) {
// There's no speculative RenderFrameHost so it must be that the current
// RenderFrameHost completed a navigation.
// TODO(danakj): Make this a CHECK and stop handling it. Then make it a
// DCHECK when we're sure.
DCHECK_EQ(render_frame_host_.get(), render_frame_host);
if (render_frame_host != render_frame_host_.get())
return;
}
if (render_frame_host == speculative_render_frame_host_.get()) {
// A cross-RenderFrameHost navigation completed, so show the new renderer.
CommitPending(std::move(speculative_render_frame_host_),
std::move(stored_page_to_restore_), clear_proxies_on_commit);
if (GetNavigationQueueingFeatureLevel() >=
NavigationQueueingFeatureLevel::kAvoidRedundantCancellations) {
// When avoiding redundant navigation cancellations, if there are other
// navigation requests that are ongoing, set their "associated
// RenderFrameHost type" NONE, as the old type may no longer be accurate:
// - If it was previously set to CURRENT, the current RenderFrameHost
// had already changed to the previously-speculative RenderFrameHost. It
// most likely will commit to a new speculative RenderFrameHost, but that
// doesn't exist yet and so we shouldn't change the type to SPECULATIVE.
// - If it was previously set to SPECULATIVE, the previously-speculative
// RenderFrameHost is no longer speculative. However we can't just set the
// type to CURRENT, as the navigation might actually want to create a new
// speculative RenderFrameHost too and not reuse the now-current RFH
// (e.g., with RenderDocument).
// A new "associated RenderFrameHost" type value will be recalculated when
// the navigation recalculates its RenderFrameHost either at
// StartNavigation (if it hasn't reached that stage yet) or ReadyToCommit
// time. Note that we don't update this value for pending commit
// navigations (and hence we only check the FrameTreeNode's
// NavigationRequest), as the value is only used until before the
// navigation gets to the "pending commit" stage.
if (frame_tree_node_->navigation_request()) {
frame_tree_node_->navigation_request()->SetAssociatedRFHType(
NavigationRequest::AssociatedRenderFrameHostType::NONE);
}
} else {
// Otherwise, if not attempting to avoid redundant cancellations, cancel
// any other navigations that are ongoing if they're not pending commit.
// Note that the pending commit navigations that are in the old RFH will
// get deleted when the old RFH gets unloaded.
frame_tree_node_->ResetNavigationRequest(
NavigationDiscardReason::kCommittedNavigation);
}
return;
}
// A same-RenderFrameHost navigation committed.
if (render_frame_host_->is_local_root() && render_frame_host_->GetView()) {
// RenderFrames are created with a hidden RenderWidgetHost. When
// navigation finishes, we show it if the delegate is shown. CommitPending()
// takes care of this in the cross-process case, as well as other cases
// where a RenderFrameHost is swapped in.
if (!frame_tree_node_->frame_tree().IsHidden())
render_frame_host_->GetView()->Show();
// TODO(crbug.com/1434403): For same RenderFrameHost, it isn't clear
// whether we should start the new content timer, but to be safe, we start
// it here. The TODO here is to remove this call when we can.
//
// Note that this is only OK to do for non-prerender. For prerendering path,
// setting this timeout is incorrect because it causes a clear of graphical
// output on prerender activation.
if (render_frame_host_->lifecycle_state() !=
LifecycleStateImpl::kPrerendering) {
static_cast<RenderWidgetHostImpl*>(
render_frame_host_->GetView()->GetRenderWidgetHost())
->StartNewContentRenderingTimeout();
}
}
// If we are navigating away from a Page that has a form data associated with
// it, record the metrics indicating that the Page was navigated away but
// wasn't eligible for BFCache. Note that the metrics recording for the
// cross-RFH case happens in RenderFrameHostManager::UnloadOldFrame().
// We only care about main frame cross-document navigation since those are
// the ones that can trigger BFCache.
if (!render_frame_host->GetParentOrOuterDocument() &&
!is_same_document_navigation) {
BackForwardCacheMetrics* metrics =
render_frame_host->GetBackForwardCacheMetrics();
if (metrics && metrics->had_form_data_associated()) {
UMA_HISTOGRAM_ENUMERATION(
kBackForwardCachePageWithFormStorableHistogramName,
BackForwardCacheMetrics::PageWithFormStorable::kPageSeen);
}
}
}
void RenderFrameHostManager::DidChangeOpener(
const absl::optional<blink::LocalFrameToken>& opener_frame_token,
SiteInstanceGroup* source_site_instance_group) {
FrameTreeNode* opener = nullptr;
if (opener_frame_token) {
RenderFrameHostImpl* opener_rfhi = RenderFrameHostImpl::FromFrameToken(
source_site_instance_group->process()->GetID(), *opener_frame_token);
// If |opener_rfhi| is null, the opener RFH has already disappeared. In
// this case, clear the opener rather than keeping the old opener around.
if (opener_rfhi)
opener = opener_rfhi->frame_tree_node();
}
if (frame_tree_node_->opener() == opener)
return;
frame_tree_node_->SetOpener(opener);
render_frame_host_->browsing_context_state()->UpdateOpener(
source_site_instance_group);
if (render_frame_host_->GetSiteInstance()->group() !=
source_site_instance_group) {
UpdateOpener(render_frame_host_.get());
}
// Notify the speculative RenderFrameHosts as well. This is necessary in case
// a process swap has started while the message was in flight.
if (speculative_render_frame_host_ &&
speculative_render_frame_host_->GetSiteInstance()->group() !=
source_site_instance_group) {
UpdateOpener(speculative_render_frame_host_.get());
}
}
std::unique_ptr<StoredPage> RenderFrameHostManager::TakePrerenderedPage() {
DCHECK(frame_tree_node_->IsMainFrame());
auto main_render_frame_host = SetRenderFrameHost(nullptr);
return CollectPage(std::move(main_render_frame_host));
}
void RenderFrameHostManager::PrepareForCollectingPage(
RenderFrameHostImpl* main_render_frame_host,
StoredPage::RenderViewHostImplSafeRefSet* render_view_hosts,
BrowsingContextState::RenderFrameProxyHostMap* proxy_hosts) {
TRACE_EVENT("navigation", "RenderFrameHostManager::PrepareForCollectingPage");
// We insert RenderViewHosts for all frames.
main_render_frame_host->ForEachRenderFrameHost([&](RenderFrameHostImpl* rfh) {
render_view_hosts->insert(rfh->render_view_host()->GetSafeRef());
if (rfh->is_main_frame()) {
for (auto& it : rfh->browsing_context_state()->proxy_hosts()) {
// This avoids including the proxy created when starting a
// new cross-process, cross-BrowsingInstance navigation, as well as any
// restored proxies which are also in a different BrowsingInstance.
if (rfh->GetSiteInstance()->group()->IsRelatedSiteInstanceGroup(
it.second->site_instance_group())) {
render_view_hosts->insert(
it.second->GetRenderViewHost()->GetSafeRef());
}
}
}
});
// When BrowsingContextState is decoupled from the FrameTreeNode and
// RenderFrameHostManager (legacy mode is disabled), proxies and
// replication state will be stored in a separate BrowsingContextState,
// which won't need any updates. However, RenderViewHosts are still stored
// in FrameTree (which, for example, is shared between the new page and
// the page entering BFCache), so they have to be collected explicitly above.
// Since proxies are not collected, we can return early here.
if (features::GetBrowsingContextMode() ==
features::BrowsingContextStateImplementationType::
kSwapForCrossBrowsingInstanceNavigations) {
return;
}
DCHECK_EQ(features::GetBrowsingContextMode(),
features::BrowsingContextStateImplementationType::
kLegacyOneToOneWithFrameTreeNode);
// Prepare the proxies.
SiteInstanceGroup* group = main_render_frame_host->GetSiteInstance()->group();
// Store the proxies only for main frame in the primary FrameTree because the
// FrameTreeNode gets reused for back/forward cache. It is not needed to
// store proxies for embedded main frames since each have their unique
// FrameTreeNode and their own BrowsingContextState.
for (auto& it :
main_render_frame_host->browsing_context_state()->proxy_hosts()) {
// This avoids including the proxy created when starting a
// new cross-process, cross-BrowsingInstance navigation, as well as any
// restored proxies which are also in a different BrowsingInstance.
if (group->IsRelatedSiteInstanceGroup(it.second->site_instance_group())) {
DCHECK(base::Contains(*render_view_hosts,
it.second->GetRenderViewHost()->GetSafeRef()));
(*proxy_hosts)[it.first] = std::move(it.second);
}
}
// Remove the previously extracted proxies from the
// RenderFrameHostManager, which also removes their respective
// SiteInstanceGroup::Observer.
for (auto& it : *proxy_hosts) {
main_render_frame_host->browsing_context_state()
->DeleteRenderFrameProxyHost(it.second->site_instance_group());
}
}
std::unique_ptr<StoredPage> RenderFrameHostManager::CollectPage(
std::unique_ptr<RenderFrameHostImpl> main_render_frame_host) {
DCHECK(main_render_frame_host->is_main_frame());
StoredPage::RenderViewHostImplSafeRefSet render_view_hosts;
BrowsingContextState::RenderFrameProxyHostMap proxy_hosts;
PrepareForCollectingPage(main_render_frame_host.get(), &render_view_hosts,
&proxy_hosts);
auto stored_page = std::make_unique<StoredPage>(
std::move(main_render_frame_host), std::move(proxy_hosts),
std::move(render_view_hosts));
return stored_page;
}
void RenderFrameHostManager::UpdateOpener(
RenderFrameHostImpl* render_frame_host) {
TRACE_EVENT1("navigation", "RenderFrameHostManager::UpdateOpener",
"render_frame_host", render_frame_host);
// `render_frame_host` (the frame whose opener is being updated) might not
// have had proxies for the new opener chain in its SiteInstance. Make sure
// they exist.