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

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: Trim thingie Created 4 years, 10 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 return NULL; 802 return NULL;
803 } 803 }
804 804
805 // static 805 // static
806 RenderFrameImpl* RenderFrameImpl::CreateMainFrame( 806 RenderFrameImpl* RenderFrameImpl::CreateMainFrame(
807 RenderViewImpl* render_view, 807 RenderViewImpl* render_view,
808 int32_t routing_id, 808 int32_t routing_id,
809 int32_t widget_routing_id, 809 int32_t widget_routing_id,
810 bool hidden, 810 bool hidden,
811 const blink::WebScreenInfo& screen_info, 811 const blink::WebScreenInfo& screen_info,
812 CompositorDependencies* compositor_deps) { 812 CompositorDependencies* compositor_deps,
813 blink::WebFrame* opener) {
813 // A main frame RenderFrame must have a RenderWidget. 814 // A main frame RenderFrame must have a RenderWidget.
814 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id); 815 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id);
815 816
816 RenderFrameImpl* render_frame = 817 RenderFrameImpl* render_frame =
817 RenderFrameImpl::Create(render_view, routing_id); 818 RenderFrameImpl::Create(render_view, routing_id);
818 WebLocalFrame* web_frame = 819 WebLocalFrame* web_frame = WebLocalFrame::create(
819 WebLocalFrame::create(blink::WebTreeScopeType::Document, render_frame); 820 blink::WebTreeScopeType::Document, render_frame, opener);
820 render_frame->BindToWebFrame(web_frame); 821 render_frame->BindToWebFrame(web_frame);
821 render_view->webview()->setMainFrame(web_frame); 822 render_view->webview()->setMainFrame(web_frame);
822 render_frame->render_widget_ = RenderWidget::CreateForFrame( 823 render_frame->render_widget_ = RenderWidget::CreateForFrame(
823 widget_routing_id, hidden, screen_info, compositor_deps, web_frame); 824 widget_routing_id, hidden, screen_info, compositor_deps, web_frame);
824 // TODO(kenrb): Observing shouldn't be necessary when we sort out 825 // TODO(kenrb): Observing shouldn't be necessary when we sort out
825 // WasShown and WasHidden, separating page-level visibility from 826 // WasShown and WasHidden, separating page-level visibility from
826 // frame-level visibility. 827 // frame-level visibility.
827 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684 828 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684
828 DCHECK_EQ(render_view, render_frame->render_widget_) 829 DCHECK_EQ(render_view, render_frame->render_widget_)
829 << "Main frame is no longer reusing the RenderView as its widget! " 830 << "Main frame is no longer reusing the RenderView as its widget! "
(...skipping 28 matching lines...) Expand all
858 if (previous_sibling_proxy) 859 if (previous_sibling_proxy)
859 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 860 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
860 861
861 // Create the RenderFrame and WebLocalFrame, linking the two. 862 // Create the RenderFrame and WebLocalFrame, linking the two.
862 render_frame = 863 render_frame =
863 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 864 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
864 web_frame = parent_web_frame->createLocalChild( 865 web_frame = parent_web_frame->createLocalChild(
865 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 866 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
866 WebString::fromUTF8(replicated_state.unique_name), 867 WebString::fromUTF8(replicated_state.unique_name),
867 replicated_state.sandbox_flags, render_frame, 868 replicated_state.sandbox_flags, render_frame,
868 previous_sibling_web_frame, frame_owner_properties); 869 previous_sibling_web_frame, frame_owner_properties,
870 ResolveOpener(opener_routing_id, nullptr));
869 871
870 // The RenderFrame is created and inserted into the frame tree in the above 872 // The RenderFrame is created and inserted into the frame tree in the above
871 // call to createLocalChild. 873 // call to createLocalChild.
872 render_frame->in_frame_tree_ = true; 874 render_frame->in_frame_tree_ = true;
873 } else { 875 } else {
874 RenderFrameProxy* proxy = 876 RenderFrameProxy* proxy =
875 RenderFrameProxy::FromRoutingID(proxy_routing_id); 877 RenderFrameProxy::FromRoutingID(proxy_routing_id);
876 // The remote frame could've been detached while the remote-to-local 878 // The remote frame could've been detached while the remote-to-local
877 // navigation was being initiated in the browser process. Drop the 879 // navigation was being initiated in the browser process. Drop the
878 // navigation and don't create the frame in that case. See 880 // navigation and don't create the frame in that case. See
879 // https://crbug.com/526304. 881 // https://crbug.com/526304.
880 if (!proxy) 882 if (!proxy)
881 return; 883 return;
882 884
883 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 885 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
884 render_frame->proxy_routing_id_ = proxy_routing_id; 886 render_frame->proxy_routing_id_ = proxy_routing_id;
885 web_frame = blink::WebLocalFrame::createProvisional( 887 web_frame = blink::WebLocalFrame::createProvisional(
886 render_frame, proxy->web_frame(), replicated_state.sandbox_flags, 888 render_frame, proxy->web_frame(), replicated_state.sandbox_flags,
887 frame_owner_properties); 889 frame_owner_properties);
888 } 890 }
889 render_frame->BindToWebFrame(web_frame); 891 render_frame->BindToWebFrame(web_frame);
890 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent()); 892 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent());
891 893
892 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
893 web_frame->setOpener(opener);
894
895 if (widget_params.routing_id != MSG_ROUTING_NONE) { 894 if (widget_params.routing_id != MSG_ROUTING_NONE) {
896 CHECK(!web_frame->parent() || 895 CHECK(!web_frame->parent() ||
897 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 896 SiteIsolationPolicy::AreCrossProcessFramesPossible());
898 render_frame->render_widget_ = RenderWidget::CreateForFrame( 897 render_frame->render_widget_ = RenderWidget::CreateForFrame(
899 widget_params.routing_id, widget_params.hidden, 898 widget_params.routing_id, widget_params.hidden,
900 render_frame->render_view_->screen_info(), compositor_deps, web_frame); 899 render_frame->render_view_->screen_info(), compositor_deps, web_frame);
901 // TODO(avi): The main frame re-uses the RenderViewImpl as its widget, so 900 // TODO(avi): The main frame re-uses the RenderViewImpl as its widget, so
902 // avoid double-registering the frame as an observer. 901 // avoid double-registering the frame as an observer.
903 // https://crbug.com/545684 902 // https://crbug.com/545684
904 if (web_frame->parent()) { 903 if (web_frame->parent()) {
(...skipping 5195 matching lines...) Expand 10 before | Expand all | Expand 10 after
6100 int match_count, 6099 int match_count,
6101 int ordinal, 6100 int ordinal,
6102 const WebRect& selection_rect, 6101 const WebRect& selection_rect,
6103 bool final_status_update) { 6102 bool final_status_update) {
6104 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6103 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6105 selection_rect, ordinal, 6104 selection_rect, ordinal,
6106 final_status_update)); 6105 final_status_update));
6107 } 6106 }
6108 6107
6109 } // namespace content 6108 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698