Changeset 197244 in webkit
- Timestamp:
- Feb 26, 2016 11:44:07 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r197240 r197244 1 2016-02-26 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Network cache: old pages returned by disk cache on history navigation after session is restored 4 https://bugs.webkit.org/show_bug.cgi?id=153230 5 6 Reviewed by Chris Dumez. 7 8 Add a flag to HistoryItem to mark them as restored from session 9 and use it from the FrameLoader to not change the policy request 10 when navigating to a history item that was restored from session, 11 except for iOS port. 12 13 * history/HistoryItem.h: 14 (WebCore::HistoryItem::setWasRestoredFromSession): 15 (WebCore::HistoryItem::wasRestoredFromSession): 16 * loader/FrameLoader.cpp: 17 (WebCore::FrameLoader::loadDifferentDocumentItem): 18 1 19 2016-02-26 Michael Catanzaro <mcatanzaro@igalia.com> 2 20 -
trunk/Source/WebCore/history/HistoryItem.h
r194492 r197244 206 206 void notifyChanged(); 207 207 208 void setWasRestoredFromSession(bool wasRestoredFromSession) { m_wasRestoredFromSession = wasRestoredFromSession; } 209 bool wasRestoredFromSession() const { return m_wasRestoredFromSession; } 210 208 211 private: 209 212 WEBCORE_EXPORT HistoryItem(); … … 232 235 bool m_lastVisitWasFailure; 233 236 bool m_isTargetItem; 237 bool m_wasRestoredFromSession { false }; 234 238 235 239 std::unique_ptr<Vector<String>> m_redirectURLs; -
trunk/Source/WebCore/loader/FrameLoader.cpp
r196807 r197244 3337 3337 case FrameLoadType::Back: 3338 3338 case FrameLoadType::Forward: 3339 case FrameLoadType::IndexedBackForward: 3340 request.setCachePolicy(ReturnCacheDataElseLoad); 3339 case FrameLoadType::IndexedBackForward: { 3340 #if PLATFORM(IOS) 3341 bool allowStaleData = true; 3342 #else 3343 bool allowStaleData = !item.wasRestoredFromSession(); 3344 #endif 3345 if (allowStaleData) 3346 request.setCachePolicy(ReturnCacheDataElseLoad); 3347 item.setWasRestoredFromSession(false); 3341 3348 break; 3349 } 3342 3350 case FrameLoadType::Standard: 3343 3351 case FrameLoadType::RedirectWithLockedBackForwardList: -
trunk/Source/WebKit2/ChangeLog
r197239 r197244 1 2016-02-26 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Network cache: old pages returned by disk cache on history navigation after session is restored 4 https://bugs.webkit.org/show_bug.cgi?id=153230 5 6 Reviewed by Chris Dumez. 7 8 Since r181734, the network cache never revalidates resources for 9 history navigation. This is good for the memory cache, but in the 10 case of disk cache, we might end up with outdated pages when 11 restoring the session. When restoring the session happens because 12 of an API request (we also restore the session when recovering 13 from a web process crash), we should revalidate back forward list 14 requests in the disk cache if needed. This will only happen the 15 first time they are loaded after a session restore. After a web process 16 crash, resources will be used uncondionally from the disk cache. 17 18 * WebProcess/WebPage/WebBackForwardListProxy.cpp: 19 (WebKit::WebBackForwardListProxy::addItemFromUIProcess): Use Ref&& 20 instead of PassRefPtr. 21 * WebProcess/WebPage/WebBackForwardListProxy.h: 22 * WebProcess/WebPage/WebPage.cpp: 23 (WebKit::WePage::WebPage): Call restoreSessionInternal passing 24 No as restoredByAPIRequest parameter. 25 (WebKit::WebPage::restoreSessionInternal): Set restoredFromSession 26 flag to the created HistoryItem if the item was restored from 27 session by an API request. 28 (WebKit::WebPage::restoreSession): Call restoreSessionInternal 29 passing Yes as restoredByAPIRequest parameter. 30 * WebProcess/WebPage/WebPage.h: 31 1 32 2016-02-26 Michael Catanzaro <mcatanzaro@igalia.com> 2 33 -
trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
r184054 r197244 95 95 } 96 96 97 void WebBackForwardListProxy::addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem> prpItem, uint64_t pageID) 98 { 99 RefPtr<HistoryItem> item = prpItem; 100 97 void WebBackForwardListProxy::addItemFromUIProcess(uint64_t itemID, Ref<HistoryItem>&& item, uint64_t pageID) 98 { 101 99 // This item/itemID pair should not already exist in our maps. 102 ASSERT(!historyItemToIDMap().contains(item. get()));100 ASSERT(!historyItemToIDMap().contains(item.ptr())); 103 101 ASSERT(!idToHistoryItemMap().contains(itemID)); 104 102 105 historyItemToIDMap().set<ItemAndPageID>(item , { .itemID = itemID, .pageID = pageID });106 idToHistoryItemMap().set(itemID, item );103 historyItemToIDMap().set<ItemAndPageID>(item.ptr(), { .itemID = itemID, .pageID = pageID }); 104 idToHistoryItemMap().set(itemID, item.ptr()); 107 105 } 108 106 -
trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h
r186566 r197244 43 43 static void removeItem(uint64_t itemID); 44 44 45 static void addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem>, uint64_t pageID);45 static void addItemFromUIProcess(uint64_t itemID, Ref<WebCore::HistoryItem>&&, uint64_t pageID); 46 46 static void setHighestItemIDFromUIProcess(uint64_t itemID); 47 47 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r197114 r197244 491 491 492 492 if (!parameters.itemStates.isEmpty()) 493 restoreSession (parameters.itemStates);493 restoreSessionInternal(parameters.itemStates, WasRestoredByAPIRequest::No); 494 494 495 495 if (parameters.sessionID.isValid()) … … 2232 2232 } 2233 2233 2234 void WebPage::restoreSessionInternal(const Vector<BackForwardListItemState>& itemStates, WasRestoredByAPIRequest restoredByAPIRequest) 2235 { 2236 for (const auto& itemState : itemStates) { 2237 auto historyItem = toHistoryItem(itemState.pageState); 2238 historyItem->setWasRestoredFromSession(restoredByAPIRequest == WasRestoredByAPIRequest::Yes); 2239 WebBackForwardListProxy::addItemFromUIProcess(itemState.identifier, WTFMove(historyItem), m_pageID); 2240 } 2241 } 2242 2234 2243 void WebPage::restoreSession(const Vector<BackForwardListItemState>& itemStates) 2235 2244 { 2236 for (const auto& itemState : itemStates) 2237 WebBackForwardListProxy::addItemFromUIProcess(itemState.identifier, toHistoryItem(itemState.pageState), m_pageID); 2245 restoreSessionInternal(itemStates, WasRestoredByAPIRequest::Yes); 2238 2246 } 2239 2247 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r197213 r197244 1021 1021 void loadURLInFrame(const String&, uint64_t frameID); 1022 1022 1023 enum class WasRestoredByAPIRequest { No, Yes }; 1024 void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest); 1023 1025 void restoreSession(const Vector<BackForwardListItemState>&); 1024 1026 void didRemoveBackForwardItem(uint64_t);
Note: See TracChangeset
for help on using the changeset viewer.