| OLD | NEW |
| 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 Loading... |
| 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) | |
| 51 { | 50 { |
| 52 } | 51 } |
| 53 | 52 |
| 54 bool HTMLFrameElementBase::isURLAllowed() const | 53 bool HTMLFrameElementBase::isURLAllowed() const |
| 55 { | 54 { |
| 56 if (m_URL.isEmpty()) | 55 if (m_URL.isEmpty()) |
| 57 return true; | 56 return true; |
| 58 | 57 |
| 59 const KURL& completeURL = document().completeURL(m_URL); | 58 const KURL& completeURL = document().completeURL(m_URL); |
| 60 | 59 |
| 61 if (protocolIsJavaScript(completeURL)) { | 60 if (protocolIsJavaScript(completeURL)) { |
| 62 if (contentFrame() && !ScriptController::canAccessFromCurrentOrigin(toIs
olate(&document()), contentFrame())) { | 61 if (contentFrame() && !ScriptController::canAccessFromCurrentOrigin(toIs
olate(&document()), contentFrame())) |
| 63 m_javaScriptURLFailedAccessCheck = true; | |
| 64 return false; | 62 return false; |
| 65 } | |
| 66 SECURITY_CHECK(!m_javaScriptURLFailedAccessCheck); | |
| 67 } | 63 } |
| 68 | 64 |
| 69 LocalFrame* parentFrame = document().frame(); | 65 LocalFrame* parentFrame = document().frame(); |
| 70 if (parentFrame) | 66 if (parentFrame) |
| 71 return parentFrame->isURLAllowed(completeURL); | 67 return parentFrame->isURLAllowed(completeURL); |
| 72 | 68 |
| 73 return true; | 69 return true; |
| 74 } | 70 } |
| 75 | 71 |
| 76 void HTMLFrameElementBase::openURL(bool replaceCurrentItem) | 72 void HTMLFrameElementBase::openURL(bool replaceCurrentItem) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 159 } |
| 164 | 160 |
| 165 void HTMLFrameElementBase::didNotifySubtreeInsertionsToDocument() | 161 void HTMLFrameElementBase::didNotifySubtreeInsertionsToDocument() |
| 166 { | 162 { |
| 167 if (!document().frame()) | 163 if (!document().frame()) |
| 168 return; | 164 return; |
| 169 | 165 |
| 170 if (!SubframeLoadingDisabler::canLoadFrame(*this)) | 166 if (!SubframeLoadingDisabler::canLoadFrame(*this)) |
| 171 return; | 167 return; |
| 172 | 168 |
| 173 // We should never have a content frame at the point where we got inserted | |
| 174 // into a tree. | |
| 175 SECURITY_CHECK(!contentFrame()); | |
| 176 | |
| 177 setNameAndOpenURL(); | 169 setNameAndOpenURL(); |
| 178 } | 170 } |
| 179 | 171 |
| 180 void HTMLFrameElementBase::attachLayoutTree(const AttachContext& context) | 172 void HTMLFrameElementBase::attachLayoutTree(const AttachContext& context) |
| 181 { | 173 { |
| 182 HTMLFrameOwnerElement::attachLayoutTree(context); | 174 HTMLFrameOwnerElement::attachLayoutTree(context); |
| 183 | 175 |
| 184 if (layoutPart()) { | 176 if (layoutPart()) { |
| 185 if (Frame* frame = contentFrame()) { | 177 if (Frame* frame = contentFrame()) { |
| 186 if (frame->isLocalFrame()) | 178 if (frame->isLocalFrame()) |
| 187 setWidget(toLocalFrame(frame)->view()); | 179 setWidget(toLocalFrame(frame)->view()); |
| 188 else if (frame->isRemoteFrame()) | 180 else if (frame->isRemoteFrame()) |
| 189 setWidget(toRemoteFrame(frame)->view()); | 181 setWidget(toRemoteFrame(frame)->view()); |
| 190 } | 182 } |
| 191 } | 183 } |
| 192 } | 184 } |
| 193 | 185 |
| 194 void HTMLFrameElementBase::setLocation(const String& str) | 186 void HTMLFrameElementBase::setLocation(const String& str) |
| 195 { | 187 { |
| 196 m_URL = AtomicString(str); | 188 m_URL = AtomicString(str); |
| 197 m_javaScriptURLFailedAccessCheck = false; | |
| 198 | 189 |
| 199 if (isConnected()) | 190 if (isConnected()) |
| 200 openURL(false); | 191 openURL(false); |
| 201 } | 192 } |
| 202 | 193 |
| 203 bool HTMLFrameElementBase::supportsFocus() const | 194 bool HTMLFrameElementBase::supportsFocus() const |
| 204 { | 195 { |
| 205 return true; | 196 return true; |
| 206 } | 197 } |
| 207 | 198 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 frameOwnerPropertiesChanged(); | 246 frameOwnerPropertiesChanged(); |
| 256 } | 247 } |
| 257 | 248 |
| 258 void HTMLFrameElementBase::setMarginHeight(int marginHeight) | 249 void HTMLFrameElementBase::setMarginHeight(int marginHeight) |
| 259 { | 250 { |
| 260 m_marginHeight = marginHeight; | 251 m_marginHeight = marginHeight; |
| 261 frameOwnerPropertiesChanged(); | 252 frameOwnerPropertiesChanged(); |
| 262 } | 253 } |
| 263 | 254 |
| 264 } // namespace blink | 255 } // namespace blink |
| OLD | NEW |