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

Unified Diff: WebCore/loader/RedirectScheduler.cpp

Issue 3405033: Merge 67716 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/events/popup-blocked-from-history-reload-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/loader/RedirectScheduler.cpp
===================================================================
--- WebCore/loader/RedirectScheduler.cpp (revision 68304)
+++ WebCore/loader/RedirectScheduler.cpp (working copy)
@@ -33,6 +33,7 @@
#include "RedirectScheduler.h"
#include "BackForwardList.h"
+#include "DOMWindow.h"
#include "DocumentLoader.h"
#include "Event.h"
#include "FormState.h"
@@ -41,9 +42,9 @@
#include "FrameLoadRequest.h"
#include "FrameLoader.h"
#include "FrameLoaderStateMachine.h"
-#include "HistoryItem.h"
#include "HTMLFormElement.h"
#include "HTMLFrameOwnerElement.h"
+#include "HistoryItem.h"
#include "Page.h"
#include "UserGestureIndicator.h"
#include <wtf/CurrentTime.h>
@@ -52,12 +53,13 @@
class ScheduledNavigation : public Noncopyable {
public:
- ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange)
+ ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange, bool wasUserGesture)
: m_delay(delay)
, m_lockHistory(lockHistory)
, m_lockBackForwardList(lockBackForwardList)
, m_wasDuringLoad(wasDuringLoad)
, m_isLocationChange(isLocationChange)
+ , m_wasUserGesture(wasUserGesture)
{
}
virtual ~ScheduledNavigation() { }
@@ -73,6 +75,7 @@
bool lockBackForwardList() const { return m_lockBackForwardList; }
bool wasDuringLoad() const { return m_wasDuringLoad; }
bool isLocationChange() const { return m_isLocationChange; }
+ bool wasUserGesture() const { return m_wasUserGesture; }
private:
double m_delay;
@@ -80,22 +83,22 @@
bool m_lockBackForwardList;
bool m_wasDuringLoad;
bool m_isLocationChange;
+ bool m_wasUserGesture;
};
class ScheduledURLNavigation : public ScheduledNavigation {
public:
ScheduledURLNavigation(double delay, const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, bool duringLoad, bool isLocationChange)
- : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange)
+ : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange, wasUserGesture)
, m_url(url)
, m_referrer(referrer)
- , m_wasUserGesture(wasUserGesture)
, m_haveToldClient(false)
{
}
virtual void fire(Frame* frame)
{
- frame->loader()->changeLocation(KURL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), m_wasUserGesture, false);
+ frame->loader()->changeLocation(KURL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), wasUserGesture(), false);
}
virtual void didStartTimer(Frame* frame, Timer<RedirectScheduler>* timer)
@@ -115,12 +118,10 @@
String url() const { return m_url; }
String referrer() const { return m_referrer; }
- bool wasUserGesture() const { return m_wasUserGesture; }
private:
String m_url;
String m_referrer;
- bool m_wasUserGesture;
bool m_haveToldClient;
};
@@ -151,14 +152,17 @@
class ScheduledHistoryNavigation : public ScheduledNavigation {
public:
- explicit ScheduledHistoryNavigation(int historySteps) : ScheduledNavigation(0, false, false, false, true), m_historySteps(historySteps) { }
+ explicit ScheduledHistoryNavigation(int historySteps, bool wasUserGesture) : ScheduledNavigation(0, false, false, false, true, wasUserGesture), m_historySteps(historySteps) { }
virtual void fire(Frame* frame)
{
+ UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
+
FrameLoader* loader = frame->loader();
if (!m_historySteps) {
// Special case for go(0) from a frame -> reload only the frame
- loader->urlSelected(loader->url(), "", 0, lockHistory(), lockBackForwardList(), false, SendReferrer);
+ // To follow Firefox and IE's behavior, history reload can only navigate the self frame.
+ loader->urlSelected(loader->url(), "_self", 0, lockHistory(), lockBackForwardList(), wasUserGesture(), SendReferrer);
return;
}
// go(i!=0) from a frame navigates into the history of the frame only,
@@ -173,17 +177,16 @@
class ScheduledFormSubmission : public ScheduledNavigation {
public:
ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad, bool wasUserGesture)
- : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true)
+ : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true, wasUserGesture)
, m_submission(submission)
, m_haveToldClient(false)
- , m_wasUserGesture(wasUserGesture)
{
ASSERT(m_submission->state());
}
virtual void fire(Frame* frame)
{
- UserGestureIndicator gestureIndicator(m_wasUserGesture ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
+ UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
// The submitForm function will find a target frame before using the redirection timer.
// Now that the timer has fired, we need to repeat the security check which normally is done when
@@ -214,7 +217,6 @@
private:
RefPtr<FormSubmission> m_submission;
bool m_haveToldClient;
- bool m_wasUserGesture;
};
RedirectScheduler::RedirectScheduler(Frame* frame)
@@ -344,9 +346,9 @@
cancel();
return;
}
-
+
// In all other cases, schedule the history traversal to occur asynchronously.
- schedule(adoptPtr(new ScheduledHistoryNavigation(steps)));
+ schedule(adoptPtr(new ScheduledHistoryNavigation(steps, m_frame->loader()->isProcessingUserGesture())));
}
void RedirectScheduler::timerFired(Timer<RedirectScheduler>*)
« no previous file with comments | « LayoutTests/fast/events/popup-blocked-from-history-reload-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698