10BC0 script: Ensure `notify_invalidations()` is always called when modifying stylesheets by coding-joedow · Pull Request #38530 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content

Conversation

coding-joedow
Copy link
Contributor
@coding-joedow coding-joedow commented Aug 8, 2025

This change supplements the missing stylesheet invalidation notifications to fix some bugs that the modification of stylesheet does not take effect. Additionally, this PR add a RAII thing to mark the modification scope of stylesheet rules, which will facilitate to add extra logic before the modification happens.

Fixes: there is relevant issue #38211 , but it can't be fixed by this PR.
Testing: This fixes some subtests in /css/cssom/CSSStyleSheet-constructable.html.

@coding-joedow coding-joedow requested a review from gterzian as a code owner August 8, 2025 07:19
@stevennovaryo stevennovaryo added the T-linux-wpt Do a try run of the WPT label Aug 8, 2025
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Aug 8, 2025
Copy link
github-actions bot commented Aug 8, 2025

🔨 Triggering try run (#16824714233) for Linux (WPT)

Copy link
github-actions bot commented Aug 8, 2025

Test results for linux-wpt from try job (#16824714233):

Flaky unexpected result (19)
  • OK /content-security-policy/frame-ancestors/frame-ancestors-path-ignored.window.html (#36468)
    • FAIL [expected PASS] subtest: A 'frame-ancestors' CSP directive with a URL that includes a path should be ignored.

      assert_unreached: The IFrame should have been blocked (or cross-origin). It wasn't. Reached unreachable code
      

  • FAIL [expected PASS] /css/CSS2/text/text-indent-041.xht
  • FAIL [expected PASS] /css/css-fonts/font-language-override-03.html
  • FAIL [expected PASS] /css/css-pseudo/marker-tab-size.html
  • OK /fetch/private-network-access/worker-blob-fetch.tentative.window.html (#30064)
    • PASS [expected FAIL] subtest: local https to local https: success.
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin-fragment.html (#20768)
    • FAIL [expected PASS] subtest: Tests that a fragment navigation in the unload handler will not block the initial navigation

      assert_equals: expected "" but got "#fragment"
      

  • 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/browsing-the-web/navigating-across-documents/replace-before-load/a-click.html (#28697)
    • PASS [expected FAIL] subtest: aElement.click() before the load event must NOT replace
  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-submit.html (#34893)
    • TIMEOUT [expected FAIL] subtest: Replace before load, triggered by same-document formElement.submit()

      Test timed out
      

  • PASS [expected FAIL] /html/canvas/element/manual/drawing-text-to-the-canvas/canvas.2d.disconnected-font-size-math.html (#30063)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-nonexistent.html (#28259)
    • TIMEOUT [expected FAIL] subtest: Autofocus elements in top-level browsing context's documents with non-existent fragments should work.

      Test timed out
      

  • OK /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-reload-location-reload.html (#32595)
    • FAIL [expected PASS] subtest: Reloading iframe loading='lazy' before it is loaded: location.reload

      uncaught exception: Error: assert_equals: expected "http://web-platform.test:8000/html/semantics/embedded-content/the-iframe-element/support/blank.htm?src" but got "about:blank"
      

  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • PASS [expected FAIL] subtest: multipart/form-data: Basic test (normal form)
  • CRASH [expected TIMEOUT] /html/semantics/links/links-created-by-a-and-area-elements/target_blank_implicit_noopener.html
  • OK /html/webappapis/user-prompts/print-during-unload.html (#35944)
    • FAIL [expected PASS] subtest: print() during unload

      assert_array_equals: expected property 1 to be "destination" but got "error: window.print is not a function" (expected array ["start", "destination"] got ["start", "error: window.print is not a function"])
      

  • OK /preload/prefetch-document.html (#37210)
    • PASS [expected FAIL] subtest: different-site document prefetch with 'as=document' should not be consumed
  • TIMEOUT [expected OK] /resource-timing/tentative/document-initiated.html (#37785)
  • OK [expected ERROR] /service-workers/service-worker/claim-with-redirect.https.html
    • FAIL [expected PASS] subtest: Claim works after redirection to another origin

      assert_equals: expected (string) "updated" but got (undefined) undefined
      

  • OK [expected TIMEOUT] /webmessaging/without-ports/018.html (#24485)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, javascript:
Stable unexpected results that are known to be intermittent (25)
  • FAIL [expected PASS] /_mozilla/css/stacked_layers.html (#15988)
  • FAIL [expected PASS] /_mozilla/mozilla/sslfail.html (#10760)
  • TIMEOUT [expected OK] /_mozilla/mozilla/window_resize_event.html (#36741)
    • TIMEOUT [expected PASS] subtest: Popup onresize event fires after resizeTo

      Test timed out
      

  • OK /css/cssom-view/elementsFromPoint-iframes.html (#38362)
    • PASS [expected FAIL] subtest: elementsFromPoint on the root document for points in iframe elements
    • PASS [expected FAIL] subtest: elementsFromPoint on inner documents
  • TIMEOUT [expected FAIL] /dom/xslt/large-cdata.html (#38029)
  • TIMEOUT [expected OK] /fetch/api/redirect/redirect-keepalive.https.any.html (#32153)
    • TIMEOUT [expected PASS] subtest: [keepalive][iframe][load] mixed content redirect; setting up

      Test timed out
      

  • OK /fetch/metadata/generated/css-font-face.https.sub.tentative.html (#32732)
    • PASS [expected FAIL] subtest: sec-fetch-dest
  • OK /fetch/metadata/generated/css-font-face.sub.tentative.html (#34624)
    • PASS [expected FAIL] subtest: sec-fetch-storage-access - Not sent to non-trustworthy same-site destination
  • OK /html/browsers/browsing-the-web/navigating-across-documents/005.html (#27062)
    • PASS [expected FAIL] subtest: Link with onclick navigation and href navigation
  • OK /html/browsers/browsing-the-web/navigating-across-documents/008.html (#24456)
    • FAIL [expected PASS] subtest: Link with onclick form submit to javascript url and href navigation

      assert_equals: expected "href" but got "click"
      

  • 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
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-cross-origin.sub.window.html (#29056)
    • PASS [expected FAIL] subtest: Cross-origin navigation started from unload handler must be ignored
  • 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
  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html (#22667)
  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • OK /html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm (#37173)
    • PASS [expected FAIL] subtest: default object size after src is removed
  • 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 /navigation-timing/test-navigation-type-reload.html (#33334)
    • PASS [expected FAIL] subtest: Reload domComplete > Original domComplete
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventEnd > Original domContentLoadedEventEnd
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventStart > Original domContentLoadedEventStart
    • PASS [expected FAIL] subtest: Reload domInteractive > Original domInteractive
    • PASS [expected FAIL] subtest: Reload fetchStart > Original fetchStart
    • PASS [expected FAIL] subtest: Reload loadEventEnd > Original loadEventEnd
    • PASS [expected FAIL] subtest: Reload loadEventStart > Original loadEventStart
  • OK /preload/preload-error.sub.html (#37177)
    • FAIL [expected PASS] subtest: success (style): main

      assert_greater_than: http://web-platform.test:8000/preload/resources/dummy.css?label=style should be loaded expected a number greater than 0 but got 0
      

    • PASS [expected FAIL] subtest: 404 (style): main
    • PASS [expected FAIL] subtest: success (script): main
    • FAIL [expected PASS] subtest: 404 (script): main

      assert_greater_than: http://web-platform.test:8000/preload/resources/dummy.js?pipe=status%28404%29&label=script should be loaded expected a number greater than 0 but got 0
      

    • FAIL [expected PASS] subtest: CORS (script): main

      assert_greater_than: http://not-web-platform.test:8000/preload/resources/dummy.js?pipe=header%28Access-Control-Allow-Origin%2C*%29&label=script should be loaded expected a number greater than 0 but got 0
      

    • PASS [expected FAIL] subtest: success (xhr): main
    • FAIL [expected PASS] subtest: Decode-error (script): main

      assert_greater_than: http://web-platform.test:8000/preload/resources/dummy.xml?pipe=header%28Content-Type%2Ctext%2Fjavascript%29&label=script should be loaded expected a number greater than 0 but got 0
      

    • PASS [expected FAIL] subtest: MIME-error (script): main
  • OK /resize-observer/change-layout-in-error.html (#32629)
    • PASS [expected FAIL] subtest: Changing layout in window error handler should not result in lifecyle loop when resize observer loop limit is reached.
  • OK /resize-observer/eventloop.html (#33599)
    • PASS [expected FAIL] subtest: test0: multiple notifications inside same event loop
    • FAIL [expected PASS] subtest: test1: depths of shadow roots

      assert_unreached: Timed out waiting for notification. (1000ms) Reached unreachable code
      

  • ERROR [expected OK] /workers/constructors/Worker/Worker-constructor.html (#22991)
Stable unexpected results (1)
  • OK /css/cssom/CSSStyleSheet-constructable.html
    • PASS [expected FAIL] subtest: Changes to constructed stylesheets through CSSOM is reflected
    • PASS [expected FAIL] subtest: Stylesheets constructed on the main Document cannot be used in iframes
    • PASS [expected FAIL] subtest: Stylesheet constructed on iframe cannot be used in the main Document

Copy link
github-actions bot commented Aug 8, 2025

⚠️ Try run (#16824714233) failed.

@coding-joedow coding-joedow force-pushed the supplementary-of-missing-stylesheet-invalidation-notification branch from c7d5dc3 to 763fa74 Compare August 8, 2025 13:19

/// <https://drafts.csswg.org/cssom/#dom-medialist-mediatext>
fn SetMediaText(&self, value: DOMString) {
let _rules_modification_scope = RulesModificationScope::new(&self.parent_stylesheet);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this really work? I thought in Rust you can't control when an object is released, which is fully determined by the compiler...

@coding-joedow
Copy link
Contributor Author

All works in this PR have been moved into another PR: #38540

@mrobinson
Copy link
Member

All works in this PR have been moved into another PR: #38540

Since this work is distinct from #38540, would you consider reopening this and landing it first? Or, is it somehow inseparable from the other PR?

@coding-joedow coding-joedow reopened this Aug 14, 2025
@coding-joedow
Copy link
Contributor Author

All works in this PR have been moved into another PR: #38540

Since this work is distinct from #38540, would you consider reopening this and landing it first? Or, is it somehow inseparable from the other PR?

Because everyone was discussing it on another PR, I simply closed this PR. Indeed, this PR can be independent.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
@coding-joedow coding-joedow force-pushed the supplementary-of-missing-stylesheet-invalidation-notification branch from 763fa74 to 3a077bb Compare August 15, 2025 05:07
@mrobinson mrobinson changed the title script: supplementary of missing stylesheet invalidation notifications script: Ensure notify_invalidations() is always called when modifying stylesheets Aug 15, 2025
@mrobinson mrobinson added this pull request to the merge queue Aug 15, 2025
Merged via the queue into servo:main with commit 8b57453 Aug 15, 2025
23 checks passed
PotatoCP pushed a commit to PotatoCP/servo that referenced this pull request Aug 20, 2025
…ng stylesheets (servo#38530)

This change supplements the missing stylesheet invalidation
notifications to fix some bugs that the modification of stylesheet does
not take effect. Additionally, this PR add a RAII thing to mark the
modification scope of stylesheet rules, which will facilitate to add
extra logic before the modification happens.

Fixes: there is relevant issue servo#38211 , but it can't be fixed by this
PR.
Testing: This fixes some subtests in
`/css/cssom/CSSStyleSheet-constructable.html`.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
@coding-joedow coding-joedow deleted the supplementary-of-missing-stylesheet-invalidation-notification branch August 20, 2025 07:57
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.

4 participants
0