Changeset 30001 in webkit
- Timestamp:
- Feb 5, 2008 1:34:18 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 10 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r29998 r30001 1 2008-02-04 Matt Perry <mpComplete@gmail.com>2 3 Reviewed by Darin Adler.4 5 Test cases for fix to http://bugs.webkit.org/show_bug.cgi?id=149596 No back forward entry added for pages created in javascript.7 8 * http/tests/navigation/document-open-adds-history-item-expected.txt: Added.9 * http/tests/navigation/document-open-adds-history-item.html: Added.10 * http/tests/navigation/document-open-delayed-adds-history-item-expected.txt: Added.11 * http/tests/navigation/document-open-delayed-adds-history-item.html: Added.12 * http/tests/navigation/document-open-new-window-adds-history-item-expected.txt: Added.13 * http/tests/navigation/document-open-new-window-adds-history-item.html: Added.14 * http/tests/navigation/document-open-replace-no-history-item-expected.txt: Added.15 * http/tests/navigation/document-open-replace-no-history-item.html: Added.16 17 1 2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca> 18 2 -
trunk/WebCore/ChangeLog
r30000 r30001 6 6 7 7 * ChangeLog: Point out revision 30,000. 8 9 2008-02-04 Matt Perry <mpComplete@gmail.com>10 11 Reviewed by Darin Adler.12 13 Fix for http://bugs.webkit.org/show_bug.cgi?id=1495914 No back forward entry added for pages created in javascript15 16 A new HistoryItem is created for calls to Document::open. Calls to17 Document::write save the written data to a SharedBuffer that is also18 stored on the HistoryItem. When the user navigates back to a19 HistoryItem that has a valid buffer, that data is used for the page20 content.21 22 Tests: http/tests/navigation/document-open-adds-history-item.html23 http/tests/navigation/document-open-delayed-adds-history-item.html24 http/tests/navigation/document-open-new-window-adds-history-item.html25 http/tests/navigation/document-open-replace-no-history-item.html26 27 * bindings/js/JSHTMLDocumentCustom.cpp:28 (WebCore::JSHTMLDocument::open):29 * dom/Document.cpp:30 (WebCore::Document::open):31 (WebCore::Document::write):32 (WebCore::Document::clear):33 * dom/Document.h:34 * history/HistoryItem.cpp:35 (WebCore::HistoryItem::HistoryItem):36 (WebCore::HistoryItem::substituteData):37 (WebCore::HistoryItem::setSubstituteData):38 * history/HistoryItem.h:39 * loader/FrameLoader.cpp:40 (WebCore::FrameLoader::didExplicitOpen):41 (WebCore::FrameLoader::load):42 (WebCore::FrameLoader::reloadAllowingStaleData):43 (WebCore::FrameLoader::reload):44 (WebCore::FrameLoader::shouldTreatURLAsSameAsCurrent):45 (WebCore::FrameLoader::loadItem):46 * loader/FrameLoader.h:47 8 48 9 2008-02-04 Mark Rowe <mrowe@apple.com> -
trunk/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
r29998 r30001 110 110 111 111 // In the case of two parameters or fewer, do a normal document open. 112 113 String mimeType; 114 if (!args[0]->isUndefined()) { 115 mimeType = String(args[0]->toString(exec)).lower(); 116 // Anything other than text/html is treated as plaintext. 117 if (mimeType != "text/html") 118 mimeType = "text/plain"; 119 } else 120 mimeType = "text/html"; 121 122 bool replace = equalIgnoringCase("replace", String(args[1]->toString(exec))); 123 124 static_cast<HTMLDocument*>(impl())->open(mimeType, replace); 112 static_cast<HTMLDocument*>(impl())->open(); 125 113 return jsUndefined(); 126 114 } -
trunk/WebCore/dom/Document.cpp
r29998 r30001 27 27 #include "AXObjectCache.h" 28 28 #include "CDATASection.h" 29 #include "CString.h"30 29 #include "CSSHelper.h" 31 30 #include "CSSStyleSelector.h" … … 55 54 #include "FrameTree.h" 56 55 #include "FrameView.h" 57 #include "HistoryItem.h"58 56 #include "HTMLBodyElement.h" 59 57 #include "HTMLDocument.h" … … 1352 1350 void Document::open() 1353 1351 { 1354 // This method is called by various places in the WebCore code. Arguments1355 // chosen for legacy reasons.1356 open("text/html", true);1357 }1358 1359 void Document::open(const String& mimeType, bool replace)1360 {1361 // Calling open() during an onload handler is like a redirect, so we should not add a new1362 // history item.1363 if (m_processingLoadEvent)1364 replace = true;1365 1366 1352 // This is work that we should probably do in clear(), but we can't have it 1367 1353 // happen when implicitOpen() is called unless we reorganize Frame code. … … 1380 1366 m_frame->loader()->stopAllLoaders(); 1381 1367 } 1382 1368 1383 1369 implicitOpen(); 1384 1370 1385 if (m_frame) { 1386 m_textWrittenByScript = new SharedBuffer; 1387 m_frame->loader()->didExplicitOpen(mimeType, replace, m_textWrittenByScript.get()); 1388 } 1371 if (m_frame) 1372 m_frame->loader()->didExplicitOpen(); 1389 1373 } 1390 1374 … … 1613 1597 printf("Beginning a document.write at %d\n", elapsedTime()); 1614 1598 #endif 1615 1599 1616 1600 if (!m_tokenizer) { 1617 open( "text/html", false);1601 open(); 1618 1602 ASSERT(m_tokenizer); 1619 1603 if (!m_tokenizer) … … 1622 1606 } 1623 1607 m_tokenizer->write(text, false); 1624 1625 if (m_textWrittenByScript) 1626 m_textWrittenByScript->append(reinterpret_cast<const char*>(text.characters()), 1627 text.length() * sizeof(UChar)); 1628 1608 1629 1609 #ifdef INSTRUMENT_LAYOUT_SCHEDULING 1630 1610 if (!ownerElement()) 1631 1611 printf("Ending a document.write at %d\n", elapsedTime()); 1632 #endif 1612 #endif 1633 1613 } 1634 1614 … … 1659 1639 delete m_tokenizer; 1660 1640 m_tokenizer = 0; 1661 1662 m_textWrittenByScript = 0;1663 1641 1664 1642 removeChildren(); -
trunk/WebCore/dom/Document.h
r29998 r30001 33 33 #include "HTMLCollection.h" 34 34 #include "HTMLFormElement.h" 35 #include "SharedBuffer.h"36 35 #include "StringHash.h" 37 36 #include "Timer.h" … … 351 350 352 351 void open(); 353 void open(const String& mimeType, bool replace);354 352 void implicitOpen(); 355 353 void close(); … … 929 927 bool m_isXHTML; 930 928 931 // Contains the text written to the document by script, eg through document.write().932 RefPtr<SharedBuffer> m_textWrittenByScript;933 934 929 unsigned m_numNodeLists; 935 930 -
trunk/WebCore/history/HistoryItem.cpp
r29998 r30001 122 122 , m_formReferrer(item.m_formReferrer) 123 123 , m_rssFeedReferrer(item.m_rssFeedReferrer) 124 , m_substituteData(item.m_substituteData)125 124 { 126 125 if (item.m_formData) … … 367 366 } 368 367 369 const SubstituteData& HistoryItem::substituteData() const370 {371 return m_substituteData;372 }373 374 void HistoryItem::setSubstituteData(const SubstituteData& substituteData)375 {376 m_substituteData = substituteData;377 }378 379 368 void HistoryItem::setFormInfoFromRequest(const ResourceRequest& request) 380 369 { -
trunk/WebCore/history/HistoryItem.h
r29998 r30001 34 34 #include <wtf/RefCounted.h> 35 35 #include "StringHash.h" 36 #include "SubstituteData.h"37 36 #include <wtf/HashMap.h> 38 37 #include <wtf/OwnPtr.h> … … 95 94 String formReferrer() const; 96 95 String rssFeedReferrer() const; 97 const SubstituteData& substituteData() const;98 96 99 97 int visitCount() const; … … 120 118 void setRSSFeedReferrer(const String&); 121 119 void setVisitCount(int); 122 void setSubstituteData(const SubstituteData&);123 120 124 121 void addChildItem(PassRefPtr<HistoryItem>); … … 179 176 String m_rssFeedReferrer; 180 177 181 SubstituteData m_substituteData;182 183 178 // PageCache controls these fields. 184 179 HistoryItem* m_next; -
trunk/WebCore/loader/FrameLoader.cpp
r29998 r30001 697 697 } 698 698 699 void FrameLoader::didExplicitOpen( const String& mimeType, bool replace, SharedBuffer* buffer)699 void FrameLoader::didExplicitOpen() 700 700 { 701 701 m_isComplete = false; … … 712 712 if (m_frame->document()->url() != "about:blank") 713 713 m_URL = m_frame->document()->url(); 714 715 bool isItemNew = false;716 717 // Add a HistoryItem for this open.718 RefPtr<HistoryItem> item;719 if (replace && m_currentHistoryItem)720 item = m_currentHistoryItem;721 else {722 isItemNew = true;723 item = new HistoryItem(m_URL, m_frame->tree()->name(), m_frame->tree()->parent() ? m_frame->tree()->parent()->tree()->name() : "", "");724 item->setIsTargetItem(true);725 m_previousHistoryItem = m_currentHistoryItem;726 m_currentHistoryItem = item;727 }728 729 // Create an alternate URL to distinguish this as a generated page.730 KURL generatedURL("webkitgenerated:" + m_frame->document()->url());731 732 item->setSubstituteData(SubstituteData(buffer, mimeType, "UTF-16", m_URL, generatedURL));733 734 if (isItemNew)735 if (Page* page = m_frame->page())736 page->backForwardList()->addItem(item);737 714 } 738 715 … … 2101 2078 void FrameLoader::load(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState) 2102 2079 { 2103 load(request, action, type, formState, SubstituteData()); 2104 } 2105 2106 void FrameLoader::load(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState, const SubstituteData& substituteData) 2107 { 2108 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, substituteData); 2080 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, SubstituteData()); 2109 2081 2110 2082 loader->setTriggeringAction(action); … … 2307 2279 request.setCachePolicy(ReturnCacheDataElseLoad); 2308 2280 2309 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, m_currentHistoryItem->substituteData()); 2310 setProvisionalHistoryItem(m_currentHistoryItem); 2311 2281 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, SubstituteData()); 2312 2282 setPolicyDocumentLoader(loader.get()); 2313 2283 … … 2334 2304 initialRequest = ResourceRequest(unreachableURL); 2335 2305 2336 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(initialRequest, m_currentHistoryItem->substituteData()); 2337 setProvisionalHistoryItem(m_currentHistoryItem); 2306 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(initialRequest, SubstituteData()); 2338 2307 2339 2308 ResourceRequest& request = loader->request(); … … 3821 3790 if (!m_currentHistoryItem) 3822 3791 return false; 3823 if (m_currentHistoryItem->substituteData().isValid())3824 return url == m_currentHistoryItem->substituteData().responseURL();3825 3792 return url == m_currentHistoryItem->url() || url == m_currentHistoryItem->originalURL(); 3826 3793 } … … 4132 4099 } 4133 4100 4134 load(request, action, loadType, 0 , item->substituteData());4101 load(request, action, loadType, 0); 4135 4102 } 4136 4103 } -
trunk/WebCore/loader/FrameLoader.h
r29998 r30001 155 155 void load(const ResourceRequest&, const String& frameName); 156 156 void load(const ResourceRequest&, const NavigationAction&, FrameLoadType, PassRefPtr<FormState>); 157 void load(const ResourceRequest&, const NavigationAction&, FrameLoadType, PassRefPtr<FormState>, const SubstituteData&);158 157 159 158 void load(DocumentLoader*); … … 290 289 bool closeURL(); 291 290 292 void didExplicitOpen( const String& mimeType, bool replace, SharedBuffer*);291 void didExplicitOpen(); 293 292 294 293 KURL iconURL();
Note: See TracChangeset
for help on using the changeset viewer.