[webkit-changes] [WebKit/WebKit] 5745ae: RegisteredContentScripts.db should only be created...

Timothy Hatcher noreply at github.com
Wed Mar 13 19:23:02 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5745aee1167a4b0f77891efe606302d5160fdbde
      https://github.com/WebKit/WebKit/commit/5745aee1167a4b0f77891efe606302d5160fdbde
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2024-03-13 (Wed, 13 Mar 2024)

  Changed paths:
    M Source/WebKit/Shared/Extensions/_WKWebExtensionRegisteredScriptsSQLiteStore.mm
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteDatabase.mm
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.h
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionDeclarativeNetRequestSQLiteStore.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionStorageSQLiteStore.mm

  Log Message:
  -----------
  RegisteredContentScripts.db should only be created if needed.
https://webkit.org/b/270931
rdar://problem/124554561

Reviewed by Sihui Liu and Jeff Miller.

Change the APIs that use SQL store to use the new _openDatabaseIfNecessaryReturningErrorMessage:createIfNecessary:
method and pass NO when the access is deleting or getting data. This makes sure we don't create an empty database
just to read or delete no data.

* Source/WebKit/Shared/Extensions/_WKWebExtensionRegisteredScriptsSQLiteStore.mm:
(-[_WKWebExtensionRegisteredScriptsSQLiteStore deleteScriptsWithIDs:completionHandler:]): Pass createIfNecessary:NO.
(-[_WKWebExtensionRegisteredScriptsSQLiteStore _getScriptsWithOutErrorMessage:]): Ditto.
* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteDatabase.mm:
(-[_WKWebExtensionSQLiteDatabase _openWithFlags:vfs:error:]): Return no error if thsi is a can't open error and
we were not asekd to create the file.
* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.h:
* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm:
(-[_WKWebExtensionSQLiteStore _openDatabaseIfNecessaryReturningErrorMessage:]): Call the new method with YES.
(-[_WKWebExtensionSQLiteStore _openDatabaseIfNecessaryReturningErrorMessage:createIfNecessary:]): Added.
(-[_WKWebExtensionSQLiteStore _openDatabase:withAccessType:deleteDatabaseFileOnError:]): Added accessType param.
(-[_WKWebExtensionSQLiteStore _deleteDatabaseFileAtURL:reopenDatabase:]): Pass SQLiteDatabaseAccessTypeReadWriteCreate.
(-[_WKWebExtensionSQLiteStore _openDatabase:deleteDatabaseFileOnError:]): Deleted.
* Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionDeclarativeNetRequestSQLiteStore.mm:
(-[_WKWebExtensionDeclarativeNetRequestSQLiteStore deleteRules:completionHandler:]): Pass createIfNecessary:NO.
(-[_WKWebExtensionDeclarativeNetRequestSQLiteStore _getRulesWithOutErrorMessage:]): Ditto.
* Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionStorageSQLiteStore.mm:
(-[_WKWebExtensionStorageSQLiteStore getStorageSizeForKeys:completionHandler:]):
(-[_WKWebExtensionStorageSQLiteStore deleteValuesForKeys:completionHandler:]):
(-[_WKWebExtensionStorageSQLiteStore _getValuesForAllKeysReturningErrorMessage:]):
(-[_WKWebExtensionStorageSQLiteStore _getAllKeysReturningErrorMessage:]):
(-[_WKWebExtensionStorageSQLiteStore _getValuesForKeys:outErrorMessage:]):

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



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


More information about the webkit-changes mailing list