Index: Source/core/html/HTMLFrameOwnerElement.cpp |
diff --git a/Source/core/html/HTMLFrameOwnerElement.cpp b/Source/core/html/HTMLFrameOwnerElement.cpp |
index edb7c18db47b899badc30898c4e6725d7d9f0844..c2efef77766d987f4684411c7598c2d6627f4d5f 100644 |
--- a/Source/core/html/HTMLFrameOwnerElement.cpp |
+++ b/Source/core/html/HTMLFrameOwnerElement.cpp |
@@ -26,6 +26,7 @@ |
#include "core/accessibility/AXObjectCache.h" |
#include "core/dom/ExceptionCode.h" |
#include "core/events/Event.h" |
+#include "core/frame/FrameProtector.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
#include "core/loader/FrameLoader.h" |
@@ -98,7 +99,7 @@ static void moveWidgetToParentSoon(Widget* child, FrameView* parent) |
HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Document& document) |
: HTMLElement(tagName, document) |
- , m_contentFrame(0) |
+ , m_contentFrame(nullptr) |
, m_widget(nullptr) |
, m_sandboxFlags(SandboxNone) |
{ |
@@ -130,7 +131,7 @@ void HTMLFrameOwnerElement::clearContentFrame() |
if (!m_contentFrame) |
return; |
- m_contentFrame = 0; |
+ m_contentFrame = nullptr; |
for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()) |
node->decrementConnectedSubframeCount(); |
@@ -143,7 +144,7 @@ void HTMLFrameOwnerElement::disconnectContentFrame() |
// reach up into this document and then attempt to look back down. We should |
// see if this behavior is really needed as Gecko does not allow this. |
if (Frame* frame = contentFrame()) { |
- RefPtr<Frame> protect(frame); |
+ FrameProtector protect(frame); |
frame->detach(); |
frame->disconnectOwnerElement(); |
} |
@@ -151,8 +152,14 @@ void HTMLFrameOwnerElement::disconnectContentFrame() |
HTMLFrameOwnerElement::~HTMLFrameOwnerElement() |
{ |
+#if ENABLE(OILPAN) |
+ // An owner must by now have been informed of detachment |
+ // when the frame was closed. |
+ ASSERT(!m_contentFrame); |
+#else |
if (m_contentFrame) |
m_contentFrame->disconnectOwnerElement(); |
+#endif |
} |
Document* HTMLFrameOwnerElement::contentDocument() const |
@@ -224,7 +231,8 @@ Widget* HTMLFrameOwnerElement::ownedWidget() const |
bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const AtomicString& frameName, bool lockBackForwardList) |
{ |
- RefPtr<LocalFrame> parentFrame = document().frame(); |
+ LocalFrame* parentFrame = document().frame(); |
+ FrameProtector protect(parentFrame); |
// FIXME(kenrb): The necessary semantics for RemoteFrames have not been worked out yet, but this will likely need some logic to handle them. |
if (contentFrame() && contentFrame()->isLocalFrame()) { |
toLocalFrame(contentFrame())->navigationScheduler().scheduleLocationChange(&document(), url.string(), Referrer(document().outgoingReferrer(), document().referrerPolicy()), lockBackForwardList); |
@@ -232,7 +240,7 @@ bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic |
} |
if (!document().securityOrigin()->canDisplay(url)) { |
- FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); |
+ FrameLoader::reportLocalLoadFailed(parentFrame, url.string()); |
return false; |
} |
@@ -243,5 +251,12 @@ bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic |
return parentFrame->loader().client()->createFrame(url, frameName, Referrer(referrer, document().referrerPolicy()), this); |
} |
+void HTMLFrameOwnerElement::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_contentFrame); |
+ HTMLElement::trace(visitor); |
+ FrameOwner::trace(visitor); |
+} |
+ |
} // namespace blink |