Changeset 53869 in webkit
- Timestamp:
- Jan 26, 2010 2:59:44 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r53868 r53869 1 2010-01-26 Adam Roben <aroben@apple.com> 2 3 No review, rolling out r53861. 4 http://trac.webkit.org/changeset/53861 5 https://bugs.webkit.org/show_bug.cgi?id=33224 6 7 Caused 2 regression tests to fail. 8 9 * fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt: 10 * fast/loader/stateobjects/document-destroyed-navigate-back.html: 11 1 12 2010-01-26 Dan Bernstein <mitz@apple.com> 2 13 -
trunk/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt
r53861 r53869 6 6 ALERT: Last path component of location is document-destroyed-navigate-back.html?SecondEntryWillLaterBeReactivated 7 7 ALERT: State popped - SecondEntryWillLaterBeReactivated (type string) 8 main frame - has 1 onunload handler(s) 9 ALERT: Last path component of location is document-destroyed-navigate-back.html?FirstEntryWillLaterBeReactivated 8 10 ALERT: State popped - FirstEntryWillLaterBeReactivated (type string) 9 11 ALERT: Test complete -
trunk/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
r53861 r53869 25 25 { 26 26 alert("Last path component of location is " + lastPathComponent()); 27 history.back(); 27 28 } 28 29 -
trunk/WebCore/ChangeLog
r53868 r53869 1 2010-01-26 Adam Roben <aroben@apple.com> 2 3 No review, rolling out r53861. 4 http://trac.webkit.org/changeset/53861 5 https://bugs.webkit.org/show_bug.cgi?id=33224 6 7 Caused 2 regression tests to fail. 8 9 * dom/Document.cpp: 10 (WebCore::Document::detach): 11 (WebCore::Document::registerHistoryItem): 12 (WebCore::Document::unregisterHistoryItem): 13 * dom/Document.h: 14 * history/BackForwardList.cpp: 15 (WebCore::BackForwardList::pushStateItem): 16 * history/BackForwardListChromium.cpp: 17 (WebCore::BackForwardList::pushStateItem): 18 * history/HistoryItem.cpp: 19 (WebCore::HistoryItem::HistoryItem): 20 (WebCore::HistoryItem::~HistoryItem): 21 (WebCore::HistoryItem::setStateObject): 22 (WebCore::HistoryItem::setDocument): 23 (WebCore::HistoryItem::documentDetached): 24 * history/HistoryItem.h: 25 (WebCore::HistoryItem::document): 26 * loader/FrameLoader.cpp: 27 (WebCore::FrameLoader::navigateWithinDocument): 28 (WebCore::FrameLoader::loadItem): 29 * loader/HistoryController.cpp: 30 (WebCore::HistoryController::updateBackForwardListForFragmentScroll): 31 (WebCore::HistoryController::pushState): 32 (WebCore::HistoryController::replaceState): 33 * loader/RedirectScheduler.cpp: 34 (WebCore::RedirectScheduler::scheduleHistoryNavigation): 35 * page/History.cpp: 36 (WebCore::History::stateObjectAdded): 37 * page/Page.cpp: 38 (WebCore::Page::goToItem): 39 1 40 2010-01-26 Dan Bernstein <mitz@apple.com> 2 41 -
trunk/WebCore/dom/Document.cpp
r53861 r53869 1549 1549 render->destroy(); 1550 1550 1551 HashSet<RefPtr<HistoryItem> > associatedHistoryItems; 1552 associatedHistoryItems.swap(m_associatedHistoryItems); 1553 HashSet<RefPtr<HistoryItem> >::iterator end = associatedHistoryItems.end(); 1554 for (HashSet<RefPtr<HistoryItem> >::iterator i = associatedHistoryItems.begin(); i != end; ++i) 1555 (*i)->documentDetached(this); 1556 1551 1557 // This is required, as our Frame might delete itself as soon as it detaches 1552 1558 // us. However, this violates Node::detach() semantics, as it's never … … 4489 4495 } 4490 4496 4497 void Document::registerHistoryItem(HistoryItem* item) 4498 { 4499 ASSERT(!m_associatedHistoryItems.contains(item)); 4500 m_associatedHistoryItems.add(item); 4501 } 4502 4503 void Document::unregisterHistoryItem(HistoryItem* item) 4504 { 4505 ASSERT(m_associatedHistoryItems.contains(item) || m_associatedHistoryItems.isEmpty()); 4506 m_associatedHistoryItems.remove(item); 4507 } 4508 4491 4509 void Document::updateSandboxFlags() 4492 4510 { -
trunk/WebCore/dom/Document.h
r53861 r53869 908 908 void updateURLForPushOrReplaceState(const KURL&); 909 909 void statePopped(SerializedScriptValue*); 910 void registerHistoryItem(HistoryItem* item); 911 void unregisterHistoryItem(HistoryItem* item); 910 912 911 913 void updateSandboxFlags(); // Set sandbox flags as determined by the frame. -
trunk/WebCore/history/BackForwardList.cpp
r53861 r53869 240 240 { 241 241 ASSERT(newItem); 242 ASSERT(newItem->document()); 242 243 ASSERT(newItem->stateObject()); 243 244 … … 245 246 ASSERT(current); 246 247 248 Document* newItemDocument = newItem->document(); 249 247 250 addItem(newItem); 248 251 249 if (!current->stateObject()) 252 if (!current->document()) { 253 current->setDocument(newItemDocument); 250 254 current->setStateObject(SerializedScriptValue::create()); 255 } 251 256 } 252 257 -
trunk/WebCore/history/BackForwardListChromium.cpp
r53861 r53869 124 124 void BackForwardList::pushStateItem(PassRefPtr<HistoryItem> newItem) 125 125 { 126 RefPtr<HistoryItem> current = m_client->currentItem(); 127 128 addItem(newItem); 129 130 if (!current->stateObject()) 131 current->setStateObject(SerializedScriptValue::create()); 126 // FIXME: Need to implement state support for chromium. 132 127 } 133 128 -
trunk/WebCore/history/HistoryItem.cpp
r53861 r53869 34 34 #include "ResourceRequest.h" 35 35 #include <stdio.h> 36 #include <wtf/CurrentTime.h>37 36 38 37 namespace WebCore { 39 40 static long long generateDocumentSequenceNumber()41 {42 // Initialize to the current time to reduce the likelihood of generating43 // identifiers that overlap with those from past/future browser sessions.44 static long long next = static_cast<long long>(currentTime() * 1000000.0);45 return ++next;46 }47 38 48 39 static void defaultNotifyHistoryItemChanged(HistoryItem*) … … 58 49 , m_isTargetItem(false) 59 50 , m_visitCount(0) 60 , m_document SequenceNumber(generateDocumentSequenceNumber())51 , m_document(0) 61 52 { 62 53 } … … 71 62 , m_isTargetItem(false) 72 63 , m_visitCount(0) 73 , m_document SequenceNumber(generateDocumentSequenceNumber())64 , m_document(0) 74 65 { 75 66 iconDatabase()->retainIconForPageURL(m_urlString); … … 86 77 , m_isTargetItem(false) 87 78 , m_visitCount(0) 88 , m_document SequenceNumber(generateDocumentSequenceNumber())79 , m_document(0) 89 80 { 90 81 iconDatabase()->retainIconForPageURL(m_urlString); … … 102 93 , m_isTargetItem(false) 103 94 , m_visitCount(0) 104 , m_document SequenceNumber(generateDocumentSequenceNumber())95 , m_document(0) 105 96 { 106 97 iconDatabase()->retainIconForPageURL(m_urlString); … … 110 101 { 111 102 ASSERT(!m_cachedPage); 103 ASSERT(!m_document); 112 104 iconDatabase()->releaseIconForPageURL(m_urlString); 113 105 #if PLATFORM(ANDROID) … … 134 126 , m_dailyVisitCounts(item.m_dailyVisitCounts) 135 127 , m_weeklyVisitCounts(item.m_weeklyVisitCounts) 136 , m_document SequenceNumber(generateDocumentSequenceNumber())128 , m_document(0) 137 129 , m_formContentType(item.m_formContentType) 138 130 { … … 406 398 void HistoryItem::setStateObject(PassRefPtr<SerializedScriptValue> object) 407 399 { 400 ASSERT(m_document); 408 401 m_stateObject = object; 402 } 403 404 void HistoryItem::setDocument(Document* document) 405 { 406 if (m_document == document) 407 return; 408 409 if (m_document) 410 m_document->unregisterHistoryItem(this); 411 if (document) 412 document->registerHistoryItem(this); 413 414 m_document = document; 415 } 416 417 void HistoryItem::documentDetached(Document* document) 418 { 419 ASSERT_UNUSED(document, m_document == document); 420 m_document = 0; 409 421 } 410 422 -
trunk/WebCore/history/HistoryItem.h
r53861 r53869 136 136 void setStateObject(PassRefPtr<SerializedScriptValue> object); 137 137 SerializedScriptValue* stateObject() const { return m_stateObject.get(); } 138 139 void setDocumentSequenceNumber(long long number) { m_documentSequenceNumber = number; }140 long long documentSequenceNumber() const { return m_documentSequenceNumber; }138 void setDocument(Document* document); 139 Document* document() const { return m_document; } 140 void documentDetached(Document*); 141 141 142 142 void setFormInfoFromRequest(const ResourceRequest&); … … 245 245 // Support for HTML5 History 246 246 RefPtr<SerializedScriptValue> m_stateObject; 247 long long m_documentSequenceNumber;247 Document* m_document; 248 248 249 249 // info used to repost form data -
trunk/WebCore/loader/FrameLoader.cpp
r53861 r53869 3694 3694 void FrameLoader::navigateWithinDocument(HistoryItem* item) 3695 3695 { 3696 ASSERT( item->documentSequenceNumber() == history()->currentItem()->documentSequenceNumber());3696 ASSERT(!item->document() || item->document() == m_frame->document()); 3697 3697 3698 3698 // Save user view state to the current history item here since we don't do a normal load. … … 3815 3815 // - Navigating to an anchor within the page, with no form data stored on the target item or the current history entry, 3816 3816 // and the URLs in the frame tree match the history item for fragment scrolling. 3817 bool sameDocumentNavigation = (!item->formData() && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item)) || item->document SequenceNumber() == history()->currentItem()->documentSequenceNumber();3817 bool sameDocumentNavigation = (!item->formData() && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item)) || item->document() == m_frame->document(); 3818 3818 3819 3819 #if ENABLE(WML) -
trunk/WebCore/loader/HistoryController.cpp
r53861 r53869 107 107 { 108 108 updateBackForwardListClippedAtTarget(false); 109 110 // Since the document isn't changed as a result of a fragment scroll, we should111 // preserve the DocumentSequenceNumber of the previous item.112 m_currentItem->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber());113 109 } 114 110 … … 640 636 641 637 // Override data in the target item to reflect the pushState() arguments. 638 item->setDocument(m_frame->document()); 642 639 item->setTitle(title); 643 640 item->setStateObject(stateObject); 644 641 item->setURLString(urlString); 645 646 // Since the document isn't changed as a result of a pushState call, we647 // should preserve the DocumentSequenceNumber of the previous item.648 item->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber());649 642 650 643 page->backForwardList()->pushStateItem(item.release()); … … 657 650 HistoryItem* current = page->backForwardList()->currentItem(); 658 651 ASSERT(current); 659 652 653 ASSERT(!current->document() || current->document() == m_frame->document()); 654 current->setDocument(m_frame->document()); 655 660 656 if (!urlString.isEmpty()) 661 657 current->setURLString(urlString); -
trunk/WebCore/loader/RedirectScheduler.cpp
r53861 r53869 278 278 // traversal (or both) and should be performed synchronously. 279 279 HistoryItem* currentEntry = m_frame->loader()->history()->currentItem(); 280 if (currentEntry != specifiedEntry && currentEntry->documentSequenceNumber() == specifiedEntry->documentSequenceNumber()) {280 if (currentEntry != specifiedEntry && specifiedEntry->document() && currentEntry->document() == specifiedEntry->document()) { 281 281 m_frame->loader()->history()->goToItem(specifiedEntry, FrameLoadTypeIndexedBackForward); 282 282 return; -
trunk/WebCore/page/History.cpp
r53861 r53869 113 113 m_frame->loader()->history()->replaceState(data, title, fullURL.string()); 114 114 115 if (!urlString.isEmpty()) 115 if (!urlString.isEmpty()) { 116 116 m_frame->document()->updateURLForPushOrReplaceState(fullURL); 117 118 if (stateObjectType == StateObjectPush)119 m_frame->loader()->client()->dispatchDidPushStateWithinPage();120 else if (stateObjectType == StateObjectReplace)121 m_frame->loader()->client()->dispatchDidReplaceStateWithinPage();117 if (stateObjectType == StateObjectPush) 118 m_frame->loader()->client()->dispatchDidPushStateWithinPage(); 119 else if (stateObjectType == StateObjectReplace) 120 m_frame->loader()->client()->dispatchDidReplaceStateWithinPage(); 121 } 122 122 } 123 123 -
trunk/WebCore/page/Page.cpp
r53861 r53869 291 291 { 292 292 // Abort any current load unless we're navigating the current document to a new state object 293 if (!item->stateObject() || item->document SequenceNumber() != m_mainFrame->loader()->history()->currentItem()->documentSequenceNumber()) {293 if (!item->stateObject() || item->document() != m_mainFrame->document()) { 294 294 // Define what to do with any open database connections. By default we stop them and terminate the database thread. 295 295 DatabasePolicy databasePolicy = DatabasePolicyStop;
Note: See TracChangeset
for help on using the changeset viewer.