Changeset 287013 in webkit
- Timestamp:
- Dec 13, 2021, 11:56:44 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-ephemeral-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-in-new-window-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-with-priority-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-without-priority-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/second-attribution-converted-with-higher-priority-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/second-attribution-converted-with-lower-priority-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/second-conversion-with-higher-priority-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/second-conversion-with-lower-priority-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive-expected.txt (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp (modified) (3 diffs)
-
Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/PrivateClickMeasurement.mm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r287010 r287013 1 2021-12-13 John Wilander <wilander@apple.com> 2 3 PCM: Remove old DB update and migration code, and add a unit test for destination token DB columns 4 https://bugs.webkit.org/show_bug.cgi?id=234281 5 <rdar://86347439> 6 7 Reviewed by Alex Christensen and Kate Cheney. 8 9 These expect files are just updated with destination token dump output. 10 11 * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt: 12 * http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-ephemeral-expected.txt: 13 * http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-in-new-window-expected.txt: 14 * http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-with-priority-expected.txt: 15 * http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-without-priority-expected.txt: 16 * http/tests/privateClickMeasurement/second-attribution-converted-with-higher-priority-expected.txt: 17 * http/tests/privateClickMeasurement/second-attribution-converted-with-lower-priority-expected.txt: 18 * http/tests/privateClickMeasurement/second-conversion-with-higher-priority-expected.txt: 19 * http/tests/privateClickMeasurement/second-conversion-with-lower-priority-expected.txt: 20 * http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive-expected.txt: 21 1 22 2021-12-13 Alex Christensen <achristensen@webkit.org> 2 23 -
trunk/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt
r286519 r287013 13 13 Attribution priority: 0 14 14 Attribution earliest time to send: Within 24-48 hours 15 Destination token: Not set 15 16 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-ephemeral-expected.txt
r282884 r287013 10 10 Attribution priority: 0 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-in-new-window-expected.txt
r282884 r287013 10 10 Attribution priority: 3 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-with-priority-expected.txt
r282884 r287013 10 10 Attribution priority: 3 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-image-redirect-without-priority-expected.txt
r282884 r287013 10 10 Attribution priority: 0 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/second-attribution-converted-with-higher-priority-expected.txt
r282884 r287013 10 10 Attribution priority: 4 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/second-attribution-converted-with-lower-priority-expected.txt
r282884 r287013 10 10 Attribution priority: 4 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/second-conversion-with-higher-priority-expected.txt
r282884 r287013 10 10 Attribution priority: 4 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/second-conversion-with-lower-priority-expected.txt
r282884 r287013 10 10 Attribution priority: 4 11 11 Attribution earliest time to send: Within 24-48 hours 12 Destination token: Not set 12 13 Application bundle identifier: com.apple.WebKit.WebKitTestRunner -
trunk/LayoutTests/http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive-expected.txt
r286519 r287013 13 13 Attribution priority: 0 14 14 Attribution earliest time to send: Within 24-48 hours 15 Destination token: Not set 15 16 Application bundle identifier: testBundleID -
trunk/Source/WebKit/ChangeLog
r287010 r287013 1 2021-12-13 John Wilander <wilander@apple.com> 2 3 PCM: Remove old DB update and migration code, and add a unit test for destination token DB columns 4 https://bugs.webkit.org/show_bug.cgi?id=234281 5 <rdar://86347439> 6 7 Reviewed by Alex Christensen and Kate Cheney. 8 9 WebKit::Database::needsUpdatedSchema() in PrivateClickMeasurement.cpp has a comment saying it 10 should be removed late 2021. WebKit::DatabaseUtilities::migrateDataToNewTablesIfNecessary() 11 returns directly if WebKit::Database::needsUpdatedSchema() returns false so always returning 12 false for WebKit::Database::needsUpdatedSchema() in PrivateClickMeasurement.cpp effectively 13 disables WebKit::DatabaseUtilities::migrateDataToNewTablesIfNecessary() for PCM. 14 15 New unit/API test PrivateClickMeasurement.MigrateWithDestinationToken added. 16 17 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: 18 (WebKit::PCM::Database::Database): 19 No longer calls the deleted DatabaseUtilities::migrateDataToNewTablesIfNecessary(). 20 (WebKit::PCM::Database::attributionToStringForTesting const): 21 Now outputs destination token info. 22 (WebKit::PCM::Database::needsUpdatedSchema): Deleted. 23 * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h: 24 needsUpdatedSchema() now always returns false. 25 1 26 2021-12-13 Alex Christensen <achristensen@webkit.org> 2 27 -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp
r286519 r287013 89 89 enableForeignKeys(); 90 90 addDestinationTokenColumnsIfNecessary(); 91 migrateDataToNewTablesIfNecessary();92 91 allDatabases().add(this); 93 92 } … … 450 449 builder.append((secondsUntilSend >= 24_h && secondsUntilSend <= 48_h) ? "Within 24-48 hours" : "Outside 24-48 hours"); 451 450 } 451 452 builder.append("\nDestination token: "); 453 if (!triggerData->destinationSecretToken) 454 builder.append("Not set"); 455 else 456 builder.append("\ntoken: ", triggerData->destinationSecretToken->tokenBase64URL, "\nsignature: ", triggerData->destinationSecretToken->signatureBase64URL, "\nkey: ", triggerData->destinationSecretToken->keyIDBase64URL); 452 457 } else 453 458 builder.append("\nNo attribution trigger data."); … … 717 722 } 718 723 719 bool Database::needsUpdatedSchema()720 {721 // FIXME: Remove this at the end of 2021. No public release was made with the schema missing sourceApplicationBundleID, so this is only needed to migrate internal users who updated in September 2021.722 for (auto& table : expectedTableAndIndexQueries().keys()) {723 if (currentTableAndIndexQueries(table) != expectedTableAndIndexQueries().get(table))724 return true;725 }726 727 return false;728 }729 730 724 Vector<String> Database::columnsForTable(const String& tableName) 731 725 { -
trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h
r286519 r287013 78 78 79 79 void addDestinationTokenColumnsIfNecessary(); 80 bool needsUpdatedSchema() final ;80 bool needsUpdatedSchema() final { return false; }; 81 81 bool createUniqueIndices() final; 82 82 const MemoryCompactLookupOnlyRobinHoodHashMap<String, TableAndIndexPair>& expectedTableAndIndexQueries() final; -
trunk/Tools/ChangeLog
r287010 r287013 1 2021-12-13 John Wilander <wilander@apple.com> 2 3 PCM: Remove old DB update and migration code, and add a unit test for destination token DB columns 4 https://bugs.webkit.org/show_bug.cgi?id=234281 5 <rdar://86347439> 6 7 Reviewed by Alex Christensen and Kate Cheney. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/PrivateClickMeasurement.mm: 10 (addAttributedPCMv5): 11 (pollUntilPCMIsMigrated): 12 Now takes a parameter UsingDestinationToken and handles its expectation 13 accordingly. 14 (TEST): 15 New test PrivateClickMeasurement.MigrateWithDestinationToken. 16 1 17 2021-12-13 Alex Christensen <achristensen@webkit.org> 2 18 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PrivateClickMeasurement.mm
r284474 r287013 210 210 } 211 211 212 static void addAttributedPCMv5(WebCore::SQLiteDatabase& database) 213 { 214 constexpr auto createAttributedPrivateClickMeasurementV5 = "CREATE TABLE AttributedPrivateClickMeasurement (" 215 "sourceSiteDomainID INTEGER NOT NULL, destinationSiteDomainID INTEGER NOT NULL, sourceID INTEGER NOT NULL, " 216 "attributionTriggerData INTEGER NOT NULL, priority INTEGER NOT NULL, timeOfAdClick REAL NOT NULL, " 217 "earliestTimeToSendToSource REAL, token TEXT, signature TEXT, keyID TEXT, earliestTimeToSendToDestination REAL, sourceApplicationBundleID TEXT, destinationToken, destinationSignature, destinationKeyID," 218 "FOREIGN KEY(sourceSiteDomainID) REFERENCES PCMObservedDomains(domainID) ON DELETE CASCADE, FOREIGN KEY(destinationSiteDomainID) REFERENCES " 219 "PCMObservedDomains(domainID) ON DELETE CASCADE)"_s; 220 221 EXPECT_TRUE(database.executeCommand(createAttributedPrivateClickMeasurementV5)); 222 constexpr auto insertAttributedPrivateClickMeasurementQueryV5 = "INSERT OR REPLACE INTO AttributedPrivateClickMeasurement (sourceSiteDomainID, destinationSiteDomainID, " 223 "sourceID, attributionTriggerData, priority, timeOfAdClick, earliestTimeToSendToSource, token, signature, keyID, earliestTimeToSendToDestination, sourceApplicationBundleID, destinationToken, destinationSignature, destinationKeyID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"_s; 224 225 #if PLATFORM(MAC) 226 auto bundleID = "com.apple.Safari"; 227 #else 228 auto bundleID = "com.apple.mobilesafari"; 229 #endif 230 addValuesToTable<15>(database, insertAttributedPrivateClickMeasurementQueryV5, { 1, 2, 42, 14, 7, 1.0, earliestTimeToSend(), "test token", "test signature", "test key id", earliestTimeToSend(), bundleID, "test destination token", "test destination signature", "test destination key id" }); 231 } 232 212 233 static RetainPtr<NSString> dumpedPCM(WKWebView *webView) 213 234 { … … 223 244 224 245 enum class MigratingFromResourceLoadStatistics : bool { No, Yes }; 225 static void pollUntilPCMIsMigrated(WKWebView *webView, MigratingFromResourceLoadStatistics migratingFromResourceLoadStatistics) 246 enum class UsingDestinationToken : bool { No, Yes }; 247 static void pollUntilPCMIsMigrated(WKWebView *webView, MigratingFromResourceLoadStatistics migratingFromResourceLoadStatistics, UsingDestinationToken usingDestinationToken) 226 248 { 227 249 if (migratingFromResourceLoadStatistics == MigratingFromResourceLoadStatistics::Yes) { … … 252 274 "Attribution priority: 7\n" 253 275 "Attribution earliest time to send: Outside 24-48 hours\n" 276 ""; 277 278 NSString *suffix = @"Destination token: "; 279 suffix = [suffix stringByAppendingString:(usingDestinationToken == UsingDestinationToken::No ? @"Not set\n" : @"\ntoken: test destination token\nsignature: test destination signature\nkey: test destination key id\n")]; 254 280 #if PLATFORM(MAC) 255 "Application bundle identifier: com.apple.Safari\n"281 suffix = [suffix stringByAppendingString:@"Application bundle identifier: com.apple.Safari\n"]; 256 282 #else 257 "Application bundle identifier: com.apple.mobilesafari\n"283 suffix = [suffix stringByAppendingString:@"Application bundle identifier: com.apple.mobilesafari\n"]; 258 284 #endif 259 "";285 expectedMigratedPCMDatabase = [expectedMigratedPCMDatabase stringByAppendingString:suffix]; 260 286 261 287 while (![dumpedPCM(webView) isEqualToString:expectedMigratedPCMDatabase]) 262 288 usleep(10000); 289 EXPECT_WK_STREQ(dumpedPCM(webView).get(), expectedMigratedPCMDatabase); 263 290 } 264 291 … … 355 382 setUpFromResourceLoadStatisticsDatabase(addUnattributedPCMv1, addAttributedPCMv1); 356 383 auto webView = webViewWithResourceLoadStatisticsEnabledInNetworkProcess(); 357 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::Yes );384 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::Yes, UsingDestinationToken::No); 358 385 cleanUp(); 359 386 } … … 363 390 setUpFromResourceLoadStatisticsDatabase(addUnattributedPCMv2, addAttributedPCMv2); 364 391 auto webView = webViewWithResourceLoadStatisticsEnabledInNetworkProcess(); 365 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::Yes );392 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::Yes, UsingDestinationToken::No); 366 393 cleanUp(); 367 394 } … … 371 398 setUpFromResourceLoadStatisticsDatabase(addUnattributedPCMv3, addAttributedPCMv3); 372 399 auto webView = webViewWithResourceLoadStatisticsEnabledInNetworkProcess(); 373 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::Yes );400 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::Yes, UsingDestinationToken::No); 374 401 cleanUp(); 375 402 } … … 379 406 setUpFromPCMDatabase(addUnattributedPCMv4, addAttributedPCMv4); 380 407 auto webView = webViewWithResourceLoadStatisticsEnabledInNetworkProcess(); 381 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::No );408 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::No, UsingDestinationToken::No); 382 409 cleanUp(); 383 410 } 411 412 TEST(PrivateClickMeasurement, MigrateWithDestinationToken) 413 { 414 setUpFromPCMDatabase(addUnattributedPCMv4, addAttributedPCMv5); 415 auto webView = webViewWithResourceLoadStatisticsEnabledInNetworkProcess(); 416 pollUntilPCMIsMigrated(webView.get(), MigratingFromResourceLoadStatistics::No, UsingDestinationToken::Yes); 417 cleanUp(); 418 }
Note:
See TracChangeset
for help on using the changeset viewer.