Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent silent failure when DOM storage quota exceeded #21380

Merged
merged 1 commit into from Dec 4, 2019

Conversation

jacobq
Copy link
Contributor

@jacobq jacobq commented Dec 4, 2019

Backport of #20899, see that PR for details.

Notes: Re-enable DOM storage quota enforcement but change limit from 10MiB to 100MiB

…#20899)

* test: update DOM storage quota limits test

* fix: update dom_storage_limits.patch (fixes electron#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.
@jacobq jacobq requested a review from a team as a code owner December 4, 2019 12:40
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Dec 4, 2019
@trop trop bot added 8-x-y backport This is a backport PR labels Dec 4, 2019
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Dec 4, 2019
@jkleinsc jkleinsc merged commit c79f1ee into electron:8-x-y Dec 4, 2019
@release-clerk
Copy link

release-clerk bot commented Dec 4, 2019

Release Notes Persisted

Re-enable DOM storage quota enforcement but change limit from 10MiB to 100MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8-x-y backport This is a backport PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants