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

Side by Side Diff: Source/core/html/HTMLFrameOwnerElement.cpp

Issue 53303002: Have HTMLFrameOwnerElement / SubframeLoadingDisabler deal with references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tiny fix Created 7 years, 1 month 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
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 RenderPart* HTMLFrameOwnerElement::renderPart() const 44 RenderPart* HTMLFrameOwnerElement::renderPart() const
45 { 45 {
46 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers 46 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers
47 // when using fallback content. 47 // when using fallback content.
48 if (!renderer() || !renderer()->isRenderPart()) 48 if (!renderer() || !renderer()->isRenderPart())
49 return 0; 49 return 0;
50 return toRenderPart(renderer()); 50 return toRenderPart(renderer());
51 } 51 }
52 52
53 void HTMLFrameOwnerElement::setContentFrame(Frame* frame) 53 void HTMLFrameOwnerElement::setContentFrame(Frame& frame)
54 { 54 {
55 // Make sure we will not end up with two frames referencing the same owner e lement. 55 // Make sure we will not end up with two frames referencing the same owner e lement.
56 ASSERT(!m_contentFrame || m_contentFrame->ownerElement() != this); 56 ASSERT(!m_contentFrame || m_contentFrame->ownerElement() != this);
57 ASSERT(frame);
58 // Disconnected frames should not be allowed to load. 57 // Disconnected frames should not be allowed to load.
59 ASSERT(inDocument()); 58 ASSERT(inDocument());
60 m_contentFrame = frame; 59 m_contentFrame = &frame;
61 60
62 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode() ) 61 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode() )
63 node->incrementConnectedSubframeCount(); 62 node->incrementConnectedSubframeCount();
64 } 63 }
65 64
66 void HTMLFrameOwnerElement::clearContentFrame() 65 void HTMLFrameOwnerElement::clearContentFrame()
67 { 66 {
68 if (!m_contentFrame) 67 if (!m_contentFrame)
69 return; 68 return;
70 69
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (contentFrame()) { 128 if (contentFrame()) {
130 contentFrame()->navigationScheduler().scheduleLocationChange(document(). securityOrigin(), url.string(), parentFrame->loader().outgoingReferrer(), lockBa ckForwardList); 129 contentFrame()->navigationScheduler().scheduleLocationChange(document(). securityOrigin(), url.string(), parentFrame->loader().outgoingReferrer(), lockBa ckForwardList);
131 return true; 130 return true;
132 } 131 }
133 132
134 if (!document().securityOrigin()->canDisplay(url)) { 133 if (!document().securityOrigin()->canDisplay(url)) {
135 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); 134 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string());
136 return false; 135 return false;
137 } 136 }
138 137
139 if (!SubframeLoadingDisabler::canLoadFrame(this)) 138 if (!SubframeLoadingDisabler::canLoadFrame(*this))
140 return false; 139 return false;
141 140
142 String referrer = SecurityPolicy::generateReferrerHeader(document().referrer Policy(), url, parentFrame->loader().outgoingReferrer()); 141 String referrer = SecurityPolicy::generateReferrerHeader(document().referrer Policy(), url, parentFrame->loader().outgoingReferrer());
143 RefPtr<Frame> childFrame = parentFrame->loader().client()->createFrame(url, frameName, referrer, this); 142 RefPtr<Frame> childFrame = parentFrame->loader().client()->createFrame(url, frameName, referrer, this);
144 143
145 if (!childFrame) { 144 if (!childFrame) {
146 parentFrame->loader().checkCompleted(); 145 parentFrame->loader().checkCompleted();
147 return false; 146 return false;
148 } 147 }
149 148
(...skipping 19 matching lines...) Expand all
169 // FIXME: In this case the Frame will have finished loading before 168 // FIXME: In this case the Frame will have finished loading before
170 // it's being added to the child list. It would be a good idea to 169 // it's being added to the child list. It would be a good idea to
171 // create the child first, then invoke the loader separately. 170 // create the child first, then invoke the loader separately.
172 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade r().policyDocumentLoader()) 171 if (childFrame->loader().state() == FrameStateComplete && !childFrame->loade r().policyDocumentLoader())
173 childFrame->loader().checkCompleted(); 172 childFrame->loader().checkCompleted();
174 return true; 173 return true;
175 } 174 }
176 175
177 176
178 } // namespace WebCore 177 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.h ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698