Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fbdccae9a7b5d06d7533640e8614b17fe72a4b0a
https://github.com/WebKit/WebKit/commit/fbdccae9a7b5d06d7533640e8614b17fe72a4b0a
Author: Timothy Hatcher <[email protected]>
Date: 2026-10-07 (Wed, 07 Oct 2026)
Changed paths:
M Source/WebKit/Platform/cocoa/CocoaHelpers.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIRuntime.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIScripting.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIStorage.mm
Log Message:
-----------
storage.local.get() returns the same array for distinct empty arrays.
https://webkit.org/b/326371
rdar://problem/189204323
Reviewed by Brian Weinstein, Kiara Rose, Devin Rousso, and Yusuke Suzuki.
NSJSONSerialization returns the shared immutable instance for every empty array
and dictionary, and
JavaScriptCore maps each Objective-C object in a converted value to a single JS
object. Every empty
array or object in a decoded value came back as the same JS array or object, so
a script that
mutated one changed all of them.
Read JSON with NSJSONReadingMutableContainers, so each empty container is a
distinct instance.
Found and reported by Philipp Claßen and Krzysztof Jan Modras at Ghostery.
Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIRuntime.mm
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIScripting.mm
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIStorage.mm
* Source/WebKit/Platform/cocoa/CocoaHelpers.mm:
(WebKit::toReadingImpl): Default to NSJSONReadingMutableContainers.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIRuntime.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime,
SendMessageWithEmptyContainers)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime,
PortMessageWithEmptyContainers)): Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIScripting.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIScripting,
ExecuteScriptResultDoesNotAliasEmptyContainers)): Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIStorage.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage, GetDoesNotAliasEmptyArrays)):
Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage, GetDoesNotAliasEmptyObjects)):
Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage,
GetDoesNotAliasNestedEmptyContainers)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage,
GetDoesNotAliasEmptyContainersAcrossKeys)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage,
GetDoesNotAliasEmptyContainersInSessionStorage)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage,
GetWithDefaultValuesDoesNotAliasEmptyContainers)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIStorage,
OnChangedDoesNotAliasEmptyContainers)): Added.
Canonical link: https://commits.webkit.org/323003@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications