[webkit-changes] [WebKit/WebKit] 21c114: [GTK][WPE][Debug] imported/w3c/web-platform-tests/...

Vitaly Dyachkov noreply at github.com
Fri Jan 12 05:54:08 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 21c1140b536ca89bfc2c3feaa1e6404d11839160
      https://github.com/WebKit/WebKit/commit/21c1140b536ca89bfc2c3feaa1e6404d11839160
  Author: Vitaly Dyachkov <vitaly at igalia.com>
  Date:   2024-01-12 (Fri, 12 Jan 2024)

  Changed paths:
    M Source/WebCore/Modules/notifications/NotificationResourcesLoader.cpp
    M Source/WebCore/Modules/notifications/NotificationResourcesLoader.h

  Log Message:
  -----------
  [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




More information about the webkit-changes mailing list