Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 } | 199 } |
| 200 | 200 |
| 201 DOMWindow* HTMLFrameOwnerElement::contentWindow() const { | 201 DOMWindow* HTMLFrameOwnerElement::contentWindow() const { |
| 202 return m_contentFrame ? m_contentFrame->domWindow() : 0; | 202 return m_contentFrame ? m_contentFrame->domWindow() : 0; |
| 203 } | 203 } |
| 204 | 204 |
| 205 void HTMLFrameOwnerElement::setSandboxFlags(SandboxFlags flags) { | 205 void HTMLFrameOwnerElement::setSandboxFlags(SandboxFlags flags) { |
| 206 m_sandboxFlags = flags; | 206 m_sandboxFlags = flags; |
| 207 // Don't notify about updates if contentFrame() is null, for example when | 207 // Don't notify about updates if contentFrame() is null, for example when |
| 208 // the subframe hasn't been created yet. | 208 // the subframe hasn't been created yet. |
| 209 if (contentFrame()) | 209 if (contentFrame()) { |
| 210 document().frame()->loader().client()->didChangeSandboxFlags(contentFrame(), | 210 document().frame()->loader().client()->didChangeFramePolicy( |
| 211 flags); | 211 contentFrame(), m_sandboxFlags, m_containerPolicy); |
| 212 } | |
| 212 } | 213 } |
| 213 | 214 |
| 214 bool HTMLFrameOwnerElement::isKeyboardFocusable() const { | 215 bool HTMLFrameOwnerElement::isKeyboardFocusable() const { |
| 215 return m_contentFrame && HTMLElement::isKeyboardFocusable(); | 216 return m_contentFrame && HTMLElement::isKeyboardFocusable(); |
| 216 } | 217 } |
| 217 | 218 |
| 218 void HTMLFrameOwnerElement::disposeWidgetSoon(FrameViewBase* frameViewBase) { | 219 void HTMLFrameOwnerElement::disposeWidgetSoon(FrameViewBase* frameViewBase) { |
| 219 if (s_updateSuspendCount) { | 220 if (s_updateSuspendCount) { |
| 220 widgetsPendingDispose().insert(frameViewBase); | 221 widgetsPendingDispose().insert(frameViewBase); |
| 221 return; | 222 return; |
| 222 } | 223 } |
| 223 frameViewBase->dispose(); | 224 frameViewBase->dispose(); |
| 224 } | 225 } |
| 225 | 226 |
| 227 void HTMLFrameOwnerElement::updateContainerPolicy() { | |
| 228 m_containerPolicy = getContainerPolicyFromAllowedFeatures( | |
| 229 allowedFeatures(), SecurityOrigin::create(m_absoluteURL)); | |
|
alexmos
2017/04/06 00:44:22
Is creating an origin directly from the src URL re
iclelland
2017/04/09 03:25:54
The way we have defined it in the spec, specifying
| |
| 230 // Don't notify about updates if contentFrame() is null, for example when | |
| 231 // the subframe hasn't been created yet. | |
| 232 if (contentFrame()) { | |
| 233 document().frame()->loader().client()->didChangeFramePolicy( | |
| 234 contentFrame(), m_sandboxFlags, m_containerPolicy); | |
| 235 } | |
| 236 } | |
| 237 | |
| 226 void HTMLFrameOwnerElement::frameOwnerPropertiesChanged() { | 238 void HTMLFrameOwnerElement::frameOwnerPropertiesChanged() { |
| 239 updateContainerPolicy(); | |
|
lunalu1
2017/04/05 22:30:03
I don't think we need to update it here?
iclelland
2017/04/09 03:25:54
Thanks; that was older code from a previous iterat
| |
| 227 // Don't notify about updates if contentFrame() is null, for example when | 240 // Don't notify about updates if contentFrame() is null, for example when |
| 228 // the subframe hasn't been created yet. | 241 // the subframe hasn't been created yet. |
| 229 if (contentFrame()) | 242 if (contentFrame()) |
| 230 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); | 243 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); |
| 231 } | 244 } |
| 232 | 245 |
| 233 void HTMLFrameOwnerElement::dispatchLoad() { | 246 void HTMLFrameOwnerElement::dispatchLoad() { |
| 234 dispatchScopedEvent(Event::create(EventTypeNames::load)); | 247 dispatchScopedEvent(Event::create(EventTypeNames::load)); |
| 235 } | 248 } |
| 236 | 249 |
| 237 const WebVector<WebFeaturePolicyFeature>& | 250 const WebVector<WebFeaturePolicyFeature>& |
| 238 HTMLFrameOwnerElement::allowedFeatures() const { | 251 HTMLFrameOwnerElement::allowedFeatures() const { |
| 239 DEFINE_STATIC_LOCAL(WebVector<WebFeaturePolicyFeature>, features, ()); | 252 DEFINE_STATIC_LOCAL(WebVector<WebFeaturePolicyFeature>, features, ()); |
| 240 return features; | 253 return features; |
| 241 } | 254 } |
| 242 | 255 |
| 256 const WebParsedFeaturePolicy& HTMLFrameOwnerElement::containerPolicy() const { | |
| 257 return m_containerPolicy; | |
| 258 } | |
| 259 | |
| 243 Document* HTMLFrameOwnerElement::getSVGDocument( | 260 Document* HTMLFrameOwnerElement::getSVGDocument( |
| 244 ExceptionState& exceptionState) const { | 261 ExceptionState& exceptionState) const { |
| 245 Document* doc = contentDocument(); | 262 Document* doc = contentDocument(); |
| 246 if (doc && doc->isSVGDocument()) | 263 if (doc && doc->isSVGDocument()) |
| 247 return doc; | 264 return doc; |
| 248 return nullptr; | 265 return nullptr; |
| 249 } | 266 } |
| 250 | 267 |
| 251 void HTMLFrameOwnerElement::setWidget(FrameViewBase* frameViewBase) { | 268 void HTMLFrameOwnerElement::setWidget(FrameViewBase* frameViewBase) { |
| 252 if (frameViewBase == m_widget) | 269 if (frameViewBase == m_widget) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 } | 318 } |
| 302 | 319 |
| 303 FrameViewBase* HTMLFrameOwnerElement::ownedWidget() const { | 320 FrameViewBase* HTMLFrameOwnerElement::ownedWidget() const { |
| 304 return m_widget.get(); | 321 return m_widget.get(); |
| 305 } | 322 } |
| 306 | 323 |
| 307 bool HTMLFrameOwnerElement::loadOrRedirectSubframe( | 324 bool HTMLFrameOwnerElement::loadOrRedirectSubframe( |
| 308 const KURL& url, | 325 const KURL& url, |
| 309 const AtomicString& frameName, | 326 const AtomicString& frameName, |
| 310 bool replaceCurrentItem) { | 327 bool replaceCurrentItem) { |
| 328 m_absoluteURL = url; | |
|
lunalu1
2017/04/05 22:30:03
it seems like this is the only place this url is u
iclelland
2017/04/09 03:25:54
Thanks for catching that -- we don't need to anymo
| |
| 329 updateContainerPolicy(); | |
| 330 | |
| 311 LocalFrame* parentFrame = document().frame(); | 331 LocalFrame* parentFrame = document().frame(); |
| 312 if (contentFrame()) { | 332 if (contentFrame()) { |
| 313 contentFrame()->navigate(document(), url, replaceCurrentItem, | 333 contentFrame()->navigate(document(), url, replaceCurrentItem, |
| 314 UserGestureStatus::None); | 334 UserGestureStatus::None); |
| 315 return true; | 335 return true; |
| 316 } | 336 } |
| 317 | 337 |
| 318 if (!document().getSecurityOrigin()->canDisplay(url)) { | 338 if (!document().getSecurityOrigin()->canDisplay(url)) { |
| 319 FrameLoader::reportLocalLoadFailed(parentFrame, url.getString()); | 339 FrameLoader::reportLocalLoadFailed(parentFrame, url.getString()); |
| 320 return false; | 340 return false; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 340 } | 360 } |
| 341 | 361 |
| 342 DEFINE_TRACE(HTMLFrameOwnerElement) { | 362 DEFINE_TRACE(HTMLFrameOwnerElement) { |
| 343 visitor->trace(m_contentFrame); | 363 visitor->trace(m_contentFrame); |
| 344 visitor->trace(m_widget); | 364 visitor->trace(m_widget); |
| 345 HTMLElement::trace(visitor); | 365 HTMLElement::trace(visitor); |
| 346 FrameOwner::trace(visitor); | 366 FrameOwner::trace(visitor); |
| 347 } | 367 } |
| 348 | 368 |
| 349 } // namespace blink | 369 } // namespace blink |
| OLD | NEW |