Title: [291802] trunk
- Revision
- 291802
- Author
- [email protected]
- Date
- 2022-03-24 10:20:31 -0700 (Thu, 24 Mar 2022)
Log Message
PushAPI.firePushEventWithNoPagesTimeout fails in debug builds
https://bugs.webkit.org/show_bug.cgi?id=238309
Reviewed by Youenn Fablet.
Source/WebCore:
Export RegistrationDatabase::schemaVersion for tests to use.
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::databaseFilename):
(WebCore::cleanOldDatabases):
* workers/service/server/RegistrationDatabase.h:
Tools:
This test was dying on an assertion in debug builds because we were calling
terminateNetworkProcessWhileRegistrationIsStored with a brand new WKWebsiteDataStore, which
wasn't associated with an active NetworkProcess connection since it was a brand new object.
Fix this by using the existing data store object instead.
Additionally, terminateNetworkProcessWhileRegistrationIsStored was waiting on the wrong
filename, so I changed the test to reference the correct filename.
* TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (291801 => 291802)
--- trunk/Source/WebCore/ChangeLog 2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Source/WebCore/ChangeLog 2022-03-24 17:20:31 UTC (rev 291802)
@@ -1,3 +1,17 @@
+2022-03-24 Ben Nham <[email protected]>
+
+ PushAPI.firePushEventWithNoPagesTimeout fails in debug builds
+ https://bugs.webkit.org/show_bug.cgi?id=238309
+
+ Reviewed by Youenn Fablet.
+
+ Export RegistrationDatabase::schemaVersion for tests to use.
+
+ * workers/service/server/RegistrationDatabase.cpp:
+ (WebCore::databaseFilename):
+ (WebCore::cleanOldDatabases):
+ * workers/service/server/RegistrationDatabase.h:
+
2022-03-24 Chris Dumez <[email protected]>
String's find() / reverseFind() / replace() should take in a StringView instead of a String
Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp (291801 => 291802)
--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp 2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp 2022-03-24 17:20:31 UTC (rev 291802)
@@ -50,8 +50,6 @@
namespace WebCore {
-static const uint64_t schemaVersion = 8;
-
#define RECORDS_TABLE_SCHEMA_PREFIX "CREATE TABLE "
#define RECORDS_TABLE_SCHEMA_SUFFIX "(" \
"key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE" \
@@ -88,7 +86,7 @@
static const String& databaseFilename()
{
ASSERT(isMainThread());
- static NeverDestroyed<String> filename = databaseFilenameFromVersion(schemaVersion);
+ static NeverDestroyed<String> filename = databaseFilenameFromVersion(RegistrationDatabase::schemaVersion);
return filename;
}
@@ -99,7 +97,7 @@
static inline void cleanOldDatabases(const String& databaseDirectory)
{
- for (uint64_t version = 1; version < schemaVersion; ++version)
+ for (uint64_t version = 1; version < RegistrationDatabase::schemaVersion; ++version)
SQLiteFileSystem::deleteDatabaseFile(FileSystem::pathByAppendingComponent(databaseDirectory, databaseFilenameFromVersion(version)));
}
Modified: trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h (291801 => 291802)
--- trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h 2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Source/WebCore/workers/service/server/RegistrationDatabase.h 2022-03-24 17:20:31 UTC (rev 291802)
@@ -46,6 +46,8 @@
class RegistrationDatabase : public ThreadSafeRefCounted<RegistrationDatabase, WTF::DestructionThread::Main> {
WTF_MAKE_FAST_ALLOCATED;
public:
+ static constexpr uint64_t schemaVersion = 8;
+
static Ref<RegistrationDatabase> create(RegistrationStore& store, String&& databaseDirectory)
{
return adoptRef(*new RegistrationDatabase(store, WTFMove(databaseDirectory)));
Modified: trunk/Tools/ChangeLog (291801 => 291802)
--- trunk/Tools/ChangeLog 2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Tools/ChangeLog 2022-03-24 17:20:31 UTC (rev 291802)
@@ -1,3 +1,20 @@
+2022-03-24 Ben Nham <[email protected]>
+
+ PushAPI.firePushEventWithNoPagesTimeout fails in debug builds
+ https://bugs.webkit.org/show_bug.cgi?id=238309
+
+ Reviewed by Youenn Fablet.
+
+ This test was dying on an assertion in debug builds because we were calling
+ terminateNetworkProcessWhileRegistrationIsStored with a brand new WKWebsiteDataStore, which
+ wasn't associated with an active NetworkProcess connection since it was a brand new object.
+ Fix this by using the existing data store object instead.
+
+ Additionally, terminateNetworkProcessWhileRegistrationIsStored was waiting on the wrong
+ filename, so I changed the test to reference the correct filename.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm:
+
2022-03-24 Chris Dumez <[email protected]>
Unreviewed, update outdated comment after r291787.
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm (291801 => 291802)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm 2022-03-24 17:18:29 UTC (rev 291801)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm 2022-03-24 17:20:31 UTC (rev 291802)
@@ -31,6 +31,7 @@
#import "Test.h"
#import "TestNotificationProvider.h"
#import "TestWKWebView.h"
+#import <WebCore/RegistrationDatabase.h>
#import <WebKit/WKNotificationProvider.h>
#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
@@ -212,7 +213,8 @@
{
auto path = configuration.websiteDataStore._configuration._serviceWorkerRegistrationDirectory.path;
NSURL* directory = [NSURL fileURLWithPath:path isDirectory:YES];
- NSURL *swDBPath = [directory URLByAppendingPathComponent:@"ServiceWorkerRegistrations-7.sqlite3"];
+ auto filename = makeString("ServiceWorkerRegistrations-"_s, WebCore::RegistrationDatabase::schemaVersion, ".sqlite3");
+ NSURL *swDBPath = [directory URLByAppendingPathComponent:filename];
unsigned timeout = 0;
while (![[NSFileManager defaultManager] fileExistsAtPath:swDBPath.path] && ++timeout < 100)
TestWebKitAPI::Util::sleep(0.1);
@@ -327,6 +329,7 @@
// Disable service worker delay for the purpose of testing, push event should timeout after 1 second.
auto dataStoreConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] init]);
+ [dataStoreConfiguration setServiceWorkerProcessTerminationDelayEnabled:NO];
auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration.get()]);
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
@@ -344,10 +347,6 @@
TestWebKitAPI::Util::run(&done);
}
- [dataStoreConfiguration setServiceWorkerProcessTerminationDelayEnabled:NO];
- dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration.get()]);
- configuration.get().websiteDataStore = dataStore.get();
-
terminateNetworkProcessWhileRegistrationIsStored(configuration.get());
// Push event for service worker without any related page, should timeout so fail.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes