Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 5 * Copyright (C) 2009 Adam Barth. All rights reserved. | 5 * Copyright (C) 2009 Adam Barth. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 bool NavigationScheduler::locationChangePending() | 271 bool NavigationScheduler::locationChangePending() |
| 272 { | 272 { |
| 273 return m_redirect && m_redirect->isLocationChange(); | 273 return m_redirect && m_redirect->isLocationChange(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool NavigationScheduler::isNavigationScheduledWithin(double interval) const | 276 bool NavigationScheduler::isNavigationScheduledWithin(double interval) const |
| 277 { | 277 { |
| 278 return m_redirect && m_redirect->delay() <= interval; | 278 return m_redirect && m_redirect->delay() <= interval; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // TODO(dcheng): There are really two different load blocking concepts at work | |
| 282 // here and they have been incorrectly tangled together. | |
| 283 // | |
| 284 // 1. NavigationDisablerForBeforeUnload is for blocking navigation scheduling | |
|
dcheng
2016/04/05 00:06:29
Avi, given this description, do you think it still
Avi (use Gerrit)
2016/04/05 01:36:33
I know about the dialog side of onbeforeunload, bu
dcheng
2016/04/05 04:47:22
While the beforeunload dialog is open, no script c
| |
| 285 // during a beforeunload event. Scheduled navigations during beforeunload | |
| 286 // would make it possible to get trapped in an endless loop of beforeunload | |
| 287 // dialogs. | |
| 288 // | |
| 289 // Checking Frame::isNavigationAllowed() doesn't make sense in this context: | |
| 290 // NavigationScheduler is always cleared when a new load commits, so it's | |
| 291 // impossible for a scheduled navigation to clobber a navigation that just | |
| 292 // committed. | |
| 293 // | |
| 294 // 2. FrameNavigationDisabler / LocalFrame::isNavigationAllowed() are intended | |
| 295 // to prevent Documents from being reattached during destruction, since it | |
| 296 // can cause bugs with security origin confusion. This is primarily intended | |
| 297 // to block /synchronous/ navigations during things lke Document::detach(). | |
| 281 inline bool NavigationScheduler::shouldScheduleReload() const | 298 inline bool NavigationScheduler::shouldScheduleReload() const |
| 282 { | 299 { |
| 283 return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisabl erForBeforeUnload::isNavigationAllowed(); | 300 return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisabl erForBeforeUnload::isNavigationAllowed(); |
| 284 } | 301 } |
| 285 | 302 |
| 286 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con st | 303 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con st |
| 287 { | 304 { |
| 288 return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaS cript(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed()); | 305 return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaS cript(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed()); |
| 289 } | 306 } |
| 290 | 307 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 m_redirect.clear(); | 448 m_redirect.clear(); |
| 432 } | 449 } |
| 433 | 450 |
| 434 DEFINE_TRACE(NavigationScheduler) | 451 DEFINE_TRACE(NavigationScheduler) |
| 435 { | 452 { |
| 436 visitor->trace(m_frame); | 453 visitor->trace(m_frame); |
| 437 visitor->trace(m_redirect); | 454 visitor->trace(m_redirect); |
| 438 } | 455 } |
| 439 | 456 |
| 440 } // namespace blink | 457 } // namespace blink |
| OLD | NEW |