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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame); | 175 UseCounter::count(&targetFrame, UseCounter::TopNavigationFromSubFrame); |
176 bool hasUserGesture = | 176 bool hasUserGesture = |
177 isLocalFrame() | 177 isLocalFrame() |
178 ? toLocalFrame(this)->document()->hasReceivedUserGesture() | 178 ? toLocalFrame(this)->document()->hasReceivedUserGesture() |
179 : false; | 179 : false; |
180 if (hasUserGesture) | 180 if (hasUserGesture) |
181 framebustParams |= userGestureBit; | 181 framebustParams |= userGestureBit; |
182 if (isAllowedNavigation) | 182 if (isAllowedNavigation) |
183 framebustParams |= allowedBit; | 183 framebustParams |= allowedBit; |
184 framebustHistogram.count(framebustParams); | 184 framebustHistogram.count(framebustParams); |
185 // Frame-busting used to be generally allowed in most situations, but may | |
186 // now blocked if there is no user gesture. | |
187 if (!RuntimeEnabledFeatures:: | |
188 framebustingNeedsSameOriginOrUserGestureEnabled()) | |
189 return true; | |
190 if (hasUserGesture || isAllowedNavigation) | 185 if (hasUserGesture || isAllowedNavigation) |
191 return true; | 186 return true; |
| 187 // Frame-busting used to be generally allowed in most situations, but may |
| 188 // now blocked if the document initiating the navigation has never received |
| 189 // a user gesture. |
| 190 if (!RuntimeEnabledFeatures:: |
| 191 framebustingNeedsSameOriginOrUserGestureEnabled()) { |
| 192 String targetFrameDescription = |
| 193 targetFrame.isLocalFrame() |
| 194 ? "with URL '" + |
| 195 toLocalFrame(targetFrame).document()->url().getString() + |
| 196 "'" |
| 197 : "with origin '" + |
| 198 targetFrame.securityContext() |
| 199 ->getSecurityOrigin() |
| 200 ->toString() + |
| 201 "'"; |
| 202 String message = "Frame with URL '" + |
| 203 toLocalFrame(this)->document()->url().getString() + |
| 204 "' attempted to navigate its top-level window " + |
| 205 targetFrameDescription + |
| 206 ". Navigating the top-level window from a cross-origin " |
| 207 "iframe will soon require that the iframe has received " |
| 208 "a user gesture. See " |
| 209 "https://www.chromestatus.com/features/" |
| 210 "5851021045661696."; |
| 211 printNavigationWarning(message); |
| 212 return true; |
| 213 } |
192 errorReason = | 214 errorReason = |
193 "The frame attempting navigation is targeting its top-level window, " | 215 "The frame attempting navigation is targeting its top-level window, " |
194 "but is neither same-origin with its target nor is it processing a " | 216 "but is neither same-origin with its target nor has it received a " |
195 "user gesture. See " | 217 "user gesture. See " |
196 "https://www.chromestatus.com/features/5851021045661696."; | 218 "https://www.chromestatus.com/features/5851021045661696."; |
197 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); | 219 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); |
198 if (isLocalFrame()) | 220 if (isLocalFrame()) |
199 toLocalFrame(this)->navigationScheduler().schedulePageBlock( | 221 toLocalFrame(this)->navigationScheduler().schedulePageBlock( |
200 toLocalFrame(this)->document()); | 222 toLocalFrame(this)->document()); |
201 return false; | 223 return false; |
202 } | 224 } |
203 if (!isAllowedNavigation && !errorReason.isNull()) | 225 if (!isAllowedNavigation && !errorReason.isNull()) |
204 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); | 226 printNavigationErrorMessage(targetFrame, errorReason.latin1().data()); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 355 |
334 ASSERT(page()); | 356 ASSERT(page()); |
335 | 357 |
336 if (m_owner) | 358 if (m_owner) |
337 m_owner->setContentFrame(*this); | 359 m_owner->setContentFrame(*this); |
338 else | 360 else |
339 page()->setMainFrame(this); | 361 page()->setMainFrame(this); |
340 } | 362 } |
341 | 363 |
342 } // namespace blink | 364 } // namespace blink |
OLD | NEW |