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

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

Issue 296533004: Fix incorrect iframe loading during back/forward navigation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/navigation/resources/back-to-dynamic-iframe-iframe.html ('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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 RefPtr<LocalFrame> protect(m_frame); 366 RefPtr<LocalFrame> protect(m_frame);
367 367
368 OwnPtr<ScheduledNavigation> redirect(m_redirect.release()); 368 OwnPtr<ScheduledNavigation> redirect(m_redirect.release());
369 redirect->fire(m_frame); 369 redirect->fire(m_frame);
370 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 370 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
371 } 371 }
372 372
373 void NavigationScheduler::schedule(PassOwnPtr<ScheduledNavigation> redirect) 373 void NavigationScheduler::schedule(PassOwnPtr<ScheduledNavigation> redirect)
374 { 374 {
375 ASSERT(m_frame->page()); 375 ASSERT(m_frame->page());
376
377 // In a back/forward navigation, we sometimes restore history state to ifram es, even though the state was generated
378 // dynamically and JS will try to put something different in the iframe. In this case, we will load stale things
379 // and/or confuse the JS when it shortly thereafter tries to schedule a loca tion change. Let the JS have its way.
380 // FIXME: This check seems out of place.
381 if (!m_frame->loader().stateMachine()->committedFirstRealDocumentLoad() && m _frame->loader().provisionalDocumentLoader()) {
382 RefPtr<Frame> protect(m_frame);
383 m_frame->loader().provisionalDocumentLoader()->stopLoading();
384 if (!m_frame->host())
385 return;
386 }
387
376 cancel(); 388 cancel();
377 m_redirect = redirect; 389 m_redirect = redirect;
378 startTimer(); 390 startTimer();
379 } 391 }
380 392
381 void NavigationScheduler::startTimer() 393 void NavigationScheduler::startTimer()
382 { 394 {
383 if (!m_redirect) 395 if (!m_redirect)
384 return; 396 return;
385 397
386 ASSERT(m_frame->page()); 398 ASSERT(m_frame->page());
387 if (m_timer.isActive()) 399 if (m_timer.isActive())
388 return; 400 return;
389 if (!m_redirect->shouldStartTimer(m_frame)) 401 if (!m_redirect->shouldStartTimer(m_frame))
390 return; 402 return;
391 403
392 m_timer.startOneShot(m_redirect->delay(), FROM_HERE); 404 m_timer.startOneShot(m_redirect->delay(), FROM_HERE);
393 InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->dela y()); 405 InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->dela y());
394 } 406 }
395 407
396 void NavigationScheduler::cancel() 408 void NavigationScheduler::cancel()
397 { 409 {
398 if (m_timer.isActive()) 410 if (m_timer.isActive())
399 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 411 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
400 m_timer.stop(); 412 m_timer.stop();
401 m_redirect.clear(); 413 m_redirect.clear();
402 } 414 }
403 415
404 } // namespace WebCore 416 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/navigation/resources/back-to-dynamic-iframe-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698