WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Address review comment before landing.
cap_session_data_size.patch (text/plain), 4.77 KB, created by
Yongjun Zhang
on 2016-03-18 23:16:31 PDT
(
hide
)
Description:
Address review comment before landing.
Filename:
MIME Type:
Creator:
Yongjun Zhang
Created:
2016-03-18 23:16:31 PDT
Size:
4.77 KB
patch
obsolete
>commit 8dbb0f4ef752b9e07835fa5417b0319b78f7ecff >Author: Yongjun Zhang <yongjun_zhang@apple.com> >Date: Fri Mar 18 14:36:55 2016 -0700 > > https://bugs.webkit.org/show_bug.cgi?id=155664 > Consider to cap the size of session history data. > > In iOS, if the total history entries data exceeds a threshold (2MB at the moment), don't > accumulate more data into the session state blob. > > Reviewed by Darin Adler. > > * UIProcess/mac/LegacySessionStateCoding.cpp: > (WebKit::encodeSessionHistory): Stop encoding further history entries data into session state > if the total size exceed 2MB in iOS. > >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 36dd417..566227e 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,17 @@ >+2016-03-18 Yongjun Zhang <yongjun_zhang@apple.com> >+ >+ https://bugs.webkit.org/show_bug.cgi?id=155664 >+ Consider to cap the size of session history data. >+ >+ In iOS, if the total history entries data exceeds a threshold (2MB at the moment), don't >+ accumulate more data into the session state blob. >+ >+ Reviewed by Darin Adler. >+ >+ * UIProcess/mac/LegacySessionStateCoding.cpp: >+ (WebKit::encodeSessionHistory): Stop encoding further history entries data into session state >+ if the total size exceed 2MB in iOS. >+ > 2016-03-18 Antti Koivisto <antti@apple.com> > > Protect against excessive cache traversal >diff --git a/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp b/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp >index a21d48c..45db70a 100644 >--- a/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp >+++ b/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp >@@ -59,6 +59,13 @@ static const CFStringRef sessionHistoryEntryShouldOpenExternalURLsPolicyKey = CF > // Session history entry data. > const uint32_t sessionHistoryEntryDataVersion = 2; > >+// Maximum size for subframe session data. >+#if PLATFORM(IOS) >+static const uint32_t maximumSessionStateDataSize = 2 * 1024 * 1024; >+#else >+static const uint32_t maximumSessionStateDataSize = std::numeric_limits<uint32_t>::max(); >+#endif >+ > template<typename T> void isValidEnum(T); > > class HistoryEntryDataEncoder { >@@ -421,22 +428,36 @@ static RetainPtr<CFDictionaryRef> encodeSessionHistory(const BackForwardListStat > return createDictionary({ { sessionHistoryVersionKey, sessionHistoryVersionNumber.get() } }); > > auto entries = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, backForwardListState.items.size(), &kCFTypeArrayCallBacks)); >+ size_t totalDataSize = 0; > > for (const auto& item : backForwardListState.items) { > auto url = item.pageState.mainFrameState.urlString.createCFString(); > auto title = item.pageState.title.createCFString(); > auto originalURL = item.pageState.mainFrameState.originalURLString.createCFString(); >- auto data = encodeSessionHistoryEntryData(item.pageState.mainFrameState); >+ auto data = totalDataSize <= maximumSessionStateDataSize ? encodeSessionHistoryEntryData(item.pageState.mainFrameState) : nullptr; > auto shouldOpenExternalURLsPolicyValue = static_cast<uint64_t>(item.pageState.shouldOpenExternalURLsPolicy); > auto shouldOpenExternalURLsPolicy = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &shouldOpenExternalURLsPolicyValue)); > >- auto entryDictionary = createDictionary({ >- { sessionHistoryEntryURLKey, url.get() }, >- { sessionHistoryEntryTitleKey, title.get() }, >- { sessionHistoryEntryOriginalURLKey, originalURL.get() }, >- { sessionHistoryEntryDataKey, data.get() }, >- { sessionHistoryEntryShouldOpenExternalURLsPolicyKey, shouldOpenExternalURLsPolicy.get() }, >- }); >+ RetainPtr<CFDictionaryRef> entryDictionary; >+ >+ if (data) { >+ totalDataSize += CFDataGetLength(data.get()); >+ >+ entryDictionary = createDictionary({ >+ { sessionHistoryEntryURLKey, url.get() }, >+ { sessionHistoryEntryTitleKey, title.get() }, >+ { sessionHistoryEntryOriginalURLKey, originalURL.get() }, >+ { sessionHistoryEntryDataKey, data.get() }, >+ { sessionHistoryEntryShouldOpenExternalURLsPolicyKey, shouldOpenExternalURLsPolicy.get() }, >+ }); >+ } else { >+ entryDictionary = createDictionary({ >+ { sessionHistoryEntryURLKey, url.get() }, >+ { sessionHistoryEntryTitleKey, title.get() }, >+ { sessionHistoryEntryOriginalURLKey, originalURL.get() }, >+ { sessionHistoryEntryShouldOpenExternalURLsPolicyKey, shouldOpenExternalURLsPolicy.get() }, >+ }); >+ } > > CFArrayAppendValue(entries.get(), entryDictionary.get()); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 155664
:
274479
|
274480
| 274509