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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 frame->loader().load(request); | 150 frame->loader().load(request); |
| 151 } | 151 } |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 class ScheduledLocationChange FINAL : public ScheduledURLNavigation { | 154 class ScheduledLocationChange FINAL : public ScheduledURLNavigation { |
| 155 public: | 155 public: |
| 156 ScheduledLocationChange(Document* originDocument, const String& url, const R eferrer& referrer, bool lockBackForwardList) | 156 ScheduledLocationChange(Document* originDocument, const String& url, const R eferrer& referrer, bool lockBackForwardList) |
| 157 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { } | 157 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { } |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 class ScheduledRefresh FINAL : public ScheduledURLNavigation { | 160 class ScheduledRefresh FINAL : public ScheduledNavigation { |
| 161 public: | 161 public: |
| 162 ScheduledRefresh(Document* originDocument, const String& url, const Referrer & referrer) | 162 ScheduledRefresh() |
| 163 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true) | 163 : ScheduledNavigation(0.0, true, true) |
| 164 { | 164 { |
| 165 } | 165 } |
| 166 | 166 |
| 167 virtual void fire(LocalFrame* frame) OVERRIDE | 167 virtual void fire(LocalFrame* frame) OVERRIDE |
| 168 { | 168 { |
| 169 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); | 169 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); |
| 170 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self"); | 170 frame->loader().reload(NormalReload, KURL(), nullAtom, ClientRedirect); |
|
Nate Chapin
2014/07/28 20:05:04
This makes location.reload() behave more like an i
| |
| 171 request.setLockBackForwardList(lockBackForwardList()); | |
| 172 request.setClientRedirect(ClientRedirect); | |
| 173 frame->loader().load(request); | |
| 174 } | 171 } |
| 175 }; | 172 }; |
| 176 | 173 |
| 177 class ScheduledHistoryNavigation FINAL : public ScheduledNavigation { | 174 class ScheduledHistoryNavigation FINAL : public ScheduledNavigation { |
| 178 public: | 175 public: |
| 179 explicit ScheduledHistoryNavigation(int historySteps) | 176 explicit ScheduledHistoryNavigation(int historySteps) |
| 180 : ScheduledNavigation(0, false, true) | 177 : ScheduledNavigation(0, false, true) |
| 181 , m_historySteps(historySteps) | 178 , m_historySteps(historySteps) |
| 182 { | 179 { |
| 183 } | 180 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 void NavigationScheduler::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubm ission> submission) | 333 void NavigationScheduler::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubm ission> submission) |
| 337 { | 334 { |
| 338 ASSERT(m_frame->page()); | 335 ASSERT(m_frame->page()); |
| 339 schedule(adoptPtr(new ScheduledFormSubmission(submission, mustLockBackForwar dList(m_frame)))); | 336 schedule(adoptPtr(new ScheduledFormSubmission(submission, mustLockBackForwar dList(m_frame)))); |
| 340 } | 337 } |
| 341 | 338 |
| 342 void NavigationScheduler::scheduleRefresh() | 339 void NavigationScheduler::scheduleRefresh() |
| 343 { | 340 { |
| 344 if (!shouldScheduleNavigation()) | 341 if (!shouldScheduleNavigation()) |
| 345 return; | 342 return; |
| 346 const KURL& url = m_frame->document()->url(); | 343 if (m_frame->document()->url().isEmpty()) |
| 347 if (url.isEmpty()) | |
| 348 return; | 344 return; |
| 349 | 345 schedule(adoptPtr(new ScheduledRefresh)); |
| 350 schedule(adoptPtr(new ScheduledRefresh(m_frame->document(), url.string(), Re ferrer(m_frame->document()->outgoingReferrer(), m_frame->document()->referrerPol icy())))); | |
| 351 } | 346 } |
| 352 | 347 |
| 353 void NavigationScheduler::scheduleHistoryNavigation(int steps) | 348 void NavigationScheduler::scheduleHistoryNavigation(int steps) |
| 354 { | 349 { |
| 355 if (!shouldScheduleNavigation()) | 350 if (!shouldScheduleNavigation()) |
| 356 return; | 351 return; |
| 357 | 352 |
| 358 // Invalid history navigations (such as history.forward() during a new load) have the side effect of cancelling any scheduled | 353 // Invalid history navigations (such as history.forward() during a new load) have the side effect of cancelling any scheduled |
| 359 // redirects. We also avoid the possibility of cancelling the current load b y avoiding the scheduled redirection altogether. | 354 // redirects. We also avoid the possibility of cancelling the current load b y avoiding the scheduled redirection altogether. |
| 360 BackForwardClient& backForward = m_frame->page()->backForward(); | 355 BackForwardClient& backForward = m_frame->page()->backForward(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 | 415 |
| 421 void NavigationScheduler::cancel() | 416 void NavigationScheduler::cancel() |
| 422 { | 417 { |
| 423 if (m_timer.isActive()) | 418 if (m_timer.isActive()) |
| 424 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 419 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
| 425 m_timer.stop(); | 420 m_timer.stop(); |
| 426 m_redirect.clear(); | 421 m_redirect.clear(); |
| 427 } | 422 } |
| 428 | 423 |
| 429 } // namespace blink | 424 } // namespace blink |
| OLD | NEW |