OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 331 } |
332 | 332 |
333 void Page::goToItem(HistoryItem* item, FrameLoadType type) | 333 void Page::goToItem(HistoryItem* item, FrameLoadType type) |
334 { | 334 { |
335 if (defersLoading()) | 335 if (defersLoading()) |
336 return; | 336 return; |
337 | 337 |
338 // stopAllLoaders may end up running onload handlers, which could cause furt
her history traversals that may lead to the passed in HistoryItem | 338 // stopAllLoaders may end up running onload handlers, which could cause furt
her history traversals that may lead to the passed in HistoryItem |
339 // being deref()-ed. Make sure we can still use it with HistoryController::g
oToItem later. | 339 // being deref()-ed. Make sure we can still use it with HistoryController::g
oToItem later. |
340 RefPtr<HistoryItem> protector(item); | 340 RefPtr<HistoryItem> protector(item); |
341 | |
342 // Abort any current load unless we're navigating the current document to a
new state object | |
343 HistoryItem* currentItem = m_mainFrame->loader()->history()->currentItem(); | |
344 if (!item->stateObject() || !currentItem || item->documentSequenceNumber() !
= currentItem->documentSequenceNumber() || item == currentItem) { | |
345 // Define what to do with any open database connections. By default we s
top them and terminate the database thread. | |
346 DatabasePolicy databasePolicy = DatabasePolicyStop; | |
347 | 341 |
348 #if ENABLE(DATABASE) | 342 if (m_mainFrame->loader()->history()->shouldStopLoadingForHistoryItem(item)) |
349 // If we're navigating the history via a fragment on the same document,
then we do not want to stop databases. | 343 m_mainFrame->loader()->stopAllLoaders(); |
350 const KURL& currentURL = m_mainFrame->loader()->url(); | |
351 const KURL& newURL = item->url(); | |
352 | |
353 if (newURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(cu
rrentURL, newURL)) | |
354 databasePolicy = DatabasePolicyContinue; | |
355 #endif | |
356 | 344 |
357 m_mainFrame->loader()->stopAllLoaders(databasePolicy); | |
358 } | |
359 | |
360 m_mainFrame->loader()->history()->goToItem(item, type); | 345 m_mainFrame->loader()->history()->goToItem(item, type); |
361 } | 346 } |
362 | 347 |
363 int Page::getHistoryLength() | 348 int Page::getHistoryLength() |
364 { | 349 { |
365 return backForward()->backCount() + 1 + backForward()->forwardCount(); | 350 return backForward()->backCount() + 1 + backForward()->forwardCount(); |
366 } | 351 } |
367 | 352 |
368 void Page::setGlobalHistoryItem(HistoryItem* item) | 353 void Page::setGlobalHistoryItem(HistoryItem* item) |
369 { | 354 { |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 , deviceOrientationClient(0) | 911 , deviceOrientationClient(0) |
927 , speechInputClient(0) | 912 , speechInputClient(0) |
928 { | 913 { |
929 } | 914 } |
930 | 915 |
931 Page::PageClients::~PageClients() | 916 Page::PageClients::~PageClients() |
932 { | 917 { |
933 } | 918 } |
934 | 919 |
935 } // namespace WebCore | 920 } // namespace WebCore |
OLD | NEW |