Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/WebKit/Source/core/loader/NavigationScheduler.cpp

Issue 1873583002: Move isNavigationAllowed() check to main entry point for loads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 bool NavigationScheduler::locationChangePending() 272 bool NavigationScheduler::locationChangePending()
273 { 273 {
274 return m_redirect && m_redirect->isLocationChange(); 274 return m_redirect && m_redirect->isLocationChange();
275 } 275 }
276 276
277 bool NavigationScheduler::isNavigationScheduled() const 277 bool NavigationScheduler::isNavigationScheduled() const
278 { 278 {
279 return m_redirect; 279 return m_redirect;
280 } 280 }
281 281
282 // TODO(dcheng): There are really two different load blocking concepts at work
283 // here and they have been incorrectly tangled together.
284 //
285 // 1. NavigationDisablerForBeforeUnload is for blocking navigation scheduling
286 // during a beforeunload event. Scheduled navigations during beforeunload
287 // would make it possible to get trapped in an endless loop of beforeunload
288 // dialogs.
289 //
290 // Checking Frame::isNavigationAllowed() doesn't make sense in this context:
291 // NavigationScheduler is always cleared when a new load commits, so it's
292 // impossible for a scheduled navigation to clobber a navigation that just
293 // committed.
294 //
295 // 2. FrameNavigationDisabler / LocalFrame::isNavigationAllowed() are intended
296 // to prevent Documents from being reattached during destruction, since it
297 // can cause bugs with security origin confusion. This is primarily intended
298 // to block /synchronous/ navigations during things lke Document::detach().
282 inline bool NavigationScheduler::shouldScheduleReload() const 299 inline bool NavigationScheduler::shouldScheduleReload() const
283 { 300 {
284 return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisabl erForBeforeUnload::isNavigationAllowed(); 301 return m_frame->page() && m_frame->isNavigationAllowed() && NavigationDisabl erForBeforeUnload::isNavigationAllowed();
285 } 302 }
286 303
287 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con st 304 inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) con st
288 { 305 {
289 return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaS cript(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed()); 306 return m_frame->page() && m_frame->isNavigationAllowed() && (protocolIsJavaS cript(url) || NavigationDisablerForBeforeUnload::isNavigationAllowed());
290 } 307 }
291 308
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 m_redirect.clear(); 449 m_redirect.clear();
433 } 450 }
434 451
435 DEFINE_TRACE(NavigationScheduler) 452 DEFINE_TRACE(NavigationScheduler)
436 { 453 {
437 visitor->trace(m_frame); 454 visitor->trace(m_frame);
438 visitor->trace(m_redirect); 455 visitor->trace(m_redirect);
439 } 456 }
440 457
441 } // namespace blink 458 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698