Chromium Code Reviews| Index: Source/core/loader/NavigationScheduler.cpp |
| diff --git a/Source/core/loader/NavigationScheduler.cpp b/Source/core/loader/NavigationScheduler.cpp |
| index 542c8dfd6654f8d3c5f7c2cbfc3d5967b3516120..1506701d9c41d76ab7cde4f5ffc96fbeab8d8a04 100644 |
| --- a/Source/core/loader/NavigationScheduler.cpp |
| +++ b/Source/core/loader/NavigationScheduler.cpp |
| @@ -70,11 +70,9 @@ public: |
| virtual void fire(Frame*) = 0; |
| virtual bool shouldStartTimer(Frame*) { return true; } |
| - virtual void didStartTimer(Frame*, Timer<NavigationScheduler>*) { } |
| double delay() const { return m_delay; } |
| bool lockBackForwardList() const { return m_lockBackForwardList; } |
| - void setLockBackForwardList(bool lockBackForwardList) { m_lockBackForwardList = lockBackForwardList; } |
| bool isLocationChange() const { return m_isLocationChange; } |
| PassOwnPtr<UserGestureIndicator> createUserGestureIndicator() |
| { |
| @@ -103,7 +101,6 @@ protected: |
| , m_securityOrigin(securityOrigin) |
| , m_url(url) |
| , m_referrer(referrer) |
| - , m_haveToldClient(false) |
| { |
| } |
| @@ -116,17 +113,6 @@ protected: |
| frame->loader().load(request); |
| } |
| - virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer) |
| - { |
| - if (m_haveToldClient) |
| - return; |
| - m_haveToldClient = true; |
| - |
| - OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); |
| - if (frame->page()->history()->currentItemShouldBeReplaced(frame)) |
| - setLockBackForwardList(true); |
| - } |
| - |
| SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); } |
| String url() const { return m_url; } |
| String referrer() const { return m_referrer; } |
| @@ -135,7 +121,6 @@ private: |
| RefPtr<SecurityOrigin> m_securityOrigin; |
| String m_url; |
| String m_referrer; |
| - bool m_haveToldClient; |
| }; |
| class ScheduledRedirect : public ScheduledURLNavigation { |
| @@ -217,7 +202,6 @@ public: |
| ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList) |
| : ScheduledNavigation(0, lockBackForwardList, submission->target().isNull()) |
| , m_submission(submission) |
| - , m_haveToldClient(false) |
| { |
| ASSERT(m_submission->state()); |
| } |
| @@ -233,23 +217,11 @@ public: |
| frame->loader().load(frameRequest); |
| } |
| - virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer) |
| - { |
| - if (m_haveToldClient) |
| - return; |
| - m_haveToldClient = true; |
| - |
| - OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); |
| - if (frame->page()->history()->currentItemShouldBeReplaced(frame)) |
| - setLockBackForwardList(true); |
| - } |
| - |
| virtual bool isForm() const { return true; } |
| FormSubmission* submission() const { return m_submission.get(); } |
| private: |
| RefPtr<FormSubmission> m_submission; |
| - bool m_haveToldClient; |
| }; |
| NavigationScheduler::NavigationScheduler(Frame* frame) |
| @@ -307,6 +279,14 @@ bool NavigationScheduler::mustLockBackForwardList(Frame* targetFrame) |
| if (!UserGestureIndicator::processingUserGesture() && !targetFrame->document()->loadEventFinished()) |
| return true; |
| + // From the HTML5 spec for location.assign(): |
| + // "If the browsing context's session history contains only one Document, |
| + // and that was the about:blank Document created when the browsing context |
| + // was created, then the navigation must be done with replacement enabled." |
| + if (!targetFrame->loader().stateMachine()->committedMultipleRealLoads() |
| + && equalIgnoringCase(targetFrame->document()->url(), blankURL())) |
| + return true; |
|
abarth-chromium
2013/11/20 05:22:03
Wow, much nicer.
|
| + |
| // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item. |
| // The definition of "during load" is any time before all handlers for the load event have been run. |
| // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this. |
| @@ -425,7 +405,6 @@ void NavigationScheduler::startTimer() |
| return; |
| m_timer.startOneShot(m_redirect->delay()); |
| - m_redirect->didStartTimer(m_frame, &m_timer); |
| InspectorInstrumentation::frameScheduledNavigation(m_frame, m_redirect->delay()); |
| } |