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 h
ere and they have |
| 282 // been incorrectly tangled together. |
| 283 // |
| 284 // 1. NavigationDisablerForBeforeUnload is for blocking navigation scheduling du
ring a beforeunload |
| 285 // event. Scheduled navigations during beforeunload would make it possible to
get trapped in an |
| 286 // endless loop of beforeunload dialogs. |
| 287 // |
| 288 // Checking Frame::isNavigationAllowed() doesn't make sense in this context:
NavigationScheduler |
| 289 // is always cleared when a new load commits, so it's impossible for a schedu
led navigation to |
| 290 // clobber a navigation that just committed. |
| 291 // |
| 292 // 2. FrameNavigationDisabler / LocalFrame::isNavigationAllowed() is intended to
prevent Documents |
| 293 // from being reattached during destruction, since it can cause bugs with sec
urity origin |
| 294 // confusion. This is primarily intended to block /synchronous/ navigations d
uring things lke |
| 295 // Document::detach(). |
281 inline bool NavigationScheduler::shouldScheduleReload() const | 296 inline bool NavigationScheduler::shouldScheduleReload() const |
282 { | 297 { |
283 return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisabl
erForBeforeUnload::isNavigationAllowed(); | 298 return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisabl
erForBeforeUnload::isNavigationAllowed(); |
284 } | 299 } |
285 | 300 |
286 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con
st | 301 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con
st |
287 { | 302 { |
288 return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaS
cript(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed()); | 303 return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaS
cript(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed()); |
289 } | 304 } |
290 | 305 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 m_redirect.clear(); | 446 m_redirect.clear(); |
432 } | 447 } |
433 | 448 |
434 DEFINE_TRACE(NavigationScheduler) | 449 DEFINE_TRACE(NavigationScheduler) |
435 { | 450 { |
436 visitor->trace(m_frame); | 451 visitor->trace(m_frame); |
437 visitor->trace(m_redirect); | 452 visitor->trace(m_redirect); |
438 } | 453 } |
439 | 454 |
440 } // namespace blink | 455 } // namespace blink |
OLD | NEW |