Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script: Start rework to better match the specification HTML event loop #31505

Merged
merged 13 commits into from May 13, 2024

Conversation

gterzian
Copy link
Member

@gterzian gterzian commented Mar 5, 2024

Bring our HTML event-loop implementation in line with the spec: add an "update the rendering" task.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes are part of Fix HTML event-loop #31242.
  • These changes do not require tests. Although they cause two new failures, these changes are written in a way to affect as few tests as possible. This is the start of a large refactor and many tests are quite sensitive to the timing of our current design which doesn't match the specification.

@gterzian gterzian marked this pull request as draft March 5, 2024 11:28
@gterzian gterzian force-pushed the fix_html_event_loop branch 6 times, most recently from 5b9dc96 to b066ac6 Compare March 11, 2024 18:48
@gterzian gterzian marked this pull request as ready for review March 14, 2024 12:02
@gterzian
Copy link
Member Author

gterzian commented Mar 14, 2024

So, "fixing" the html loop will require some heavy refactoring, and sometimes additional implementation, for each step that is done as part of the new "update the rendering" task. Currently those steps are run in an ad hoc way by handling messages from the constellation/compositor/layout immediately when they are received. In each case, we have to review what the steps are doing exactly, and perform a kind of batching when handling incoming messages, and only running the steps for all batched items inside the single "update the rendering" task.

I have done this for:

  1. The resize steps.
  2. Compositor events(focusing steps, plus other events which need to be broken down further).

I think this shows the overall structure, and I have added TODOs for the other items. Doing, and reviewing, this in a single PR is not doable.

Please let me know what you think. @mrobinson @jdm @wusyong (and anyone else interested).

I'd say we can see how this affects the test suite, and try to merge it as is, with follow-ups for each TODO (See https://github.com/servo/servo/pull/31505/files#diff-2c5948584719622eef023c56cdf90e8278971f2f2eda26e7fd0485a24c32be3cR1675) I'll also file more details issues for those TODOs(first one is at #31665)

@gterzian gterzian added the T-linux-wpt-2020 Do a try run of the WPT label Mar 26, 2024
@github-actions github-actions bot removed the T-linux-wpt-2020 Do a try run of the WPT label Mar 26, 2024
Copy link

🔨 Triggering try run (#8431586341) for Linux WPT

Copy link

Test results for linux-wpt-layout-2020 from try job (#8431586341):

Flaky unexpected result (19)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-with-non-reserved-words.html (#16216)
    • NOTRUN [expected PASS] subtest: Overall test
  • CRASH [expected PASS] /css/css-flexbox/orthogonal-flex-item-crash.html
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • PASS [expected FAIL] subtest: Matching font-weight: '500' should prefer '500' over '450 460'
    • PASS [expected FAIL] subtest: Matching font-weight: '501' should prefer '501' over '502 510'
    • PASS [expected FAIL] subtest: Matching font-weight: '399' should prefer '200 300' over '400'
    • PASS [expected FAIL] subtest: Matching font-stretch: '90%' should prefer '50% 80%' over '60% 70%'
    • PASS [expected FAIL] subtest: Matching font-style: 'normal' should prefer 'normal' over 'oblique 0deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'italic' should prefer 'oblique 5deg 10deg' over 'oblique 5deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 20deg' should prefer 'oblique 10deg' over 'italic'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 20deg' should prefer 'italic' over 'oblique 0deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 21deg' should prefer 'oblique 21deg' over 'oblique 30deg 60deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 21deg' should prefer 'oblique 40deg 50deg' over 'oblique 20deg'
    • And 8 more unexpected results...
  • OK /css/cssom-view/scroll-behavior-smooth-navigation.html (#29564)
    • FAIL [expected PASS] subtest: Smooth scrolling while doing history navigation.

      assert_not_equals: Shouldn't be scrolled back to top yet. got disallowed value 0
      

  • TIMEOUT [expected PASS] /css/filter-effects/feimage-reference-foreign-object-crash.html (#31542)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/empty-iframe-load-event.html (#29066)
    • FAIL [expected PASS] subtest: Check execution order from nested timeout

      assert_equals: Expected nested setTimeout to run second expected true but got false
      

    • FAIL [expected PASS] subtest: Check execution order on load handler

      assert_equals: Expected onload to run first expected false but got true
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-window-open.html (#28691)
    • FAIL [expected PASS] subtest: load event does not fire on window.open('about:blank')

      assert_unreached: load should not be fired Reached unreachable code
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • PASS [expected FAIL] subtest: Same-origin navigation started from unload handler must be ignored
  • OK /html/browsers/history/the-history-interface/traverse_the_history_5.html (#21383)
    • FAIL [expected PASS] subtest: Multiple history traversals, last would be aborted

      assert_array_equals: Pages opened during history navigation expected property 1 to be 5 but got 3 (expected array [6, 5] got [6, 3])
      

  • OK [expected CRASH] /html/browsers/windows/embedded-opener-remove-frame.html (#23867)
    • FAIL [expected TIMEOUT] subtest: opener of discarded auxiliary browsing context

      assert_equals: opener after removal expected null but got object "[object Window]"
      

  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK /html/semantics/embedded-content/the-img-element/non-active-document.html (#21544)
    • FAIL [expected PASS] subtest: DOMParser

      assert_unreached: got unexpected load event Reached unreachable code
      

    • FAIL [expected PASS] subtest: createHTMLDocument

      assert_unreached: got unexpected error event Reached unreachable code
      

    • FAIL [expected PASS] subtest: <template>

      assert_unreached: got unexpected error event Reached unreachable code
      

  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • PASS [expected FAIL] subtest: multipart/form-data: 0x00 in value (normal form)
  • OK /html/semantics/forms/form-submission-0/text-plain.window.html (#28687)
    • PASS [expected FAIL] subtest: text/plain: Basic File test (formdata event)
    • PASS [expected FAIL] subtest: text/plain: double quote in name (normal form)
  • OK [expected ERROR] /html/semantics/scripting-1/the-script-element/defer-script/async-script.html?reload (#29054)
  • TIMEOUT [expected OK] /html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html (#25805)
    • TIMEOUT [expected FAIL] subtest: Fulfillment handler on pending-then-fulfilled promise

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: Rejection handler on pending-then-rejected promise

      Test timed out
      

  • ERROR /resource-timing/content-type-parsing.html (#29131)
    • FAIL [expected TIMEOUT] subtest: mime-type 16 : text/html;charset=�gbk

      assert_equals: expected (string) "text/html" but got (undefined) undefined
      

    • TIMEOUT [expected NOTRUN] subtest: mime-type 17 : text/html;charset= gbk

      Test timed out
      

  • OK [expected TIMEOUT] /webmessaging/with-ports/017.html (#24486)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, about:blank
  • TIMEOUT [expected OK] /webstorage/localstorage-about-blank-3P-iframe-opens-3P-window.partitioned.tentative.html (#29053)
    • TIMEOUT [expected PASS] subtest: StorageKey: test 3P about:blank window opened from a 3P iframe

      Test timed out
      

Stable unexpected results that are known to be intermittent (34)
  • FAIL [expected PASS] /_mozilla/css/dirty_viewport.html (#13731)
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • TIMEOUT [expected ERROR] /_mozilla/css/matchMedia.html (#25775)
  • OK /_mozilla/css/stylesheet_media_queries.html (#17159)
    • FAIL [expected PASS] subtest: Media queries within stylesheets

      assert_equals: expected "rgb(0, 255, 0)" but got "rgb(255, 0, 0)"
      

  • TIMEOUT [expected PASS] /_mozilla/css/transition_calc_implicit.html (#17417)
  • FAIL [expected PASS] /_mozilla/mozilla/iframe/resize_after_load.html (#13573)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-uniform-packing-restrictions.html (#28103)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected OK] /_webgl/conformance/uniforms/out-of-bounds-uniform-array-access.html (#26225)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected PASS] /css/css-values/vh_not_refreshing_on_chrome.html (#23385, #15570)
  • TIMEOUT [expected OK] /css/css-values/viewport-units-after-font-load.html (#27645)
    • TIMEOUT [expected PASS] subtest: Viewport units are correctly updated after resize even if a font load has happened before

      Test timed out
      

  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-addListener-handleEvent.html (#24571)
    • TIMEOUT [expected PASS] subtest: calls handleEvent method of event listener

      Test timed out
      

    • NOTRUN [expected PASS] subtest: looks up handleEvent method on every event dispatch
    • NOTRUN [expected PASS] subtest: doesn't look up handleEvent method on callable event listeners
    • NOTRUN [expected PASS] subtest: rethrows errors when getting handleEvent
    • NOTRUN [expected FAIL] subtest: throws if handleEvent is falsy and not callable
    • NOTRUN [expected FAIL] subtest: throws if handleEvent is thruthy and not callable
  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-addListener-removeListener.html (#24569)
    • TIMEOUT [expected FAIL] subtest: listeners are called when <iframe> is resized

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: listeners are called correct number of times
    • NOTRUN [expected PASS] subtest: listeners are called in order they were added
    • NOTRUN [expected PASS] subtest: listener that was added twice is called only once
    • NOTRUN [expected PASS] subtest: listeners are called in order their MQLs were created
    • NOTRUN [expected PASS] subtest: removing listener from one MQL doesn't remove it from all MQLs
    • NOTRUN [expected PASS] subtest: MediaQueryList::removeListener removes added listener
  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-change-event-matches-value.html (#27973)
    • TIMEOUT [expected PASS] subtest: MediaQueryList.changed is correct for all lists in the document even during a change event handler

      Test timed out
      

  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-extends-EventTarget-interop.html (#25285)
    • TIMEOUT [expected PASS] subtest: listener added with addListener and addEventListener is called once

      Test timed out
      

    • NOTRUN [expected PASS] subtest: listener added with addListener and addEventListener (capture) is called twice
    • NOTRUN [expected PASS] subtest: removeEventListener removes listener added with addListener
    • NOTRUN [expected PASS] subtest: removeEventListener (capture) doesn't remove listener added with addListener
    • NOTRUN [expected PASS] subtest: removeListener removes listener added with addEventListener
    • NOTRUN [expected PASS] subtest: removeListener doesn't remove listener added with addEventListener (capture)
    • NOTRUN [expected PASS] subtest: capturing event listener fires before non-capturing listener at target
  • CRASH [expected TIMEOUT] /css/cssom-view/MediaQueryList-extends-EventTarget.html (#25269)
  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryListEvent.html (#25275)
    • TIMEOUT [expected PASS] subtest: argument of addListener

      Test timed out
      

    • NOTRUN [expected PASS] subtest: argument of onchange
    • NOTRUN [expected PASS] subtest: constructor of "change" event
  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.https.sub.html (#30111)
    • TIMEOUT [expected FAIL] subtest: sec-fetch-site - Same origin, no attributes

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: sec-fetch-site - Cross-site, no attributes
  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.sub.html (#30111)
    • TIMEOUT [expected FAIL] subtest: sec-fetch-site - Not sent to non-trustworthy same-origin destination, no attributes

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: sec-fetch-site - Not sent to non-trustworthy same-site destination, no attributes
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • FAIL [expected PASS] subtest: load & pageshow events do not fire on contentWindow of <iframe> element created with src=''

      assert_unreached: load should not be fired Reached unreachable code
      

  • CRASH [expected PASS] /html/canvas/element/manual/drawing-text-to-the-canvas/canvas.2d.disconnected-font-size-math.html (#30063)
  • CRASH [expected OK] /html/interaction/focus/the-autofocus-attribute/autofocus-dialog.html (#29087)
  • CRASH [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-empty.html (#28259)
  • CRASH [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-nonexistent.html (#28259)
  • CRASH [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-top.html (#28259)
  • CRASH [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-valid.html (#28259)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • TIMEOUT [expected FAIL] subtest: Contenteditable element should support autofocus

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: Element with tabindex should support autofocus
    • NOTRUN [expected PASS] subtest: Non-HTMLElement should not support autofocus
    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus should support autofocus
    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus including no focusable descendants should be skipped
    • NOTRUN [expected FAIL] subtest: Area element should support autofocus
  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html (#22667)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
  • TIMEOUT [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • NOTRUN [expected FAIL] subtest: Check that popups from a sandboxed iframe do not escape the sandbox
  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
    • NOTRUN [expected FAIL] subtest: Check that popups from a sandboxed iframe do not escape the sandbox
  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html (#21682)
    • PASS [expected FAIL] subtest: img (srcset 1 cand) valid image, resize to wide
    • TIMEOUT [expected FAIL] subtest: picture: source (max-width:500px) broken image, img valid image, resize to wide

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: picture: source (max-width:500px) valid image, img valid image, resize to wide

      Test timed out
      

    • PASS [expected FAIL] subtest: picture: same URL in source (max-width:500px) and img, resize to wide
    • PASS [expected FAIL] subtest: img (srcset 1 cand) valid image, resize to narrow
    • TIMEOUT [expected FAIL] subtest: picture: source (max-width:500px) valid image, img broken image, resize to narrow

      Test timed out
      

    • TIMEOUT [expected FAIL] subtest: picture: source (max-width:500px) valid image, img valid image, resize to narrow

      Test timed out
      

    • PASS [expected FAIL] subtest: picture: same URL in source (max-width:500px) and img, resize to narrow
  • OK [expected TIMEOUT] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • PASS [expected TIMEOUT] subtest: reparent-form-during-planned-navigation-task
  • TIMEOUT [expected OK] /webmessaging/without-ports/018.html (#24485)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, javascript:

      Test timed out
      

Stable unexpected results (10)
  • CRASH [expected OK] /_mozilla/css/animations/basic-transition.html
  • OK /_mozilla/css/animations/faster-reversing-of-transitions.html
    • FAIL [expected PASS] subtest: Reversed already reversed transitions are shortened proportionally

      assert_approx_equals: expected 100 +/- 1 but got 55
      

    • FAIL [expected PASS] subtest: Non-reversed transition changes use the full transition-duration

      assert_approx_equals: expected 20 +/- 1 but got 80
      

  • TIMEOUT [expected OK] /_mozilla/mozilla/mql_borrow.html
    • NOTRUN [expected PASS] subtest: Using matchMedia inside of a MediaQueryList callback does not panic
  • FAIL [expected PASS] /css/css-backgrounds/background-margin-iframe-root.html
  • TIMEOUT [expected PASS] /css/css-position/crashtests/scroll-tree-parent-construction.html
  • OK /html/semantics/embedded-content/the-img-element/relevant-mutations-lazy.html
    • FAIL [expected PASS] subtest: width attribute changes

      assert_unreached: update the image data didn't run Reached unreachable code
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-img-element/source-media-outside-doc.html
    • TIMEOUT [expected FAIL] subtest: Image source selection using media queries is performed for img elements outside the document

      Test timed out
      

  • OK /html/webappapis/animation-frames/callback-cross-realm-report-exception.html
    • FAIL [expected PASS] subtest: requestAnimationFrame() reports the exception from its callback in the callback's global object

      assert_array_equals: lengths differ, expected array ["frame1"] length 1, got [] length 0
      

  • TIMEOUT [expected OK] /html/webappapis/update-rendering/child-document-raf-order.html
    • TIMEOUT [expected FAIL] subtest: Ordering of steps in "Update the Rendering" - child document requestAnimationFrame order

      Test timed out
      

  • OK /quirks/percentage-height-calculation.html
    • FAIL [expected PASS] subtest: The percentage height calculation quirk, #foo { height:100px } #test { height:100%; position:absolute }<div id=foo><div><div id=test></div></div></div>

      assert_equals: quirks mode expected "200px" but got "0px"
      

    • FAIL [expected PASS] subtest: The percentage height calculation quirk, #foo { height:100px } #test { height:100%; position:fixed }<div id=foo><div><div id=test></div></div></div>

      assert_equals: quirks mode expected "200px" but got "0px"
      

Copy link

⚠️ Try run (#8431586341) failed.

@gterzian
Copy link
Member Author

gterzian commented Mar 27, 2024

@jdm @mrobinson + anyone else interested:

I am going to debug the Stable unexpected results (10), and I would appreciate feedback on the Flaky unexpected result (19). Most of them relate to css. I assume the tests are influenced by the timing of reflows and events firing? Meaning that, by the time some event fires, for example a resize event, the reflow must have already happened for the test to pass?

I think this is one open issue, for which I also opened #31871. Perhaps one way to address this at first is to do one reflow at the start of the "update the rendering task", and one at the end. Then later we can refine this and remove reflows, while maintaining test outcomes. Ideally we should have a single reflow at the end. But I think some of the steps fire events but expect the UI to already have been updated.

Example is the resize steps, which reads: "If (...) had its width or height changed since the last time these steps were run, fire an event (...)" emphasis is mine, and I think this means we would need to reflow after having updated sizes, but before firing those events as part of the "update the rendering task". In other words, in general we would need to:

  1. Logically update the UI(window size and so on).
  2. Reflow to actually update the UI.
  3. Fire events.

But 3 should happen only inside the "update the rendering task", so that it is properly ordered with respect to other stuff, like animation frame callbacks or resize observer callbacks. So if we reflow only at the end of the task, it means that those resize events should only fire at the next rendering opportunity(or we should reflow before firing the events, but then we have more than one reflow, if you see what I mean).

@gterzian gterzian added the T-linux-wpt-2020 Do a try run of the WPT label Mar 27, 2024
@github-actions github-actions bot removed the T-linux-wpt-2020 Do a try run of the WPT label Mar 27, 2024
Copy link

🔨 Triggering try run (#8447959621) for Linux WPT

Copy link

Test results for linux-wpt-layout-2020 from try job (#8447959621):

Flaky unexpected result (11)
  • FAIL [expected PASS] /_mozilla/mozilla/iframe/resize_after_load.html (#13573)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-with-non-reserved-words.html (#16216)
    • NOTRUN [expected PASS] subtest: Overall test
  • FAIL [expected PASS] /css/css-backgrounds/background-margin-iframe-root.html
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • PASS [expected FAIL] subtest: Matching font-weight: '400' should prefer '350 399' over '351 398'
    • PASS [expected FAIL] subtest: Matching font-stretch: '90%' should prefer '50% 80%' over '60% 70%'
    • PASS [expected FAIL] subtest: Matching font-style: 'italic' should prefer 'normal' over 'oblique 0deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 21deg' should prefer 'oblique 0deg' over 'oblique -50deg -20deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 10deg' should prefer 'oblique 30deg 60deg' over 'oblique 40deg 50deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 10deg' should prefer 'oblique 40deg 50deg' over 'italic'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique -20deg' should prefer 'oblique -20deg' over 'oblique -60deg -40deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique -21deg' should prefer 'oblique 0deg' over 'oblique 30deg 60deg'
  • TIMEOUT [expected OK] /custom-elements/reactions/customized-builtins/HTMLMediaElement.html (#31014)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • PASS [expected FAIL] subtest: Same-origin navigation started from unload handler must be ignored
  • OK /html/browsers/history/the-history-interface/traverse_the_history_5.html (#21383)
    • FAIL [expected PASS] subtest: Multiple history traversals, last would be aborted

      assert_array_equals: Pages opened during history navigation expected property 1 to be 5 but got 3 (expected array [6, 5] got [6, 3])
      

  • TIMEOUT [expected OK] /html/browsers/windows/auxiliary-browsing-contexts/opener-setter.html (#22668)
    • TIMEOUT [expected PASS] subtest: Auxiliary browsing context created via window.openand settingwindow.openertotestshould reporttest``

      Test timed out
      

  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • TIMEOUT /resource-timing/test_resource_timing.https.html (#25216)
    • FAIL [expected PASS] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)

      assert_equals: expected 9958400 but got 9958656
      

  • TIMEOUT [expected OK] /webmessaging/without-ports/018.html (#24485)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, javascript:

      Test timed out
      

Stable unexpected results that are known to be intermittent (21)
  • FAIL [expected PASS] /_mozilla/css/dirty_viewport.html (#13731)
  • TIMEOUT [expected PASS] /_mozilla/css/transition_calc_implicit.html (#17417)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-uniform-packing-restrictions.html (#28103)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected OK] /_webgl/conformance/uniforms/out-of-bounds-uniform-array-access.html (#26225)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected OK] /css/css-values/viewport-units-after-font-load.html (#27645)
    • TIMEOUT [expected PASS] subtest: Viewport units are correctly updated after resize even if a font load has happened before

      Test timed out
      

  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-addListener-handleEvent.html (#24571)
    • TIMEOUT [expected PASS] subtest: calls handleEvent method of event listener

      Test timed out
      

    • NOTRUN [expected PASS] subtest: looks up handleEvent method on every event dispatch
    • NOTRUN [expected PASS] subtest: doesn't look up handleEvent method on callable event listeners
    • NOTRUN [expected PASS] subtest: rethrows errors when getting handleEvent
    • NOTRUN [expected FAIL] subtest: throws if handleEvent is falsy and not callable
    • NOTRUN [expected FAIL] subtest: throws if handleEvent is thruthy and not callable
  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-addListener-removeListener.html (#24569)
    • TIMEOUT [expected FAIL] subtest: listeners are called when <iframe> is resized

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: listeners are called correct number of times
    • NOTRUN [expected PASS] subtest: listeners are called in order they were added
    • NOTRUN [expected PASS] subtest: listener that was added twice is called only once
    • NOTRUN [expected PASS] subtest: listeners are called in order their MQLs were created
    • NOTRUN [expected PASS] subtest: removing listener from one MQL doesn't remove it from all MQLs
    • NOTRUN [expected PASS] subtest: MediaQueryList::removeListener removes added listener
  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-change-event-matches-value.html (#27973)
    • TIMEOUT [expected PASS] subtest: MediaQueryList.changed is correct for all lists in the document even during a change event handler

      Test timed out
      

  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-extends-EventTarget-interop.html (#25285)
    • TIMEOUT [expected PASS] subtest: listener added with addListener and addEventListener is called once

      Test timed out
      

    • NOTRUN [expected PASS] subtest: listener added with addListener and addEventListener (capture) is called twice
    • NOTRUN [expected PASS] subtest: removeEventListener removes listener added with addListener
    • NOTRUN [expected PASS] subtest: removeEventListener (capture) doesn't remove listener added with addListener
    • NOTRUN [expected PASS] subtest: removeListener removes listener added with addEventListener
    • NOTRUN [expected PASS] subtest: removeListener doesn't remove listener added with addEventListener (capture)
    • NOTRUN [expected PASS] subtest: capturing event listener fires before non-capturing listener at target
  • TIMEOUT /css/cssom-view/MediaQueryList-extends-EventTarget.html (#25269)
    • TIMEOUT [expected PASS] subtest: onchange removes listener

      Test timed out
      

    • NOTRUN [expected PASS] subtest: listeners for "change" type are called
    • NOTRUN [expected PASS] subtest: listeners with different type are not called
    • NOTRUN [expected TIMEOUT] subtest: addEventListener "once" option is respected
  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryListEvent.html (#25275)
    • TIMEOUT [expected PASS] subtest: argument of addListener

      Test timed out
      

    • NOTRUN [expected PASS] subtest: argument of onchange
    • NOTRUN [expected PASS] subtest: constructor of "change" event
  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-referrer.window.html (#29081)
    • PASS [expected TIMEOUT] subtest: no-referrer referrer policy used to create the starting page
  • CRASH [expected FAIL] /html/canvas/element/manual/text/canvas.2d.disconnected.html (#30063)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/autofocus-dialog.html (#29087)
    • TIMEOUT [expected FAIL] subtest: <dialog>-contained autofocus element gets focused when the dialog is shown

      Test timed out
      

  • OK /html/interaction/focus/the-autofocus-attribute/document-with-fragment-valid.html (#28259)
    • PASS [expected FAIL] subtest: Autofocus elements in top-level browsing context's documents with URL fragments should be skipped.
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • TIMEOUT [expected FAIL] subtest: Element with tabindex should support autofocus

      Test timed out
      

    • NOTRUN [expected PASS] subtest: Non-HTMLElement should not support autofocus
    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus should support autofocus
    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus including no focusable descendants should be skipped
    • NOTRUN [expected FAIL] subtest: Area element should support autofocus
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html (#22667)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
  • OK [expected TIMEOUT] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • PASS [expected TIMEOUT] subtest: reparent-form-during-planned-navigation-task
  • OK [expected ERROR] /html/semantics/scripting-1/the-script-element/defer-script/async-script.html?reload (#29054)
Stable unexpected results (5)
  • TIMEOUT [expected PASS] /css/css-position/crashtests/scroll-tree-parent-construction.html
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/focusable-area-in-top-document.html
    • TIMEOUT [expected PASS] subtest: If topDocument's focused area is not topDocument, autofocus is not processed.

      Test timed out
      

  • OK /html/semantics/embedded-content/the-img-element/relevant-mutations-lazy.html
    • FAIL [expected PASS] subtest: width attribute changes

      assert_unreached: update the image data didn't run Reached unreachable code
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-img-element/source-media-outside-doc.html
    • TIMEOUT [expected FAIL] subtest: Image source selection using media queries is performed for img elements outside the document

      Test timed out
      

  • TIMEOUT [expected OK] /html/webappapis/update-rendering/child-document-raf-order.html
    • TIMEOUT [expected FAIL] subtest: Ordering of steps in "Update the Rendering" - child document requestAnimationFrame order

      Test timed out
      

Copy link

⚠️ Try run (#8447959621) failed.

@mrobinson
Copy link
Member

Looks like there are a lot of timeouts in MediaQuery tests and also another test using load (/css/css-values/viewport-units-after-font-load.html) events. Could it be that there's an issue with load events?

@gterzian
Copy link
Member Author

gterzian commented Mar 28, 2024

Looks like there are a lot of timeouts in MediaQuery tests and also another test using load (/css/css-values/viewport-units-after-font-load.html) events. Could it be that there's an issue with load events?

@mrobinson

Looking at one specific test, /css/cssom-view/MediaQueryList-addListener-handleEvent.html, the problem is that the iframes whose width are changed to trigger the handler are not considered "fully active" by the script thread for "long enough" for the update the rendering task to run. In other words, the task is queued, then later it is throttled because the iframe is not "fully active" anymore, and thus the rendering is not updated.

This is a new problem, because we are consolidating all logic into a task, whereas previously the logic would run when the compositor event was received(so as part of the script-thread message handling loop, but not part of the task queue which represents HTML event-loop tasks).

I guess I can try to run "update the rendering" tasks even when the pipeline is considered not fully active, at least as a start.

@gterzian gterzian added the T-linux-wpt-2020 Do a try run of the WPT label Mar 28, 2024
@github-actions github-actions bot removed the T-linux-wpt-2020 Do a try run of the WPT label Mar 28, 2024
@gterzian
Copy link
Member Author

@mrobinson Ok thank you, let's schedule a call via zulip.

I'll squash it all into one, because there was a lot of back and forth and some earlier commits do not reflect what happened eventually...

Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice change! I'm happy to see the event loop becoming more standards compliant. I have some suggestions (mainly nits), but in general this is great.

components/script/dom/document.rs Outdated Show resolved Hide resolved
components/script/dom/document.rs Outdated Show resolved Hide resolved
components/script/dom/document.rs Outdated Show resolved Hide resolved
components/script/dom/document.rs Outdated Show resolved Hide resolved
@@ -222,7 +222,7 @@ pub struct Window {

/// Pending resize event, if any.
#[no_trace]
resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>,
resize_event: DomRefCell<VecDeque<(WindowSizeData, WindowSizeType)>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should be called resize_events now and the rustdoc comment should be updated above. What's the reason that multiple resize events are stored now? Does it make sense to coalesce them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason that multiple resize events are stored now? Does it make sense to coalesce them?

To keep the same test pass rates, all of these events need to be handled one at the time.

components/script/script_thread.rs Outdated Show resolved Hide resolved
components/script/script_thread.rs Outdated Show resolved Hide resolved
components/script/task_queue.rs Outdated Show resolved Hide resolved
components/script/task_source/rendering.rs Outdated Show resolved Hide resolved
components/script/task_queue.rs Outdated Show resolved Hide resolved
@gterzian
Copy link
Member Author

gterzian commented May 7, 2024

@mrobinson Thanks for the review, I've addressed all comments(or commented).

gterzian and others added 13 commits May 13, 2024 10:53
add rendering task source

sketch structure to update the rendering

resize steps

composition events

fix warnings in rendering task source

refactor handling of composition events: put window and doc for pipeline on top

set script as user interacting in update the rendering task

fmt

add todos for other steps, put all compositor handling logic in one place

update the rendering: evaluate media queries and report changes

update the rendering: update animations and send events

update the rendering: run animation frames

update the rendering: order docs

put rendering related info on documents map

tidy

update the rendering: add issue numbers to todos

update the rendering: reflow as last step

update the rendering: add todo for top layer removals

note rendering opportunity when ticking animations for testing

fix double borrow crash in css/basic-transition

fix faster reversing of transitions test

undo ordering of docs

bypass not fully-active pipeline task throttling for rendering tasks

ensure tasks are dequed from task queue

prioritize update the rendering task

remove servo media stuff from set activity

tidy

debug

update the rendering: perform microtask checkpoint after task

tidy-up

only run evaluate media queries if resized

re-add evaluation of media queries for each rendering task, re-prioritize rendering tasks, re-add microtask checkpoint for all sequential messages

re-structure resize steps, and their interaction with evaluating media queries and reacting to environment changes

update the rendering: remove reflow call at the end

update webmessaging expectations

update to FAIL /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html

update to FAIL load-pageshow-events-window-open.html

add issue number for ordering of docs

nits

move batching of mouse move event to document info

nits

add doc for mouse move event index

reset mouse move event index when taking pending compositor events

fix replacing mouse move event

nits
@mrobinson mrobinson changed the title Fix HTML event loop script: Start rework to better match the specification HTML event loop May 13, 2024
@mrobinson
Copy link
Member

Apologies for the big delay here. I was on PTO. I will send this to the MQ now.

@mrobinson mrobinson enabled auto-merge May 13, 2024 08:56
@mrobinson mrobinson added this pull request to the merge queue May 13, 2024
Merged via the queue into servo:main with commit 1d66ea2 May 13, 2024
11 checks passed
jschwe added a commit to jschwe/servo that referenced this pull request May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants