Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 272970@main (21c1140). https://bugs.webkit.org/show_bug.c…
…gi?id=267132 [GTK][WPE][Debug] imported/w3c/web-platform-tests/notifications/instance.https.html is a constant crash https://bugs.webkit.org/show_bug.cgi?id=267132 Reviewed by Carlos Garcia Campos. Currently, when `NotificationResourcesLoader` starts downloading notification resources, we create a "ResourceLoader" per resource (we only support the icon resource for now) and add it to the set of running loaders `m_loaders`. When a `ResourceLoader` finishes, we check if it was the last one running. If yes, we run the `NotificationResourcesLoader`'s completion handler. But in some circumstances (e.g. when the icon URL is bogus) a `ResouceLoader` can execute its completion handler synchronously during construction. In this case, the `NotificationResourcesLoader`'s completion handler will be called from `didFinishLoadingResource()` because `m_loaders.isEmpty()` since we haven't added the loader to the set yet. To prevent it, this patch checks that `ResouceLoader` hasn't finished yet before adding it to the set of running loaders. * Source/WebCore/Modules/notifications/NotificationResourcesLoader.cpp: (WebCore::NotificationResourcesLoader::start): (WebCore::NotificationResourcesLoader::stop): (WebCore::NotificationResourcesLoader::didFinishLoadingResource): (WebCore::NotificationResourcesLoader::ResourceLoader::didFinishLoading): (WebCore::NotificationResourcesLoader::ResourceLoader::didFail): * Source/WebCore/Modules/notifications/NotificationResourcesLoader.h: Canonical link: https://commits.webkit.org/272970@main
- Loading branch information