diff --git a/patches/chromium/dom_storage_limits.patch b/patches/chromium/dom_storage_limits.patch index 5334f8e3cfb94..28399a562a6cc 100644 --- a/patches/chromium/dom_storage_limits.patch +++ b/patches/chromium/dom_storage_limits.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jacob Quant -Date: Tue, 6 Nov 2018 15:26:00 -0600 +Date: Thu, 31 Oct 2019 14:00:00 -0500 Subject: dom_storage_limits.patch This patch circumvents the restriction on DOM storage objects, @@ -32,49 +32,72 @@ for a given `BrowserWindow` via a `webPreferences` option, similar to [`nodeIntegration`](https://electronjs.org/docs/tutorial/security#2-disable-nodejs-integration-for-remote-content). diff --git a/content/browser/dom_storage/dom_storage_types.h b/content/browser/dom_storage/dom_storage_types.h -index 6c0b831ebaaa2c1749bbc7436ce1025656588310..b67767751cadc6072c133297c7a6cdcc6bfd0c98 100644 +index 6c0b831ebaaa..fcf2456debab 100644 --- a/content/browser/dom_storage/dom_storage_types.h +++ b/content/browser/dom_storage/dom_storage_types.h @@ -21,6 +21,7 @@ typedef std::map DOMStorageValuesMap; - + // The quota for each storage area. // This value is enforced in renderer processes and the browser process. -+// However, Electron's dom_storage_limits.patch removes the code that checks this limit. ++// (Electron's dom_storage_limits.patch disables quota enforcement.) const size_t kPerStorageAreaQuota = 10 * 1024 * 1024; - + // In the browser process we allow some overage to +diff --git a/content/browser/dom_storage/storage_area_impl.cc b/content/browser/dom_storage/storage_area_impl.cc +index 4b48b5f16a3e..b9e83279d1fc 100644 +--- a/content/browser/dom_storage/storage_area_impl.cc ++++ b/content/browser/dom_storage/storage_area_impl.cc +@@ -303,6 +303,8 @@ void StorageAreaImpl::Put( + + // Only check quota if the size is increasing, this allows + // shrinking changes to pre-existing maps that are over budget. ++ // (Electron's dom_storage_limits.patch has disabled this.) ++ #if 0 + if (new_item_size > old_item_size && new_storage_used > max_size_) { + if (map_state_ == MapState::LOADED_KEYS_ONLY) { + receivers_.ReportBadMessage( +@@ -313,6 +315,7 @@ void StorageAreaImpl::Put( + } + return; + } ++ #endif + + if (database_) { + CreateCommitBatchIfNeeded(); diff --git a/third_party/blink/renderer/modules/storage/cached_storage_area.cc b/third_party/blink/renderer/modules/storage/cached_storage_area.cc -index d91fdc2a7d52307126bc04d44167edadb8c743a8..630acfca527aaec44742d45e47ce29d7754e3385 100644 +index d91fdc2a7d52..7cb3cbf34d3a 100644 --- a/third_party/blink/renderer/modules/storage/cached_storage_area.cc +++ b/third_party/blink/renderer/modules/storage/cached_storage_area.cc -@@ -107,11 +107,13 @@ bool CachedStorageArea::SetItem(const String& key, +@@ -107,11 +107,14 @@ bool CachedStorageArea::SetItem(const String& key, Source* source) { DCHECK(areas_->Contains(source)); - -+#if 0 + ++ // (Electron's dom_storage_limits.patch has disabled this.) ++ #if 0 // A quick check to reject obviously overbudget items to avoid priming the // cache. if ((key.length() + value.length()) * 2 > mojom::blink::StorageArea::kPerStorageAreaQuota) return false; -+#endif - ++ #endif + EnsureLoaded(); String old_value; diff --git a/third_party/blink/renderer/modules/storage/storage_area_map.cc b/third_party/blink/renderer/modules/storage/storage_area_map.cc -index 0da8a1e891edad60355792c40b7d15e90c1086e8..df71418d598d5bdf41e9a8a4340999d9d277aeef 100644 +index 0da8a1e891ed..5a1811419030 100644 --- a/third_party/blink/renderer/modules/storage/storage_area_map.cc +++ b/third_party/blink/renderer/modules/storage/storage_area_map.cc -@@ -113,10 +113,12 @@ bool StorageAreaMap::SetItemInternal(const String& key, +@@ -113,10 +113,13 @@ bool StorageAreaMap::SetItemInternal(const String& key, size_t new_quota_used = quota_used_ - old_item_size + new_item_size; size_t new_memory_used = memory_used_ - old_item_memory + new_item_memory; - -+#if 0 + ++ // (Electron's dom_storage_limits.patch has disabled this.) ++ #if 0 // Only check quota if the size is increasing, this allows // shrinking changes to pre-existing files that are over budget. if (check_quota && new_item_size > old_item_size && new_quota_used > quota_) return false; -+#endif - ++ #endif + keys_values_.Set(key, value); ResetKeyIterator();