Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0ad922bc0c9601604a6ba8ca53ea271927b768d6
https://github.com/WebKit/WebKit/commit/0ad922bc0c9601604a6ba8ca53ea271927b768d6
Author: Ben Nham <[email protected]>
Date: 2022-12-07 (Wed, 07 Dec 2022)
Changed paths:
M Source/WebCore/Modules/push-api/PushDatabase.cpp
M Source/WebCore/Modules/push-api/PushDatabase.h
M Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.h
M Source/WebCore/platform/sql/SQLiteStatement.h
M Source/WebKit/webpushd/PushService.mm
M Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp
Log Message:
-----------
Allow multiple data store and push partition identifiers per app in
PushDatabase
https://bugs.webkit.org/show_bug.cgi?id=248695
<rdar://problem/102922285>
Reviewed by Brady Eidson.
This upgrades the PushDatabase schema to allow more than one data store
identifier and push
partition identifier per app. Previously, a push subscription was identified by
(bundleID,
serviceWorkerScopeURL). After this patch, it's identified by (bundleID,
pushPartition,
dataStoreUUID, serviceWorkerScopeURL).
To do this, in this patch we:
* Create a new type PushSubscriptionSetIdentifier which is a tuple of
(bundleID, pushPartition,
dataStoreUUID). We use this type wherever we used to use only bundleID.
* Add new columns to the SubscriptionSets table to store the pushPartition and
dataStoreUUID. dataStoreUUID column to the SubscriptionSets table. This
involves a copying the
table and then dropping it since we are adding the columns to the middle of
the table, and because
we need to regenerate a unique index. (ALTER TABLE doesn't have the power to
do either.)
* Since a lot of PushDatabase involves boilerplate around binding parameters, I
added a binding
helper method to SQLiteStatement that allows multiple parameters to be bound
in one function call
and am now using that in PushDatabase.
* Modified the API tests to also test multiple subscription set identifiers.
For now, PushService (the only user of PushDatabase) is still unaware of
pushPartition and
dataStoreUUID. I'll add that support to PushService in a future patch.
* Source/WebCore/Modules/push-api/PushDatabase.cpp:
(WebCore::PushRecord::isolatedCopy const):
(WebCore::PushRecord::isolatedCopy):
(WebCore::openAndMigrateDatabase):
(WebCore::PushDatabase::bindStatementOnQueue):
(WebCore::uuidToSpan):
(WebCore::uuidFromSpan):
(WebCore::expirationTimeToValue):
(WebCore::expirationTimeFromValue):
(WebCore::PushDatabase::updatePublicToken):
(WebCore::PushDatabase::getPublicToken):
(WebCore::PushDatabase::insertRecord):
(WebCore::PushDatabase::removeRecordByIdentifier):
(WebCore::makePushRecordFromRow):
(WebCore::PushDatabase::getRecordByTopic):
(WebCore::PushDatabase::getRecordBySubscriptionSetAndScope):
(WebCore::PushDatabase::getTopics):
(WebCore::PushDatabase::incrementSilentPushCount):
(WebCore::PushDatabase::removeRecordsBySubscriptionSet):
(WebCore::PushDatabase::removeRecordsBySubscriptionSetAndSecurityOrigin):
(WebCore::PushDatabase::setPushesEnabledForOrigin):
(WebCore::bindExpirationTime): Deleted.
(WebCore::PushDatabase::getRecordByBundleIdentifierAndScope): Deleted.
(WebCore::PushDatabase::removeRecordsByBundleIdentifier): Deleted.
(WebCore::PushDatabase::removeRecordsByBundleIdentifierAndSecurityOrigin):
Deleted.
* Source/WebCore/Modules/push-api/PushDatabase.h:
* Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.h:
(WebCore::PushSubscriptionSetIdentifier::isolatedCopy const):
(WebCore::PushSubscriptionSetIdentifier::isolatedCopy):
* Source/WebCore/platform/sql/SQLiteStatement.h:
(WebCore::SQLiteStatement::bind):
(WebCore::SQLiteStatement::bindImpl):
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::makeSubscriptionSet):
(WebPushD::GetSubscriptionRequest::startInternal):
(WebPushD::SubscribeRequest::startImpl):
(WebPushD::UnsubscribeRequest::startInternal):
(WebPushD::PushService::incrementSilentPushCount):
(WebPushD::PushService::setPushesEnabledForBundleIdentifierAndOrigin):
(WebPushD::PushService::removeRecordsImpl):
(WebPushD::PushService::didReceivePushMessage):
* Tools/TestWebKitAPI/Tests/WebCore/PushDatabase.cpp:
(WebCore::operator==):
(TestWebKitAPI::getTopicsFromRecords):
(TestWebKitAPI::getRecordBySubscriptionSetAndScopeSync):
(TestWebKitAPI::PushDatabaseTest::getRecordBySubscriptionSetAndScope):
(TestWebKitAPI::PushDatabaseTest::removeRecordsBySubscriptionSet):
(TestWebKitAPI::PushDatabaseTest::removeRecordsBySubscriptionSetAndSecurityOrigin):
(TestWebKitAPI::PushDatabaseTest::incrementSilentPushCount):
(TestWebKitAPI::PushDatabaseTest::setPushesEnabledForOrigin):
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::TEST):
(TestWebKitAPI::getRecordByBundleIdentifierAndScopeSync): Deleted.
(TestWebKitAPI::PushDatabaseTest::getRecordByBundleIdentifierAndScope): Deleted.
(TestWebKitAPI::PushDatabaseTest::removeRecordsByBundleIdentifier): Deleted.
(TestWebKitAPI::PushDatabaseTest::removeRecordsByBundleIdentifierAndSecurityOrigin):
Deleted.
Canonical link: https://commits.webkit.org/257521@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes