OLD | NEW |
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 "public/web/WebFrame.h" | 5 #include "public/web/WebFrame.h" |
6 | 6 |
7 #include "bindings/core/v8/WindowProxyManager.h" | 7 #include "bindings/core/v8/WindowProxyManager.h" |
8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
11 #include "core/frame/RemoteFrame.h" | 11 #include "core/frame/RemoteFrame.h" |
12 #include "core/html/HTMLFrameElementBase.h" | 12 #include "core/html/HTMLFrameElementBase.h" |
13 #include "core/html/HTMLFrameOwnerElement.h" | 13 #include "core/html/HTMLFrameOwnerElement.h" |
14 #include "core/page/Page.h" | 14 #include "core/page/Page.h" |
15 #include "platform/UserGestureIndicator.h" | 15 #include "platform/UserGestureIndicator.h" |
16 #include "platform/heap/Handle.h" | 16 #include "platform/heap/Handle.h" |
17 #include "public/web/WebElement.h" | 17 #include "public/web/WebElement.h" |
18 #include "public/web/WebFrameOwnerProperties.h" | 18 #include "public/web/WebFrameOwnerProperties.h" |
19 #include "public/web/WebSandboxFlags.h" | 19 #include "public/web/WebSandboxFlags.h" |
20 #include "web/OpenedFrameTracker.h" | 20 #include "web/OpenedFrameTracker.h" |
21 #include "web/RemoteBridgeFrameOwner.h" | 21 #include "web/RemoteFrameOwner.h" |
22 #include "web/WebLocalFrameImpl.h" | 22 #include "web/WebLocalFrameImpl.h" |
23 #include "web/WebRemoteFrameImpl.h" | 23 #include "web/WebRemoteFrameImpl.h" |
24 #include <algorithm> | 24 #include <algorithm> |
25 | 25 |
26 namespace blink { | 26 namespace blink { |
27 | 27 |
28 bool WebFrame::swap(WebFrame* frame) | 28 bool WebFrame::swap(WebFrame* frame) |
29 { | 29 { |
30 using std::swap; | 30 using std::swap; |
31 RefPtrWillBeRawPtr<Frame> oldFrame = toImplBase()->frame(); | 31 RefPtrWillBeRawPtr<Frame> oldFrame = toImplBase()->frame(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 if (m_opener) { | 65 if (m_opener) { |
66 frame->setOpener(m_opener); | 66 frame->setOpener(m_opener); |
67 setOpener(nullptr); | 67 setOpener(nullptr); |
68 } | 68 } |
69 m_openedFrameTracker->transferTo(frame); | 69 m_openedFrameTracker->transferTo(frame); |
70 | 70 |
71 FrameHost* host = oldFrame->host(); | 71 FrameHost* host = oldFrame->host(); |
72 AtomicString name = oldFrame->tree().name(); | 72 AtomicString name = oldFrame->tree().name(); |
73 AtomicString uniqueName = oldFrame->tree().uniqueName(); | 73 AtomicString uniqueName = oldFrame->tree().uniqueName(); |
74 FrameOwner* owner = oldFrame->owner(); | 74 FrameOwner* owner = oldFrame->owner(); |
| 75 #if !ENABLE(OILPAN) |
| 76 // Persistence of a remote frame owner is complicated in the pre-Oilpan |
| 77 // world. Please see RemoteFrameOwner::setContentFrame() for the details. |
| 78 RefPtr<RemoteFrameOwner> remoteOwnerProtector; |
| 79 if (owner && owner->isRemote()) |
| 80 remoteOwnerProtector = toRemoteFrameOwner(owner); |
| 81 #endif |
75 | 82 |
76 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 83 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
77 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; | 84 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; |
78 oldFrame->getWindowProxyManager()->clearForNavigation(); | 85 oldFrame->getWindowProxyManager()->clearForNavigation(); |
79 oldFrame->getWindowProxyManager()->releaseGlobals(globals); | 86 oldFrame->getWindowProxyManager()->releaseGlobals(globals); |
80 | 87 |
81 // Although the Document in this frame is now unloaded, many resources | 88 // Although the Document in this frame is now unloaded, many resources |
82 // associated with the frame itself have not yet been freed yet. | 89 // associated with the frame itself have not yet been freed yet. |
83 oldFrame->detach(FrameDetachType::Swap); | 90 oldFrame->detach(FrameDetachType::Swap); |
84 | 91 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return WebSecurityOrigin(toImplBase()->frame()->securityContext()->getSecuri
tyOrigin()); | 129 return WebSecurityOrigin(toImplBase()->frame()->securityContext()->getSecuri
tyOrigin()); |
123 } | 130 } |
124 | 131 |
125 | 132 |
126 void WebFrame::setFrameOwnerSandboxFlags(WebSandboxFlags flags) | 133 void WebFrame::setFrameOwnerSandboxFlags(WebSandboxFlags flags) |
127 { | 134 { |
128 // At the moment, this is only used to replicate sandbox flags | 135 // At the moment, this is only used to replicate sandbox flags |
129 // for frames with a remote owner. | 136 // for frames with a remote owner. |
130 FrameOwner* owner = toImplBase()->frame()->owner(); | 137 FrameOwner* owner = toImplBase()->frame()->owner(); |
131 ASSERT(owner); | 138 ASSERT(owner); |
132 toRemoteBridgeFrameOwner(owner)->setSandboxFlags(static_cast<SandboxFlags>(f
lags)); | 139 toRemoteFrameOwner(owner)->setSandboxFlags(static_cast<SandboxFlags>(flags))
; |
133 } | 140 } |
134 | 141 |
135 bool WebFrame::shouldEnforceStrictMixedContentChecking() const | 142 bool WebFrame::shouldEnforceStrictMixedContentChecking() const |
136 { | 143 { |
137 return toImplBase()->frame()->securityContext()->shouldEnforceStrictMixedCon
tentChecking(); | 144 return toImplBase()->frame()->securityContext()->shouldEnforceStrictMixedCon
tentChecking(); |
138 } | 145 } |
139 | 146 |
140 WebFrame* WebFrame::opener() const | 147 WebFrame* WebFrame::opener() const |
141 { | 148 { |
142 return m_opener; | 149 return m_opener; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ | 364 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ |
358 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } | 365 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } |
359 | 366 |
360 DEFINE_VISITOR_METHOD(Visitor*) | 367 DEFINE_VISITOR_METHOD(Visitor*) |
361 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) | 368 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) |
362 | 369 |
363 #undef DEFINE_VISITOR_METHOD | 370 #undef DEFINE_VISITOR_METHOD |
364 #endif | 371 #endif |
365 | 372 |
366 } // namespace blink | 373 } // namespace blink |
OLD | NEW |