a7c2f79a94
* test: update DOM storage quota limits test * fix: update dom_storage_limits.patch (fixes #13465) The previous version of this patch did not include changes required to circumvent the quota enforcement performed by StorageAreaImpl. Consequently when the quota was exceeded, things still "appeared to work" at first but then would later fail silently. That is, the cache would be updated but the backing store would not. This could be fixed by disabling the code below (from `content/browser/dom_storage/storage_area_impl.cc`) ``` // Only check quota if the size is increasing, this allows // shrinking changes to pre-existing maps that are over budget. if (new_item_size > old_item_size && new_storage_used > max_size_) { if (map_state_ == MapState::LOADED_KEYS_ONLY) { receivers_.ReportBadMessage( "The quota in browser cannot exceed when there is only one " "renderer."); } else { std::move(callback).Run(false); } return; } ``` However, since this seems to have some unintended side-effects (see updated notes in dom_storage_limits.patch) it seems more prudent to simply increase the quota to a larger yet still reasonable size rather than attempt to circumvent the storage quota altogether.
46 lines
2.5 KiB
Diff
46 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jacob Quant <jacobq@gmail.com>
|
|
Date: Thu, 31 Oct 2019 14:00:00 -0500
|
|
Subject: dom_storage_limits.patch
|
|
|
|
This patch increases the DOM storage (e.g. `localStorage`
|
|
and `sessionStorage`) size quota from 10MiB to 100MiB.
|
|
Previous versions of this patch attempted to circumvent
|
|
the restriction altogether.
|
|
However, this can lead to other problems, such as crashing
|
|
the Dev Tools when attempting to read or write values that exceed
|
|
`IPC::Channel::kMaximumMessageSize` (128MiB).
|
|
|
|
Increasing the quota rather than bypassing it reduces the
|
|
amount of chromium code that needs to be changed for Electron
|
|
as well as keeps these storage areas limited to a bounded
|
|
size meanwhile giving application developers more space to work with.
|
|
|
|
diff --git a/content/browser/dom_storage/dom_storage_types.h b/content/browser/dom_storage/dom_storage_types.h
|
|
index 6c0b831ebaaa2c1749bbc7436ce1025656588310..96d1c73adb09d33cf591ca569f46de9b21f9a4df 100644
|
|
--- a/content/browser/dom_storage/dom_storage_types.h
|
|
+++ b/content/browser/dom_storage/dom_storage_types.h
|
|
@@ -21,7 +21,8 @@ typedef std::map<base::string16, base::NullableString16> DOMStorageValuesMap;
|
|
|
|
// The quota for each storage area.
|
|
// This value is enforced in renderer processes and the browser process.
|
|
-const size_t kPerStorageAreaQuota = 10 * 1024 * 1024;
|
|
+// Electron's dom_storage_limits.patch increased this value from 10MiB to 100MiB
|
|
+const size_t kPerStorageAreaQuota = 100 * 1024 * 1024;
|
|
|
|
// In the browser process we allow some overage to
|
|
// accomodate concurrent writes from different renderers
|
|
diff --git a/third_party/blink/public/mojom/dom_storage/storage_area.mojom b/third_party/blink/public/mojom/dom_storage/storage_area.mojom
|
|
index 1f1b2c6fa109aa52c4e7c7f5fcaac91beb538449..d8f15eed9be83340ffd1f2400df08558e9554710 100644
|
|
--- a/third_party/blink/public/mojom/dom_storage/storage_area.mojom
|
|
+++ b/third_party/blink/public/mojom/dom_storage/storage_area.mojom
|
|
@@ -40,7 +40,8 @@ interface StorageAreaGetAllCallback {
|
|
interface StorageArea {
|
|
// The quota for each storage area.
|
|
// This value is enforced in renderer processes and the browser process.
|
|
- const uint32 kPerStorageAreaQuota = 10485760; // 10 MiB
|
|
+ // Electron's dom_storage_limits.patch increased this value from 10MiB to 100MiB
|
|
+ const uint32 kPerStorageAreaQuota = 104857600; // 100 MiB
|
|
|
|
// In the browser process we allow some overage to
|
|
// accommodate concurrent writes from different renderers
|