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 17 matching lines...) Expand all Loading... |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "config.h" | 32 #include "config.h" |
33 #include "core/loader/NavigationScheduler.h" | 33 #include "core/loader/NavigationScheduler.h" |
34 | 34 |
35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
36 #include "core/events/Event.h" | 36 #include "core/events/Event.h" |
37 #include "core/fetch/ResourceLoaderOptions.h" | 37 #include "core/fetch/ResourceLoaderOptions.h" |
| 38 #include "core/frame/FrameProtector.h" |
38 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
39 #include "core/frame/csp/ContentSecurityPolicy.h" | 40 #include "core/frame/csp/ContentSecurityPolicy.h" |
40 #include "core/html/HTMLFormElement.h" | 41 #include "core/html/HTMLFormElement.h" |
41 #include "core/inspector/InspectorInstrumentation.h" | 42 #include "core/inspector/InspectorInstrumentation.h" |
42 #include "core/loader/DocumentLoader.h" | 43 #include "core/loader/DocumentLoader.h" |
43 #include "core/loader/FormState.h" | 44 #include "core/loader/FormState.h" |
44 #include "core/loader/FormSubmission.h" | 45 #include "core/loader/FormSubmission.h" |
45 #include "core/loader/FrameLoadRequest.h" | 46 #include "core/loader/FrameLoadRequest.h" |
46 #include "core/loader/FrameLoader.h" | 47 #include "core/loader/FrameLoader.h" |
47 #include "core/loader/FrameLoaderClient.h" | 48 #include "core/loader/FrameLoaderClient.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 366 |
366 void NavigationScheduler::timerFired(Timer<NavigationScheduler>*) | 367 void NavigationScheduler::timerFired(Timer<NavigationScheduler>*) |
367 { | 368 { |
368 if (!m_frame->page()) | 369 if (!m_frame->page()) |
369 return; | 370 return; |
370 if (m_frame->page()->defersLoading()) { | 371 if (m_frame->page()->defersLoading()) { |
371 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 372 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
372 return; | 373 return; |
373 } | 374 } |
374 | 375 |
375 RefPtr<LocalFrame> protect(m_frame); | 376 FrameProtector protect(m_frame); |
376 | 377 |
377 OwnPtr<ScheduledNavigation> redirect(m_redirect.release()); | 378 OwnPtr<ScheduledNavigation> redirect(m_redirect.release()); |
378 redirect->fire(m_frame); | 379 redirect->fire(m_frame); |
379 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 380 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
380 } | 381 } |
381 | 382 |
382 void NavigationScheduler::schedule(PassOwnPtr<ScheduledNavigation> redirect) | 383 void NavigationScheduler::schedule(PassOwnPtr<ScheduledNavigation> redirect) |
383 { | 384 { |
384 ASSERT(m_frame->page()); | 385 ASSERT(m_frame->page()); |
385 | 386 |
386 // In a back/forward navigation, we sometimes restore history state to ifram
es, even though the state was generated | 387 // In a back/forward navigation, we sometimes restore history state to ifram
es, even though the state was generated |
387 // dynamically and JS will try to put something different in the iframe. In
this case, we will load stale things | 388 // dynamically and JS will try to put something different in the iframe. In
this case, we will load stale things |
388 // and/or confuse the JS when it shortly thereafter tries to schedule a loca
tion change. Let the JS have its way. | 389 // and/or confuse the JS when it shortly thereafter tries to schedule a loca
tion change. Let the JS have its way. |
389 // FIXME: This check seems out of place. | 390 // FIXME: This check seems out of place. |
390 if (!m_frame->loader().stateMachine()->committedFirstRealDocumentLoad() && m
_frame->loader().provisionalDocumentLoader()) { | 391 if (!m_frame->loader().stateMachine()->committedFirstRealDocumentLoad() && m
_frame->loader().provisionalDocumentLoader()) { |
391 RefPtr<Frame> protect(m_frame); | 392 FrameProtector protect(m_frame.get()); |
392 m_frame->loader().provisionalDocumentLoader()->stopLoading(); | 393 m_frame->loader().provisionalDocumentLoader()->stopLoading(); |
393 if (!m_frame->host()) | 394 if (!m_frame->host()) |
394 return; | 395 return; |
395 } | 396 } |
396 | 397 |
397 cancel(); | 398 cancel(); |
398 m_redirect = redirect; | 399 m_redirect = redirect; |
399 startTimer(); | 400 startTimer(); |
400 } | 401 } |
401 | 402 |
(...skipping 13 matching lines...) Expand all Loading... |
415 } | 416 } |
416 | 417 |
417 void NavigationScheduler::cancel() | 418 void NavigationScheduler::cancel() |
418 { | 419 { |
419 if (m_timer.isActive()) | 420 if (m_timer.isActive()) |
420 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 421 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
421 m_timer.stop(); | 422 m_timer.stop(); |
422 m_redirect.clear(); | 423 m_redirect.clear(); |
423 } | 424 } |
424 | 425 |
| 426 void NavigationScheduler::trace(Visitor* visitor) |
| 427 { |
| 428 visitor->trace(m_frame); |
| 429 } |
| 430 |
425 } // namespace blink | 431 } // namespace blink |
OLD | NEW |