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

Unified Diff: Source/core/loader/NavigationScheduler.cpp

Issue 76653002: Simplify setting lockBackForwardList() in NavigationScheduler. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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());
}
« Source/core/loader/FrameLoader.cpp ('K') | « Source/core/loader/HistoryController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698