[webkit-changes] [WebKit/WebKit] 79ae2d: WKWebExtensionAPIDeclarativeNetRequest.DynamicRule...

Timothy Hatcher noreply at github.com
Mon Dec 11 11:40:21 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 79ae2d98bffebe586578a7ffedf1cc8215252716
      https://github.com/WebKit/WebKit/commit/79ae2d98bffebe586578a7ffedf1cc8215252716
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2023-12-11 (Mon, 11 Dec 2023)

  Changed paths:
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteDatabase.mm
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.h
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm

  Log Message:
  -----------
  WKWebExtensionAPIDeclarativeNetRequest.DynamicRules is flaky due to SQLite errors.
https://webkit.org/b/266197
rdar://problem/119469498

Reviewed by Brian Weinstein.

Fix a number of SQL database errors seen when stress-testing the DynamicRules test.

* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteDatabase.mm:
(-[_WKWebExtensionSQLiteDatabase enableWAL:]): Also set synchronous to NORMAL per SQLite docs.
(-[_WKWebExtensionSQLiteDatabase _openWithFlags:vfs:error:]): Use nullptr instead of 0.
* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.h:
* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm:
(-[_WKWebExtensionSQLiteStore dealloc]): Moved to `close` method, and call it.
(-[_WKWebExtensionSQLiteStore close]): Added. Return early if already closed. Synchronously close
to prevent SQLite errors when trying to load the file immediately after, which would happen from
another database background queue and fail, which then tries to delete the locked DB file.
(-[_WKWebExtensionSQLiteStore _openDatabase:deleteDatabaseFileOnError:]): Return the result of
`_deleteDatabaseFileAtURL:` instead, since the retry error (if any) should be reported back.
Also moved `close` to after the early return since `_deleteDatabaseFileAtURL:` already does a close.
(-[_WKWebExtensionSQLiteStore _deleteDatabaseFileAtURL:reopenDatabase:]): Changed databaseFileSuffixes
to use ASCIILiteral and moved inside since this is the only client. Always check if the DB file exists
before trying to delete it, since thats what the original Safari code did and that was lost in the move.
(-[_WKWebExtensionSQLiteStore _handleSchemaVersioningWithDeleteDatabaseFileOnError:]):
(-[_WKWebExtensionSQLiteStore initWithUniqueIdentifier:directory:usesInMemoryDatabase:]): Deleted. Unused
and it was the only code using NSFileManager.
(-[_WKWebExtensionSQLiteStore deleteStorageWithCompletionHandler:]): Deleted.

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




More information about the webkit-changes mailing list