[webkit-changes] [WebKit/WebKit] e1395e: Create and adopt an SQLite store for web extension...

kiaraarose noreply at github.com
Wed Jan 24 21:42:26 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e1395e4dbba28625de13524fc5e94921c1eba60e
      https://github.com/WebKit/WebKit/commit/e1395e4dbba28625de13524fc5e94921c1eba60e
  Author: Kiara Rose <kiara_rose at apple.com>
  Date:   2024-01-24 (Wed, 24 Jan 2024)

  Changed paths:
    M Source/WebKit/Shared/Extensions/WebExtensionUtilities.h
    M Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIStorageCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    A Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionStorageSQLiteStore.h
    A Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionStorageSQLiteStore.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIStorage.mm

  Log Message:
  -----------
  Create and adopt an SQLite store for web extension Storage API
https://bugs.webkit.org/show_bug.cgi?id=267649
rdar://121143226

Reviewed by Timothy Hatcher.

This patch creates and adopts a _WKWebExtensionStorageSQLiteStore which is used to manage storage
for web extensions. This patch also changes the way the data is sent over to the UI Proccess.
Instead of using a IPC::DataReference object, simply encode the data as a JSON string and send it
that way.

* Source/WebKit/Shared/Extensions/WebExtensionUtilities.h:
* Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm:
(WebKit::storageSizeOf):
(WebKit::anyItemsExceedQuota):

* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm:
* Source/WebKit/Shared/Extensions/_WKWebExtensionStorageSQLiteStore.h: Added.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIStorageCocoa.mm:
Utlize _WKWebExtensionStorageSQLiteStore to get/set/remove/clear data.
(WebKit::WebExtensionContext::storageGet):
(WebKit::WebExtensionContext::storageGetBytesInUse):
(WebKit::WebExtensionContext::storageSet):
(WebKit::WebExtensionContext::storageRemove):
(WebKit::WebExtensionContext::storageClear):

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::invalidateStorage):
(WebKit::WebExtensionContext::quoataForStorageType):
(WebKit::WebExtensionContext::localStorageStore):
(WebKit::WebExtensionContext::sessionStorageStore):
(WebKit::WebExtensionContext::syncStorageStore):
(WebKit::WebExtensionContext::storageForType):

* Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionStorageSQLiteStore.h: Added.
* Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionStorageSQLiteStore.mm: Added.
(rowFilterStringFromRowKeys):
(-[_WKWebExtensionStorageSQLiteStore initWithUniqueIdentifier:storageType:directory:usesInMemoryDatabase:]):
(-[_WKWebExtensionStorageSQLiteStore getValuesForKeys:completionHandler:]):
(-[_WKWebExtensionStorageSQLiteStore getStorageSizeForKeys:completionHandler:]):
(-[_WKWebExtensionStorageSQLiteStore getStorageSizeForAllKeysIncludingKeyedData:withCompletionHandler:]):
(-[_WKWebExtensionStorageSQLiteStore setKeyedData:completionHandler:]):
(-[_WKWebExtensionStorageSQLiteStore deleteValuesForKeys:completionHandler:]):
(-[_WKWebExtensionStorageSQLiteStore _databaseURL]):
(-[_WKWebExtensionStorageSQLiteStore _insertOrUpdateValue:forKey:inDatabase:]):
(-[_WKWebExtensionStorageSQLiteStore _getValuesForAllKeysReturningErrorMessage:]):
(-[_WKWebExtensionStorageSQLiteStore _getKeysAndValuesFromRowEnumerator:]):
(-[_WKWebExtensionStorageSQLiteStore _getAllKeysReturningErrorMessage:]):
(-[_WKWebExtensionStorageSQLiteStore _getValuesForKeys:outErrorMessage:]):
(-[_WKWebExtensionStorageSQLiteStore _currentDatabaseSchemaVersion]):
(-[_WKWebExtensionStorageSQLiteStore _createFreshDatabaseSchema]):
(-[_WKWebExtensionStorageSQLiteStore _resetDatabaseSchema]):
(-[_WKWebExtensionStorageSQLiteStore _isDatabaseEmpty]):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm:
(WebKit::WebExtensionAPIStorageArea::get):
If 'items' is a dictionary with keys and default values, only send the keys over to the UI process
since we can add the default values after we receive the data from storage.

(WebKit::WebExtensionAPIStorageArea::getBytesInUse):
(WebKit::WebExtensionAPIStorageArea::set):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorageArea.h:
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIStorageArea.idl:
Needs JSContextRef so we can serialize and deserialize the data in 'storage.get()' and 'storage.set()'.

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




More information about the webkit-changes mailing list