Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ea232f38603949069f5757d9b3b9210dc3eb94db
      
https://github.com/WebKit/WebKit/commit/ea232f38603949069f5757d9b3b9210dc3eb94db
  Author: Kiara Rose <[email protected]>
  Date:   2026-06-19 (Fri, 19 Jun 2026)

  Changed paths:
    M Source/WebKit/Shared/Extensions/WebExtensionConstants.h
    M Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIStorage.cpp
    M 
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIStorage.mm

  Log Message:
  -----------
  Crash at WebKit: IPC::Encoder::grow after a call to 
browser.storage.local.get()
https://bugs.webkit.org/show_bug.cgi?id=317433
rdar://177578845

Reviewed by Timothy Hatcher.

Extensions can declare an unlimited use of storage and at the moment, we don't 
restrict the amount
of data they can set or get at once. This can cause issues, especially on iOS, 
where we have tighter
memory constraints, leading to crashes in both the Web and UI process when an 
extension tries to set
or get large amounts of data. This patch makes it so that we cap out at 995 MB, 
a bit under 1GB
which is where we occasionally crash on iOS. Larger than 1GB is a constant 
crash on iOS. I haven't
observed any crashes on macOS but to be consistent across platforms, the limit 
is introduced on macOS
as well.

I filed this WECG issue proposing limits for these calls:
https://github.com/w3c/webextensions/issues/1028

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIStorage.mm

* Source/WebKit/Shared/Extensions/WebExtensionConstants.h:
Add a new constant for the maximum amount of data that can be set or retrieved 
at once from a call
to local storage.

Also, bump the local storage quota for extensions that don't use unlimited 
storage as the increased
quota was agreed upon in the WECG: 
https://github.com/w3c/webextensions/issues/351.

* Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIStorage.cpp:
(WebKit::WebExtensionContext::storageGet):
* 
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm:
(WebKit::WebExtensionAPIStorageArea::set):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIStorage.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage, SetExceedsMaximumDataSize)):
Add a new test to ensure that setting larger than 1GB of data throws an error. 
I attempted to write
a test for get() as well but it was a constant timeout. Verified manually that 
we throw an error in
this case as well.

Canonical link: https://commits.webkit.org/315539@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to