Skip to content

Commit

Permalink
Use the rule type as a prefix for the DNR database table
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=270911
rdar://121455049

Reviewed by Timothy Hatcher.

This matches the current database format in Safari, and having these formats match will help us migrate existing extension data
over to WebKit's new file structure.

While we're here, we are changing the name of the database file on disk. Without this, we would need to bump the schema version, which
would lead to issues when performing the previously described migration.

* Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionDeclarativeNetRequestSQLiteStore.mm:
(-[_WKWebExtensionDeclarativeNetRequestSQLiteStore initWithUniqueIdentifier:storageType:directory:usesInMemoryDatabase:]):

Canonical link: https://commits.webkit.org/276033@main
  • Loading branch information
b-weinstein committed Mar 13, 2024
1 parent 81b1ab5 commit 349c5a3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (instancetype)initWithUniqueIdentifier:(NSString *)uniqueIdentifier storageTyp
return nil;

_storageType = storageType == _WKWebExtensionDeclarativeNetRequestStorageType::Dynamic ? @"dynamic" : @"session";
_tableName = @"rules";
_tableName = [NSString stringWithFormat:@"%@_rules", _storageType];
return self;
}

Expand Down Expand Up @@ -264,7 +264,7 @@ - (NSURL *)_databaseURL

ASSERT([_storageType isEqualToString:@"dynamic"]);

NSString *databaseName = @"DeclarativeNetRequestDynamicRules.db";
NSString *databaseName = @"DeclarativeNetRequestRules.db";
return [_directory URLByAppendingPathComponent:databaseName isDirectory:NO];
}

Expand Down

0 comments on commit 349c5a3

Please sign in to comment.