summaryrefslogtreecommitdiffstats
path: root/WebCore/loader/RedirectScheduler.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-02 14:57:50 +0000
committerSteve Block <steveblock@google.com>2010-02-04 15:06:55 +0000
commitd0825bca7fe65beaee391d30da42e937db621564 (patch)
tree7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/loader/RedirectScheduler.cpp
parent3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff)
downloadexternal_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/loader/RedirectScheduler.cpp')
-rw-r--r--WebCore/loader/RedirectScheduler.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/WebCore/loader/RedirectScheduler.cpp b/WebCore/loader/RedirectScheduler.cpp
index f2202cc..4b44422 100644
--- a/WebCore/loader/RedirectScheduler.cpp
+++ b/WebCore/loader/RedirectScheduler.cpp
@@ -32,13 +32,16 @@
#include "config.h"
#include "RedirectScheduler.h"
+#include "BackForwardList.h"
#include "DocumentLoader.h"
#include "Event.h"
#include "FormState.h"
#include "Frame.h"
#include "FrameLoadRequest.h"
#include "FrameLoader.h"
+#include "HistoryItem.h"
#include "HTMLFormElement.h"
+#include "HTMLFrameOwnerElement.h"
#include "Page.h"
#include <wtf/CurrentTime.h>
@@ -218,7 +221,13 @@ void RedirectScheduler::scheduleFormSubmission(const FrameLoadRequest& frameRequ
// This may happen when a frame changes the location of another frame.
bool duringLoad = !m_frame->loader()->committedFirstRealDocumentLoad();
- schedule(new ScheduledRedirection(frameRequest, lockHistory, mustLockBackForwardList(m_frame), event, formState, duringLoad));
+ // If this is a child frame and the form submission was triggered by a script, lock the back/forward list
+ // to match IE and Opera.
+ // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this.
+
+ bool lockBackForwardList = mustLockBackForwardList(m_frame) || (formState->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent());
+
+ schedule(new ScheduledRedirection(frameRequest, lockHistory, lockBackForwardList, event, formState, duringLoad));
}
void RedirectScheduler::scheduleRefresh(bool wasUserGesture)
@@ -258,11 +267,23 @@ void RedirectScheduler::scheduleHistoryNavigation(int steps)
// Invalid history navigations (such as history.forward() during a new load) have the side effect of cancelling any scheduled
// redirects. We also avoid the possibility of cancelling the current load by avoiding the scheduled redirection altogether.
- if (!m_frame->page()->canGoBackOrForward(steps)) {
- cancel();
- return;
- }
-
+ HistoryItem* specifiedEntry = m_frame->page()->backForwardList()->itemAtIndex(steps);
+ if (!specifiedEntry) {
+ cancel();
+ return;
+ }
+
+#if !ENABLE(HISTORY_ALWAYS_ASYNC)
+ // If the specified entry and the current entry have the same document, this is either a state object traversal or a fragment
+ // traversal (or both) and should be performed synchronously.
+ HistoryItem* currentEntry = m_frame->loader()->history()->currentItem();
+ if (currentEntry != specifiedEntry && currentEntry->documentSequenceNumber() == specifiedEntry->documentSequenceNumber()) {
+ m_frame->loader()->history()->goToItem(specifiedEntry, FrameLoadTypeIndexedBackForward);
+ return;
+ }
+#endif
+
+ // In all other cases, schedule the history traversal to occur asynchronously.
schedule(new ScheduledRedirection(steps));
}