| 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 "config.h" | 5 #include "config.h" |
| 6 #include "public/web/WebFrame.h" | 6 #include "public/web/WebFrame.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/WindowProxyManager.h" | 8 #include "bindings/core/v8/WindowProxyManager.h" |
| 9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| 11 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
| 12 #include "core/frame/RemoteFrame.h" | 12 #include "core/frame/RemoteFrame.h" |
| 13 #include "core/html/HTMLFrameElementBase.h" | 13 #include "core/html/HTMLFrameElementBase.h" |
| 14 #include "core/html/HTMLFrameOwnerElement.h" | 14 #include "core/html/HTMLFrameOwnerElement.h" |
| 15 #include "core/page/Page.h" | 15 #include "core/page/Page.h" |
| 16 #include "platform/UserGestureIndicator.h" | 16 #include "platform/UserGestureIndicator.h" |
| 17 #include "platform/heap/Handle.h" | 17 #include "platform/heap/Handle.h" |
| 18 #include "public/web/WebElement.h" | 18 #include "public/web/WebElement.h" |
| 19 #include "public/web/WebKit.h" |
| 19 #include "public/web/WebSandboxFlags.h" | 20 #include "public/web/WebSandboxFlags.h" |
| 20 #include "web/OpenedFrameTracker.h" | 21 #include "web/OpenedFrameTracker.h" |
| 21 #include "web/RemoteBridgeFrameOwner.h" | 22 #include "web/RemoteBridgeFrameOwner.h" |
| 22 #include "web/WebLocalFrameImpl.h" | 23 #include "web/WebLocalFrameImpl.h" |
| 23 #include "web/WebRemoteFrameImpl.h" | 24 #include "web/WebRemoteFrameImpl.h" |
| 24 #include <algorithm> | 25 #include <algorithm> |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 28 Frame* toCoreFrame(const WebFrame* frame) | 29 Frame* toCoreFrame(const WebFrame* frame) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 frame->setOpener(m_opener); | 78 frame->setOpener(m_opener); |
| 78 setOpener(nullptr); | 79 setOpener(nullptr); |
| 79 } | 80 } |
| 80 m_openedFrameTracker->transferTo(frame); | 81 m_openedFrameTracker->transferTo(frame); |
| 81 | 82 |
| 82 FrameHost* host = oldFrame->host(); | 83 FrameHost* host = oldFrame->host(); |
| 83 AtomicString name = oldFrame->tree().name(); | 84 AtomicString name = oldFrame->tree().name(); |
| 84 FrameOwner* owner = oldFrame->owner(); | 85 FrameOwner* owner = oldFrame->owner(); |
| 85 oldFrame->disconnectOwnerElement(); | 86 oldFrame->disconnectOwnerElement(); |
| 86 | 87 |
| 87 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | |
| 88 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; | |
| 89 oldFrame->windowProxyManager()->clearForNavigation(); | |
| 90 oldFrame->windowProxyManager()->releaseGlobals(globals); | |
| 91 | |
| 92 // Although the Document in this frame is now unloaded, many resources | 88 // Although the Document in this frame is now unloaded, many resources |
| 93 // associated with the frame itself have not yet been freed yet. | 89 // associated with the frame itself have not yet been freed yet. |
| 94 oldFrame->detach(FrameDetachType::Swap); | 90 oldFrame->detach(FrameDetachType::Swap); |
| 95 | 91 |
| 92 v8::HandleScope handleScope(mainThreadIsolate()); |
| 93 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; |
| 94 oldFrame->windowProxyManager()->releaseGlobals(globals); |
| 95 |
| 96 // Finally, clone the state of the current Frame into one matching | 96 // Finally, clone the state of the current Frame into one matching |
| 97 // the type of the passed in WebFrame. | 97 // the type of the passed in WebFrame. |
| 98 // FIXME: This is a bit clunky; this results in pointless decrements and | 98 // FIXME: This is a bit clunky; this results in pointless decrements and |
| 99 // increments of connected subframes. | 99 // increments of connected subframes. |
| 100 if (frame->isWebLocalFrame()) { | 100 if (frame->isWebLocalFrame()) { |
| 101 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame(); | 101 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame(); |
| 102 ASSERT(owner == localFrame.owner()); | 102 ASSERT(owner == localFrame.owner()); |
| 103 if (owner) { | 103 if (owner) { |
| 104 if (owner->isLocal()) { | 104 if (owner->isLocal()) { |
| 105 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(ow
ner); | 105 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(ow
ner); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ | 355 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ |
| 356 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } | 356 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } |
| 357 | 357 |
| 358 DEFINE_VISITOR_METHOD(Visitor*) | 358 DEFINE_VISITOR_METHOD(Visitor*) |
| 359 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) | 359 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) |
| 360 | 360 |
| 361 #undef DEFINE_VISITOR_METHOD | 361 #undef DEFINE_VISITOR_METHOD |
| 362 #endif | 362 #endif |
| 363 | 363 |
| 364 } // namespace blink | 364 } // namespace blink |
| OLD | NEW |