~ubuntu-branches/ubuntu/lucid/webkit/lucid-updates

« back to all changes in this revision

Viewing changes to WebCore/loader/RedirectScheduler.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2010-02-04 19:30:57 UTC
  • mfrom: (1.2.8 upstream) (4.3.9 sid)
  • Revision ID: james.westby@ubuntu.com-20100204193057-d3018lm1fipb0703
* New upstream release
* debian/copyright:
- Updated with changes since 1.1.19.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "config.h"
33
33
#include "RedirectScheduler.h"
34
34
 
 
35
#include "BackForwardList.h"
35
36
#include "DocumentLoader.h"
36
37
#include "Event.h"
37
38
#include "FormState.h"
38
39
#include "Frame.h"
39
40
#include "FrameLoadRequest.h"
40
41
#include "FrameLoader.h"
 
42
#include "HistoryItem.h"
41
43
#include "HTMLFormElement.h"
42
44
#include "HTMLFrameOwnerElement.h"
43
45
#include "Page.h"
265
267
 
266
268
    // Invalid history navigations (such as history.forward() during a new load) have the side effect of cancelling any scheduled
267
269
    // redirects. We also avoid the possibility of cancelling the current load by avoiding the scheduled redirection altogether.
268
 
    if (!m_frame->page()->canGoBackOrForward(steps)) { 
269
 
        cancel(); 
270
 
        return; 
271
 
    } 
272
 
 
 
270
    HistoryItem* specifiedEntry = m_frame->page()->backForwardList()->itemAtIndex(steps);
 
271
    if (!specifiedEntry) {
 
272
        cancel();
 
273
        return;
 
274
    }
 
275
    
 
276
#if !ENABLE(HISTORY_ALWAYS_ASYNC)
 
277
    // If the specified entry and the current entry have the same document, this is either a state object traversal or a fragment 
 
278
    // traversal (or both) and should be performed synchronously.
 
279
    HistoryItem* currentEntry = m_frame->loader()->history()->currentItem();
 
280
    if (currentEntry != specifiedEntry && currentEntry->documentSequenceNumber() == specifiedEntry->documentSequenceNumber()) {
 
281
        m_frame->loader()->history()->goToItem(specifiedEntry, FrameLoadTypeIndexedBackForward);
 
282
        return;
 
283
    }
 
284
#endif
 
285
    
 
286
    // In all other cases, schedule the history traversal to occur asynchronously.
273
287
    schedule(new ScheduledRedirection(steps));
274
288
}
275
289