Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dbb85c8b0f3ab1cc61837b3439c87c31113372a4
      
https://github.com/WebKit/WebKit/commit/dbb85c8b0f3ab1cc61837b3439c87c31113372a4
  Author: Yoav Weiss <[email protected]>
  Date:   2025-12-03 (Wed, 03 Dec 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/speculation-tags/deduped-and-sorted-tags.https_type=prefetch-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/speculation-tags/prefetch-eagerness-pointer-down.https-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/speculation-tags/prefetch-eagerness-pointer-hover.https-expected.txt
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/loader/DocumentPrefetcher.cpp
    M Source/WebCore/loader/SpeculationRules.cpp

  Log Message:
  -----------
  Speculation Rules - fix up the tag dedupe logic
https://bugs.webkit.org/show_bug.cgi?id=303314

Reviewed by Alex Christensen.

The tag deduping test cases are failing for multiple reasons:
* Invalid tag rules are causing the entire Speculation Rules script to fail, 
rather than just the relevant rule.
* `null` rules are not being sorted properly, as they are treated as strings.
* Consecutive speculationrules scripts are being considered individually, 
rather than wait for the next microtask checkpoint.

This PR fixes all of the above, and with it most of the test cases of the 
relevant test.

No new tests, but this progresses a currently failing test.

* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/speculation-tags/deduped-and-sorted-tags.https_type=prefetch-expected.txt:
 Progression.
* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/speculation-tags/prefetch-eagerness-pointer-down.https-expected.txt:
 Progression.
* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/speculation-tags/prefetch-eagerness-pointer-hover.https-expected.txt:
 Expectation change.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::considerSpeculationRules): Align to spec. Queue a microtask.
(WebCore::Document::processSpeculationRules): Moved the actual logic here. 
Aligned to spec when it comes to tag deduping.
* Source/WebCore/dom/Document.h: Add m_speculationRulesConsiderationScheduled.
* Source/WebCore/loader/DocumentPrefetcher.cpp:
(WebCore::makePrefetchRequest): Handle null string as a tag.
* Source/WebCore/loader/SpeculationRules.cpp:
(WebCore::parseSingleRule): Dedupe tag if identical to ruleset tag. Append null 
instead of "null".
(WebCore::parseRules): Don't terminate speculation rules processing due to an 
invalid rule.
(WebCore::SpeculationRules::parseSpeculationRules): Add spec comments.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to