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

Side by Side Diff: Source/web/WebRemoteFrameImpl.cpp

Issue 838903002: Replicate sandbox flags for OOPIF (Blink part 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@iframe-sandbox-flags-part1
Patch Set: Remove old createLocalChild Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "web/WebRemoteFrameImpl.h" 6 #include "web/WebRemoteFrameImpl.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/RemoteFrame.h" 9 #include "core/frame/RemoteFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 23 matching lines...) Expand all
34 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB eRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags) 34 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB eRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags)
35 { 35 {
36 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags)); 36 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags));
37 } 37 }
38 38
39 virtual bool isLocal() const override 39 virtual bool isLocal() const override
40 { 40 {
41 return false; 41 return false;
42 } 42 }
43 43
44 virtual SandboxFlags sandboxFlags() const override 44 virtual SandboxFlags sandboxFlags() const override;
45 {
46 return m_sandboxFlags;
47 }
48 45
49 void setSandboxFlags(SandboxFlags flags) 46 void setSandboxFlags(SandboxFlags flags)
50 { 47 {
51 m_sandboxFlags = flags; 48 m_sandboxFlags = flags;
52 } 49 }
53 50
54 virtual void dispatchLoad() override; 51 virtual void dispatchLoad() override;
55 52
56 virtual void trace(Visitor*); 53 virtual void trace(Visitor*);
57 54
58 private: 55 private:
59 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, S andboxFlags); 56 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, S andboxFlags);
60 57
61 RefPtrWillBeMember<WebLocalFrameImpl> m_frame; 58 RefPtrWillBeMember<WebLocalFrameImpl> m_frame;
62 SandboxFlags m_sandboxFlags; 59 SandboxFlags m_sandboxFlags;
63 }; 60 };
64 61
65 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFr ameImpl> frame, SandboxFlags flags) 62 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFr ameImpl> frame, SandboxFlags flags)
66 : m_frame(frame) 63 : m_frame(frame)
67 , m_sandboxFlags(flags) 64 , m_sandboxFlags(flags)
68 { 65 {
69 } 66 }
70 67
68 SandboxFlags RemoteBridgeFrameOwner::sandboxFlags() const
69 {
70 SandboxFlags flags = m_sandboxFlags;
71 // Frames need to inherit the sandbox flags of their parent frame.
dcheng 2015/01/16 19:11:19 It this covered by any of our current tests?
alexmos 2015/01/17 02:54:42 LayoutTests/http/tests/security/sandbox-inherit-to
72 Frame* parentFrame = m_frame->frame()->tree().parent();
73 if (parentFrame) {
74 ASSERT(parentFrame->isRemoteFrame());
75 flags |= toRemoteFrame(parentFrame)->securityContext()->sandboxFlags();
76 }
77 return flags;
78 }
79
71 void RemoteBridgeFrameOwner::trace(Visitor* visitor) 80 void RemoteBridgeFrameOwner::trace(Visitor* visitor)
72 { 81 {
73 visitor->trace(m_frame); 82 visitor->trace(m_frame);
74 FrameOwner::trace(visitor); 83 FrameOwner::trace(visitor);
75 } 84 }
76 85
77 void RemoteBridgeFrameOwner::dispatchLoad() 86 void RemoteBridgeFrameOwner::dispatchLoad()
78 { 87 {
79 // FIXME: Implement. Most likely goes through m_frame->client(). 88 // FIXME: Implement. Most likely goes through m_frame->client().
80 } 89 }
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 ASSERT_NOT_REACHED(); 800 ASSERT_NOT_REACHED();
792 return false; 801 return false;
793 } 802 }
794 803
795 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const 804 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const
796 { 805 {
797 ASSERT_NOT_REACHED(); 806 ASSERT_NOT_REACHED();
798 return WebString(); 807 return WebString();
799 } 808 }
800 809
801 // FIXME(alexmos): This will go away once the Chromium side is updated to pass s andbox flags.
802 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFr ameClient* client)
803 {
804 return createLocalChild(name, WebSandboxFlags::None, client);
805 }
806
807 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebSa ndboxFlags sandboxFlags, WebFrameClient* client) 810 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebSa ndboxFlags sandboxFlags, WebFrameClient* client)
808 { 811 {
809 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) ); 812 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client) );
810 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult res ult = 813 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult res ult =
811 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta tic_cast<SandboxFlags>(sandboxFlags))); 814 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta tic_cast<SandboxFlags>(sandboxFlags)));
812 appendChild(child); 815 appendChild(child);
813 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may 816 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may
814 // result in the browser observing two navigations to about:blank (one from the initial 817 // result in the browser observing two navigations to about:blank (one from the initial
815 // frame creation, and one from swapping it into the remote process). FrameL oader might 818 // frame creation, and one from swapping it into the remote process). FrameL oader might
816 // need a special initialization function for this case to avoid that duplic ate navigation. 819 // need a special initialization function for this case to avoid that duplic ate navigation.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 { 882 {
880 frame()->setIsLoading(false); 883 frame()->setIsLoading(false);
881 if (parent() && parent()->isWebLocalFrame()) { 884 if (parent() && parent()->isWebLocalFrame()) {
882 WebLocalFrameImpl* parentFrame = 885 WebLocalFrameImpl* parentFrame =
883 toWebLocalFrameImpl(parent()->toWebLocalFrame()); 886 toWebLocalFrameImpl(parent()->toWebLocalFrame());
884 parentFrame->frame()->loader().checkCompleted(); 887 parentFrame->frame()->loader().checkCompleted();
885 } 888 }
886 } 889 }
887 890
888 } // namespace blink 891 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698