Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1685003002: Plumb the correct owner document through DocumentInit::m_owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 return NULL; 805 return NULL;
806 } 806 }
807 807
808 // static 808 // static
809 RenderFrameImpl* RenderFrameImpl::CreateMainFrame( 809 RenderFrameImpl* RenderFrameImpl::CreateMainFrame(
810 RenderViewImpl* render_view, 810 RenderViewImpl* render_view,
811 int32_t routing_id, 811 int32_t routing_id,
812 int32_t widget_routing_id, 812 int32_t widget_routing_id,
813 bool hidden, 813 bool hidden,
814 const blink::WebScreenInfo& screen_info, 814 const blink::WebScreenInfo& screen_info,
815 CompositorDependencies* compositor_deps) { 815 CompositorDependencies* compositor_deps,
816 blink::WebFrame* opener) {
816 // A main frame RenderFrame must have a RenderWidget. 817 // A main frame RenderFrame must have a RenderWidget.
817 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id); 818 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id);
818 819
819 RenderFrameImpl* render_frame = 820 RenderFrameImpl* render_frame =
820 RenderFrameImpl::Create(render_view, routing_id); 821 RenderFrameImpl::Create(render_view, routing_id);
821 WebLocalFrame* web_frame = 822 WebLocalFrame* web_frame = WebLocalFrame::create(
822 WebLocalFrame::create(blink::WebTreeScopeType::Document, render_frame); 823 blink::WebTreeScopeType::Document, render_frame, opener);
823 render_frame->BindToWebFrame(web_frame); 824 render_frame->BindToWebFrame(web_frame);
824 render_view->webview()->setMainFrame(web_frame); 825 render_view->webview()->setMainFrame(web_frame);
825 render_frame->render_widget_ = RenderWidget::CreateForFrame( 826 render_frame->render_widget_ = RenderWidget::CreateForFrame(
826 widget_routing_id, hidden, screen_info, compositor_deps, web_frame); 827 widget_routing_id, hidden, screen_info, compositor_deps, web_frame);
827 // TODO(kenrb): Observing shouldn't be necessary when we sort out 828 // TODO(kenrb): Observing shouldn't be necessary when we sort out
828 // WasShown and WasHidden, separating page-level visibility from 829 // WasShown and WasHidden, separating page-level visibility from
829 // frame-level visibility. 830 // frame-level visibility.
830 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684 831 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684
831 DCHECK_EQ(render_view, render_frame->render_widget_) 832 DCHECK_EQ(render_view, render_frame->render_widget_)
832 << "Main frame is no longer reusing the RenderView as its widget! " 833 << "Main frame is no longer reusing the RenderView as its widget! "
(...skipping 28 matching lines...) Expand all
861 if (previous_sibling_proxy) 862 if (previous_sibling_proxy)
862 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 863 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
863 864
864 // Create the RenderFrame and WebLocalFrame, linking the two. 865 // Create the RenderFrame and WebLocalFrame, linking the two.
865 render_frame = 866 render_frame =
866 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 867 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
867 web_frame = parent_web_frame->createLocalChild( 868 web_frame = parent_web_frame->createLocalChild(
868 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 869 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
869 WebString::fromUTF8(replicated_state.unique_name), 870 WebString::fromUTF8(replicated_state.unique_name),
870 replicated_state.sandbox_flags, render_frame, 871 replicated_state.sandbox_flags, render_frame,
871 previous_sibling_web_frame, frame_owner_properties); 872 previous_sibling_web_frame, frame_owner_properties,
873 ResolveOpener(opener_routing_id, nullptr));
872 874
873 // The RenderFrame is created and inserted into the frame tree in the above 875 // The RenderFrame is created and inserted into the frame tree in the above
874 // call to createLocalChild. 876 // call to createLocalChild.
875 render_frame->in_frame_tree_ = true; 877 render_frame->in_frame_tree_ = true;
876 } else { 878 } else {
877 RenderFrameProxy* proxy = 879 RenderFrameProxy* proxy =
878 RenderFrameProxy::FromRoutingID(proxy_routing_id); 880 RenderFrameProxy::FromRoutingID(proxy_routing_id);
879 // The remote frame could've been detached while the remote-to-local 881 // The remote frame could've been detached while the remote-to-local
880 // navigation was being initiated in the browser process. Drop the 882 // navigation was being initiated in the browser process. Drop the
881 // navigation and don't create the frame in that case. See 883 // navigation and don't create the frame in that case. See
882 // https://crbug.com/526304. 884 // https://crbug.com/526304.
883 if (!proxy) 885 if (!proxy)
884 return; 886 return;
885 887
886 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 888 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
887 render_frame->proxy_routing_id_ = proxy_routing_id; 889 render_frame->proxy_routing_id_ = proxy_routing_id;
888 web_frame = blink::WebLocalFrame::createProvisional( 890 web_frame = blink::WebLocalFrame::createProvisional(
889 render_frame, proxy->web_frame(), replicated_state.sandbox_flags, 891 render_frame, proxy->web_frame(), replicated_state.sandbox_flags,
890 frame_owner_properties); 892 frame_owner_properties);
891 } 893 }
892 render_frame->BindToWebFrame(web_frame); 894 render_frame->BindToWebFrame(web_frame);
893 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent()); 895 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent());
894 896
895 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
896 web_frame->setOpener(opener);
897
898 if (widget_params.routing_id != MSG_ROUTING_NONE) { 897 if (widget_params.routing_id != MSG_ROUTING_NONE) {
899 CHECK(!web_frame->parent() || 898 CHECK(!web_frame->parent() ||
900 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 899 SiteIsolationPolicy::AreCrossProcessFramesPossible());
901 render_frame->render_widget_ = RenderWidget::CreateForFrame( 900 render_frame->render_widget_ = RenderWidget::CreateForFrame(
902 widget_params.routing_id, widget_params.hidden, 901 widget_params.routing_id, widget_params.hidden,
903 render_frame->render_view_->screen_info(), compositor_deps, web_frame); 902 render_frame->render_view_->screen_info(), compositor_deps, web_frame);
904 // TODO(avi): The main frame re-uses the RenderViewImpl as its widget, so 903 // TODO(avi): The main frame re-uses the RenderViewImpl as its widget, so
905 // avoid double-registering the frame as an observer. 904 // avoid double-registering the frame as an observer.
906 // https://crbug.com/545684 905 // https://crbug.com/545684
907 if (web_frame->parent()) { 906 if (web_frame->parent()) {
(...skipping 5194 matching lines...) Expand 10 before | Expand all | Expand 10 after
6102 int match_count, 6101 int match_count,
6103 int ordinal, 6102 int ordinal,
6104 const WebRect& selection_rect, 6103 const WebRect& selection_rect,
6105 bool final_status_update) { 6104 bool final_status_update) {
6106 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6105 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6107 selection_rect, ordinal, 6106 selection_rect, ordinal,
6108 final_status_update)); 6107 final_status_update));
6109 } 6108 }
6110 6109
6111 } // namespace content 6110 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698