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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp

Issue 2169453002: Sprinkle some release asserts over HTMLFrameElementBase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameElementBase.h ('k') | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) 4 * (C) 2000 Simon Hausmann (hausmann@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 29 matching lines...) Expand all
40 40
41 namespace blink { 41 namespace blink {
42 42
43 using namespace HTMLNames; 43 using namespace HTMLNames;
44 44
45 HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen t& document) 45 HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen t& document)
46 : HTMLFrameOwnerElement(tagName, document) 46 : HTMLFrameOwnerElement(tagName, document)
47 , m_scrollingMode(ScrollbarAuto) 47 , m_scrollingMode(ScrollbarAuto)
48 , m_marginWidth(-1) 48 , m_marginWidth(-1)
49 , m_marginHeight(-1) 49 , m_marginHeight(-1)
50 , m_javaScriptURLFailedAccessCheck(false)
50 { 51 {
51 } 52 }
52 53
53 bool HTMLFrameElementBase::isURLAllowed() const 54 bool HTMLFrameElementBase::isURLAllowed() const
54 { 55 {
55 if (m_URL.isEmpty()) 56 if (m_URL.isEmpty())
56 return true; 57 return true;
57 58
58 const KURL& completeURL = document().completeURL(m_URL); 59 const KURL& completeURL = document().completeURL(m_URL);
59 60
60 if (protocolIsJavaScript(completeURL)) { 61 if (protocolIsJavaScript(completeURL)) {
61 if (contentFrame() && !ScriptController::canAccessFromCurrentOrigin(toIs olate(&document()), contentFrame())) 62 if (contentFrame() && !ScriptController::canAccessFromCurrentOrigin(toIs olate(&document()), contentFrame())) {
63 m_javaScriptURLFailedAccessCheck = true;
62 return false; 64 return false;
65 }
66 SECURITY_CHECK(!m_javaScriptURLFailedAccessCheck);
63 } 67 }
64 68
65 LocalFrame* parentFrame = document().frame(); 69 LocalFrame* parentFrame = document().frame();
66 if (parentFrame) 70 if (parentFrame)
67 return parentFrame->isURLAllowed(completeURL); 71 return parentFrame->isURLAllowed(completeURL);
68 72
69 return true; 73 return true;
70 } 74 }
71 75
72 void HTMLFrameElementBase::openURL(bool replaceCurrentItem) 76 void HTMLFrameElementBase::openURL(bool replaceCurrentItem)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 163 }
160 164
161 void HTMLFrameElementBase::didNotifySubtreeInsertionsToDocument() 165 void HTMLFrameElementBase::didNotifySubtreeInsertionsToDocument()
162 { 166 {
163 if (!document().frame()) 167 if (!document().frame())
164 return; 168 return;
165 169
166 if (!SubframeLoadingDisabler::canLoadFrame(*this)) 170 if (!SubframeLoadingDisabler::canLoadFrame(*this))
167 return; 171 return;
168 172
173 // We should never have a content frame at the point where we got inserted
174 // into a tree.
175 SECURITY_CHECK(!contentFrame());
176
169 setNameAndOpenURL(); 177 setNameAndOpenURL();
170 } 178 }
171 179
172 void HTMLFrameElementBase::attachLayoutTree(const AttachContext& context) 180 void HTMLFrameElementBase::attachLayoutTree(const AttachContext& context)
173 { 181 {
174 HTMLFrameOwnerElement::attachLayoutTree(context); 182 HTMLFrameOwnerElement::attachLayoutTree(context);
175 183
176 if (layoutPart()) { 184 if (layoutPart()) {
177 if (Frame* frame = contentFrame()) { 185 if (Frame* frame = contentFrame()) {
178 if (frame->isLocalFrame()) 186 if (frame->isLocalFrame())
179 setWidget(toLocalFrame(frame)->view()); 187 setWidget(toLocalFrame(frame)->view());
180 else if (frame->isRemoteFrame()) 188 else if (frame->isRemoteFrame())
181 setWidget(toRemoteFrame(frame)->view()); 189 setWidget(toRemoteFrame(frame)->view());
182 } 190 }
183 } 191 }
184 } 192 }
185 193
186 void HTMLFrameElementBase::setLocation(const String& str) 194 void HTMLFrameElementBase::setLocation(const String& str)
187 { 195 {
188 m_URL = AtomicString(str); 196 m_URL = AtomicString(str);
197 m_javaScriptURLFailedAccessCheck = false;
189 198
190 if (isConnected()) 199 if (isConnected())
191 openURL(false); 200 openURL(false);
192 } 201 }
193 202
194 bool HTMLFrameElementBase::supportsFocus() const 203 bool HTMLFrameElementBase::supportsFocus() const
195 { 204 {
196 return true; 205 return true;
197 } 206 }
198 207
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 frameOwnerPropertiesChanged(); 255 frameOwnerPropertiesChanged();
247 } 256 }
248 257
249 void HTMLFrameElementBase::setMarginHeight(int marginHeight) 258 void HTMLFrameElementBase::setMarginHeight(int marginHeight)
250 { 259 {
251 m_marginHeight = marginHeight; 260 m_marginHeight = marginHeight;
252 frameOwnerPropertiesChanged(); 261 frameOwnerPropertiesChanged();
253 } 262 }
254 263
255 } // namespace blink 264 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameElementBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698