[webkit-changes] [WebKit/WebKit] 6e502e: Fix icon-request race in attachment ref tests

Gerald Squelart noreply at github.com
Tue Jul 18 15:53:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6e502e9d0156d9c2694057afdfb478bc258729de
      https://github.com/WebKit/WebKit/commit/6e502e9d0156d9c2694057afdfb478bc258729de
  Author: Gerald Squelart <g_squelart at apple.com>
  Date:   2023-07-18 (Tue, 18 Jul 2023)

  Changed paths:
    M LayoutTests/fast/attachment/cocoa/wide-attachment-class-expected.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-class.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-default-icon-expected.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-default-icon.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-folder-icon-expected.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-folder-icon.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-icon-from-file-extension-expected.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-icon-from-file-extension.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-id-expected.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-id.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-uti-expected.html
    M LayoutTests/fast/attachment/cocoa/wide-attachment-uti.html
    M LayoutTests/fast/attachment/mac/wide-attachment-element-gpu-process-expected.html
    M LayoutTests/fast/attachment/mac/wide-attachment-element-gpu-process.html
    M LayoutTests/fast/attachment/mac/wide-attachment-title-with-rtl-expected.html
    M LayoutTests/fast/attachment/mac/wide-attachment-title-with-rtl.html
    M LayoutTests/fast/attachment/mac/wide-attachment-type-attribute-expected.html
    M LayoutTests/fast/attachment/mac/wide-attachment-type-attribute.html
    A LayoutTests/fast/attachment/resources/attachment-test-utils.js
    M LayoutTests/platform/ios-wk2/TestExpectations
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/html/HTMLAttachmentElement.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp

  Log Message:
  -----------
  Fix icon-request race in attachment ref tests
https://bugs.webkit.org/show_bug.cgi?id=258865
rdar://problem/111764330

Reviewed by Aditya Keerthi.

Because icons are fetched asynchronously during the first paint, ref-tests should wait until all
Attachments have received their icons, in order to compare fully-rendered attachments.

* LayoutTests/fast/attachment/cocoa/wide-attachment-class-expected.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-class.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-default-icon-expected.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-default-icon.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-folder-icon-expected.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-folder-icon.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-icon-from-file-extension-expected.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-icon-from-file-extension.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-id-expected.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-id.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-uti-expected.html:
* LayoutTests/fast/attachment/cocoa/wide-attachment-uti.html:
* LayoutTests/fast/attachment/mac/wide-attachment-element-gpu-process-expected.html:
* LayoutTests/fast/attachment/mac/wide-attachment-element-gpu-process.html:
* LayoutTests/fast/attachment/mac/wide-attachment-title-with-rtl-expected.html:
* LayoutTests/fast/attachment/mac/wide-attachment-title-with-rtl.html:
* LayoutTests/fast/attachment/mac/wide-attachment-type-attribute-expected.html:
* LayoutTests/fast/attachment/mac/wide-attachment-type-attribute.html:
Add reftest-wait's, and calls to takeScreenshotWhenAttachmentsSettled.

* LayoutTests/fast/attachment/resources/attachment-test-utils.js: Added.
(takeScreenshotWhenAttachmentsSettled):
(takeActualScreenshotWhenAttachmentsSettled):
(takeExpectedScreenshotWhenAttachmentsSettled):
This will wait for all attachments to have received their icon ("load" event) and let the ref-test continue.
Otherwise, add diagnostic next to the failed attachment(s).

* LayoutTests/platform/ios-wk2/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
Removing recent flakiness flags, as these tests should now always pass.

* Source/WebCore/html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::ensureWideLayoutShadowTree):
(WebCore::HTMLAttachmentElement::updateImage):
(WebCore::HTMLAttachmentElement::updateIconForNarrowLayout):
(WebCore::HTMLAttachmentElement::updateIconForWideLayout):
(WebCore::HTMLAttachmentElement::requestWideLayoutIconIfNeeded):
These functions now update the m_requestingIcon flag as appropriate.
Also the updateIcon function are able to receive an empty icon (just to indicate that we're received a response).
`<attachment>` now dispatches the following events:
- "beforeload": There is a need for an icon, a request has been made.
- "loadingerror": Request response didn't contain an image.
- "loadeddata": Image from the request response has been set into the inner `<img>`.
- "error": Error from `<img>`.
- "load": Success from `<img>`, indicated the icon should now be visible.

* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateAttachmentIcon):
In case there is no actual image in the response, inform Attachment by sending null/empty data.

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




More information about the webkit-changes mailing list