| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
| 6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
| 7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
| 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 9 * rights reserved. | 9 * rights reserved. |
| 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "core/inspector/InspectorInstrumentation.h" | 41 #include "core/inspector/InspectorInstrumentation.h" |
| 42 #include "core/layout/LayoutPart.h" | 42 #include "core/layout/LayoutPart.h" |
| 43 #include "core/layout/api/LayoutPartItem.h" | 43 #include "core/layout/api/LayoutPartItem.h" |
| 44 #include "core/loader/EmptyClients.h" | 44 #include "core/loader/EmptyClients.h" |
| 45 #include "core/loader/FrameLoaderClient.h" | 45 #include "core/loader/FrameLoaderClient.h" |
| 46 #include "core/loader/NavigationScheduler.h" | 46 #include "core/loader/NavigationScheduler.h" |
| 47 #include "core/page/FocusController.h" | 47 #include "core/page/FocusController.h" |
| 48 #include "core/page/Page.h" | 48 #include "core/page/Page.h" |
| 49 #include "platform/Histogram.h" | 49 #include "platform/Histogram.h" |
| 50 #include "platform/InstanceCounters.h" | 50 #include "platform/InstanceCounters.h" |
| 51 #include "platform/UserGestureIndicator.h" |
| 51 #include "platform/feature_policy/FeaturePolicy.h" | 52 #include "platform/feature_policy/FeaturePolicy.h" |
| 52 #include "platform/network/ResourceError.h" | 53 #include "platform/network/ResourceError.h" |
| 53 | 54 |
| 54 namespace blink { | 55 namespace blink { |
| 55 | 56 |
| 56 using namespace HTMLNames; | 57 using namespace HTMLNames; |
| 57 | 58 |
| 58 Frame::~Frame() { | 59 Frame::~Frame() { |
| 59 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); | 60 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); |
| 60 ASSERT(!m_owner); | 61 ASSERT(!m_owner); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 SandboxPropagatesToAuxiliaryBrowsingContexts) && | 278 SandboxPropagatesToAuxiliaryBrowsingContexts) && |
| 278 (securityContext()->isSandboxed(SandboxPopups) || | 279 (securityContext()->isSandboxed(SandboxPopups) || |
| 279 targetFrame.client()->opener() != this)) { | 280 targetFrame.client()->opener() != this)) { |
| 280 reason = | 281 reason = |
| 281 "The frame attempting navigation is sandboxed and is trying " | 282 "The frame attempting navigation is sandboxed and is trying " |
| 282 "to navigate a popup, but is not the popup's opener and is not " | 283 "to navigate a popup, but is not the popup's opener and is not " |
| 283 "set to propagate sandboxing to popups."; | 284 "set to propagate sandboxing to popups."; |
| 284 return false; | 285 return false; |
| 285 } | 286 } |
| 286 | 287 |
| 287 // Top navigation is forbidden unless opted-in. allow-top-navigation | 288 // Top navigation is forbidden unless opted-in. allow-top-navigation or |
| 288 // will also skips origin checks. | 289 // allow-top-navigation-with-user-activation will also skips origin checks. |
| 289 if (targetFrame == tree().top()) { | 290 if (targetFrame == tree().top()) { |
| 290 if (securityContext()->isSandboxed(SandboxTopNavigation)) { | 291 if (securityContext()->isSandboxed(SandboxTopNavigation) && |
| 292 securityContext()->isSandboxed( |
| 293 SandboxTopNavigationWithUserActivation)) { |
| 294 // TODO(binlu): To add "or 'allow-top-navigation-with-user-activation'" |
| 295 // to the reason below, once the new flag is shipped. |
| 291 reason = | 296 reason = |
| 292 "The frame attempting navigation of the top-level window is " | 297 "The frame attempting navigation of the top-level window is " |
| 293 "sandboxed, but the 'allow-top-navigation' flag is not set."; | 298 "sandboxed, but the 'allow-top-navigation' flag is not set."; |
| 294 return false; | 299 return false; |
| 295 } | 300 } |
| 301 if (securityContext()->isSandboxed(SandboxTopNavigation) && |
| 302 !securityContext()->isSandboxed( |
| 303 SandboxTopNavigationWithUserActivation) && |
| 304 !UserGestureIndicator::processingUserGesture()) { |
| 305 // With only 'allow-top-navigation-with-user-activation' (but not |
| 306 // 'allow-top-navigation'), top navigation requires a user gesture. |
| 307 reason = |
| 308 "The frame attempting navigation of the top-level window is " |
| 309 "sandboxed with the 'allow-top-navigation-with-user-activation' " |
| 310 "flag, but has no user activation (aka gesture). See " |
| 311 "https://www.chromestatus.com/feature/5629582019395584."; |
| 312 return false; |
| 313 } |
| 296 return true; | 314 return true; |
| 297 } | 315 } |
| 298 } | 316 } |
| 299 | 317 |
| 300 ASSERT(securityContext()->getSecurityOrigin()); | 318 ASSERT(securityContext()->getSecurityOrigin()); |
| 301 SecurityOrigin& origin = *securityContext()->getSecurityOrigin(); | 319 SecurityOrigin& origin = *securityContext()->getSecurityOrigin(); |
| 302 | 320 |
| 303 // This is the normal case. A document can navigate its decendant frames, | 321 // This is the normal case. A document can navigate its decendant frames, |
| 304 // or, more generally, a document can navigate a frame if the document is | 322 // or, more generally, a document can navigate a frame if the document is |
| 305 // in the same origin as any of that frame's ancestors (in the frame | 323 // in the same origin as any of that frame's ancestors (in the frame |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 410 |
| 393 ASSERT(page()); | 411 ASSERT(page()); |
| 394 | 412 |
| 395 if (m_owner) | 413 if (m_owner) |
| 396 m_owner->setContentFrame(*this); | 414 m_owner->setContentFrame(*this); |
| 397 else | 415 else |
| 398 page()->setMainFrame(this); | 416 page()->setMainFrame(this); |
| 399 } | 417 } |
| 400 | 418 |
| 401 } // namespace blink | 419 } // namespace blink |
| OLD | NEW |