[webkit-changes] [WebKit/WebKit] a5047d: REGRESSION (252960 at main, WPT resync): [ macOS Debu...

Chris Dumez noreply at github.com
Thu Nov 10 08:59:19 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a5047de4052aba74f36f2ae51ef33d733aa3b020
      https://github.com/WebKit/WebKit/commit/a5047de4052aba74f36f2ae51ef33d733aa3b020
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-11-10 (Thu, 10 Nov 2022)

  Changed paths:
    M LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/EventSender.h
    M Source/WebCore/html/HTMLLinkElement.cpp
    M Source/WebCore/html/HTMLLinkElement.h
    M Source/WebCore/html/HTMLStyleElement.cpp
    M Source/WebCore/html/HTMLStyleElement.h
    M Source/WebCore/loader/ImageLoader.cpp
    M Source/WebCore/loader/ImageLoader.h
    M Source/WebCore/svg/animation/SVGSMILElement.cpp
    M Source/WebCore/svg/animation/SVGSMILElement.h
    M Source/WebCore/xml/parser/XMLDocumentParser.cpp

  Log Message:
  -----------
  REGRESSION (252960 at main, WPT resync): [ macOS Debug ] imported/w3c/web-platform-tests/html/semantics/document-metadata/the-style-element/style-load-after-mutate.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=244014
rdar://98757197

Reviewed by Ryosuke Niwa.

The test in question starts out with an empty <style> and then adds an @import
to it. However, the URL of the @import points to a missing resource. As a
result, we first schedule the dispatch of a load event, then an error event.
The test makes sure that a load event is fired and times out if none gets fired.

The issue was that HTMLStyleElement was using the same EventSender for the load
and error events. However, EventSender was storing senders in its queue, not
events. The state about whether to send a load or an error event was stored on
the HTMLStyleElement instance instead.

This meant that we could schedule a load event and then an error event right
after one another. The request to send an error event would override the state
on the HTMLStyleElement and we would end up sending 2 error events, instead of
a load event followed by an error event.

To address the issue, I updated EventSender to store the event type in its
queue, in addition to the sender. We would have used two separate EventSenders
like HTMLLinkElement was doing. However, I worry that ordering between load
and error events may be incorrect if we use separate queues.

* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::implicitClose):
* Source/WebCore/dom/EventSender.h:
(WebCore::EventSender::hasPendingEvents const):
(WebCore::Counter>::EventSender):
(WebCore::Counter>::dispatchEventSoon):
(WebCore::Counter>::cancelEvent):
(WebCore::Counter>::dispatchPendingEvents):
(WebCore::EventSender::eventType const): Deleted.
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::didAttachRenderers):
* Source/WebCore/html/HTMLLinkElement.cpp:
(WebCore::linkLoadEventSender):
(WebCore::HTMLLinkElement::~HTMLLinkElement):
(WebCore::HTMLLinkElement::linkLoaded):
(WebCore::HTMLLinkElement::linkLoadingErrored):
(WebCore::HTMLLinkElement::dispatchPendingEvent):
(WebCore::HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources):
(WebCore::linkErrorEventSender): Deleted.
* Source/WebCore/html/HTMLLinkElement.h:
* Source/WebCore/html/HTMLStyleElement.cpp:
(WebCore::styleLoadEventSender):
(WebCore::HTMLStyleElement::dispatchPendingEvent):
(WebCore::HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources):
* Source/WebCore/html/HTMLStyleElement.h:
* Source/WebCore/html/ImageInputType.cpp:
(WebCore::ImageInputType::attach):
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::loadEventSender):
(WebCore::ImageLoader::ImageLoader):
(WebCore::ImageLoader::~ImageLoader):
(WebCore::ImageLoader::clearImageWithoutConsideringPendingLoadEvent):
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::didUpdateCachedImage):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::dispatchPendingEvent):
(WebCore::ImageLoader::dispatchPendingErrorEvent):
(WebCore::beforeLoadEventSender): Deleted.
(WebCore::errorEventSender): Deleted.
(WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): Deleted.
(WebCore::ImageLoader::dispatchPendingBeforeLoadEvents): Deleted.
(WebCore::ImageLoader::dispatchPendingErrorEvents): Deleted.
* Source/WebCore/loader/ImageLoader.h:
(WebCore::ImageLoader::hasPendingBeforeLoadEvent const): Deleted.
* Source/WebCore/svg/animation/SVGSMILElement.cpp:
(WebCore::smilEventSender):
(WebCore::SVGSMILElement::~SVGSMILElement):
(WebCore::SVGSMILElement::progress):
(WebCore::SVGSMILElement::dispatchPendingEvent):
(WebCore::smilBeginEventSender): Deleted.
(WebCore::smilEndEventSender): Deleted.
* Source/WebCore/svg/animation/SVGSMILElement.h:
* Source/WebCore/xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::append):

Canonical link: https://commits.webkit.org/256535@main




More information about the webkit-changes mailing list