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

Unified Diff: Source/web/WebRemoteFrameImpl.cpp

Issue 793493003: Prepare to replicate sandbox flags for OOPIF (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Second round of dcheng's comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebRemoteFrameImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebRemoteFrameImpl.cpp
diff --git a/Source/web/WebRemoteFrameImpl.cpp b/Source/web/WebRemoteFrameImpl.cpp
index 243653e6db2035b4655ef44a8a35df25d5004d20..d06b510b246c92fa65573bebdfc337034905cd59 100644
--- a/Source/web/WebRemoteFrameImpl.cpp
+++ b/Source/web/WebRemoteFrameImpl.cpp
@@ -31,25 +31,40 @@ namespace {
class RemoteBridgeFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<RemoteBridgeFrameOwner>, public FrameOwner {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner);
public:
- static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame)
+ static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags)
{
- return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame));
+ return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags));
+ }
+
+ virtual bool isLocal() const override
+ {
+ return false;
+ }
+
+ virtual SandboxFlags sandboxFlags() const override
+ {
+ return m_sandboxFlags;
+ }
+
+ void setSandboxFlags(SandboxFlags flags)
+ {
+ m_sandboxFlags = flags;
}
- virtual bool isLocal() const override;
- virtual SandboxFlags sandboxFlags() const override;
virtual void dispatchLoad() override;
virtual void trace(Visitor*);
private:
- explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>);
+ explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, SandboxFlags);
RefPtrWillBeMember<WebLocalFrameImpl> m_frame;
+ SandboxFlags m_sandboxFlags;
};
-RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame)
+RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags)
: m_frame(frame)
+ , m_sandboxFlags(flags)
{
}
@@ -59,17 +74,6 @@ void RemoteBridgeFrameOwner::trace(Visitor* visitor)
FrameOwner::trace(visitor);
}
-bool RemoteBridgeFrameOwner::isLocal() const
-{
- return false;
-}
-
-SandboxFlags RemoteBridgeFrameOwner::sandboxFlags() const
-{
- // FIXME: Implement. Most likely grab it from m_frame.
- return 0;
-}
-
void RemoteBridgeFrameOwner::dispatchLoad()
{
// FIXME: Implement. Most likely goes through m_frame->client().
@@ -794,11 +798,17 @@ WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const
return WebString();
}
+// FIXME(alexmos): This will go away once the Chromium side is updated to pass sandbox flags.
WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFrameClient* client)
{
+ return createLocalChild(name, WebSandboxFlags::None, client);
+}
+
+WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebSandboxFlags sandboxFlags, WebFrameClient* client)
+{
WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client));
- WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult result =
- m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child));
+ WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult result =
+ m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, static_cast<SandboxFlags>(sandboxFlags)));
appendChild(child);
// FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may
// result in the browser observing two navigations to about:blank (one from the initial
@@ -854,6 +864,12 @@ void WebRemoteFrameImpl::setReplicatedOrigin(const WebSecurityOrigin& origin) co
frame()->securityContext()->setReplicatedOrigin(origin);
}
+void WebRemoteFrameImpl::setReplicatedSandboxFlags(WebSandboxFlags flags) const
+{
+ ASSERT(frame());
+ frame()->securityContext()->enforceSandboxFlags(static_cast<SandboxFlags>(flags));
+}
+
void WebRemoteFrameImpl::didStartLoading()
{
frame()->setIsLoading(true);
« no previous file with comments | « Source/web/WebRemoteFrameImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698