Skip to content

servo: Add support for system focus handling - #48364

Merged
mrobinson merged 3 commits into
servo:mainfrom
mrobinson:focus
Sep 25, 2026
Merged

mrobinson merged 3 commits into
servo:mainfrom
mrobinson:focus

Conversation

@mrobinson

Copy link
Copy Markdown
Member

Instead of letting web content decide whether or not a WebView is
"focused," have the embedder tell Servo whether or not the WebView has
system focus and separate it from the concept of the focused browsing
context. This makes Servo match the model that the specification
describes.

Now, when a WebView does not have system focus or a frame is not
active its selection highlight is drawn in a different color (hardcoded
for now). In addition, specification-compliant behavior is implemented
around system focus. This means that when a Document gains system
focus proper focus events are fired and hasFocus starts to return the
correct value.

This allows properly implementing the concept of the WebView "selected
for interaction" in WebDriver versus the one with system focus. We were
conflating the two before.

There are API changes here. Now instead of calling focus() or blur()
on the WebView embedders are supposed to inform the WebView when it
receives system focus.

Testing: This gets one new WPT test passing.
Fixes: #9482.
Fixes: #44308.
Fixes: #48254.

@mrobinson mrobinson added the T-linux-wpt Do a try run of the WPT label Sep 24, 2026
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Sep 24, 2026
@github-actions

Copy link
Copy Markdown

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

@jschwe jschwe added T-ohos Do a try run on OpenHarmony T-android Do a try run on Android labels Sep 24, 2026
@github-actions github-actions Bot removed the T-ohos Do a try run on OpenHarmony label Sep 24, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#36011291090) for OpenHarmony

@github-actions github-actions Bot removed the T-android Do a try run on Android label Sep 24, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#36011307555) for Android

@github-actions

Copy link
Copy Markdown

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

Flaky unexpected result (34)
  • OK /IndexedDB/idbtransaction-oncomplete.any.html (#42845)
    • FAIL [expected PASS] subtest: IDBTransaction - complete event

      assert_array_equals: lengths differ, expected array ["upgradeneeded", "complete", "success", "opencursor"] length 4, got ["upgradeneeded", "complete", "success"] length 3
      

  • TIMEOUT [expected OK] /_webgl/conformance/textures/misc/tex-image-and-sub-image-2d-with-array-buffer-view.html
    • NOTRUN [expected PASS] subtest: Overall test
  • CRASH [expected OK] /_webgl/conformance/uniforms/no-over-optimization-on-uniform-array-14.html
  • CRASH [expected OK] /_webgl/conformance2/sync/sync-webgl-specific.html
  • CRASH [expected OK] /content-security-policy/frame-ancestors/frame-ancestors-sandbox-same-origin-self.html (#48268)
  • CRASH [expected OK] /content-security-policy/gen/top.http-rp/script-src-self/worker-import.http.html
  • TIMEOUT [expected CRASH] /content-security-policy/inheritance/blob-url-in-main-window-self-navigate-inherits.sub.html (#41490)
  • FAIL [expected PASS] /css/css-backgrounds/background-size-041.html
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-weight: '430' should prefer '450 460' over '500'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-weight: '500' should prefer '450 460' over '400'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-weight: '501' should prefer '500' over '450 460'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'normal' should prefer 'oblique -50deg -20deg' over 'oblique -40deg -30deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 10deg' should prefer 'oblique 10deg' over 'oblique 5deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 10deg' should prefer 'oblique 15deg 20deg' over 'oblique 30deg 60deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • CRASH [expected ERROR] /css/filter-effects/parsing/flood-opacity-invalid.svg
  • TIMEOUT [expected OK] /fetch/content-encoding/zstd/big-zstd-body.https.any.worker.html
    • TIMEOUT [expected PASS] subtest: large zstd data should be decompressed successfully

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: large zstd data should be decompressed successfully with byte stream
  • CRASH [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/005.html (#27062)
  • 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/refresh/same-document-refresh.html (#34597)
    • FAIL [expected PASS] subtest: Same-Document Referrer from Refresh

      assert_equals: original page loads expected "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refresh-with-section.sub.html?url=%23section" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refresh-with-section.sub.html?url=%23section#section"
      

  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-requestsubmit.html (#44098)
    • FAIL [expected TIMEOUT] subtest: Replace before load, triggered by formElement.requestSubmit()

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?thereplacement=" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/resources/code-injector.html?pipe=sub(none)&code=%0A%20%20%20%20const%20form%20%3D%20document.createElement(%22form%22)%3B%0A%20%20%20%20form.action%20%3D%20%22%2Fcommon%2Fblank.html%22%3B%0A%0A%20%20%20%20const%20input%20%3D%20document.createElement(%22input%22)%3B%0A%20%20%20%20input.type%20%3D%20%22hidden%22%3B%0A%20%20%20%20input.name%20%3D%20%22thereplacement%22%3B%0A%20%20%20%20form.append(input)%3B%0A%0A%20%20%20%20document.currentScript.before(form)%3B%0A%20%20%20%20form.requestSubmit()%3B%0A%20%20"
      

  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-submit.html (#44028)
  • CRASH [expected TIMEOUT] /html/browsers/history/the-location-interface/location_replace_session_history.html (#41896)
  • ERROR [expected OK] /html/infrastructure/urls/base-url/base-url-javascript-nav.https.window.html
  • OK /html/semantics/embedded-content/media-elements/track/track-element/track-cues-sorted-before-dispatch.html (#48292)
    • FAIL [expected PASS] subtest: All events are triggered in chronological order

      assert_equals: expected 14 but got 16
      

  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-reload-location-reload.html (#32595)
  • CRASH [expected FAIL] /html/semantics/interestfor/interestfor-plain-inline-element.tentative.html
  • TIMEOUT [expected OK] /html/user-activation/navigation-state-reset-sameorigin.html (#45151)
    • TIMEOUT [expected FAIL] subtest: Post-navigation state reset.

      Test timed out
      

  • TIMEOUT [expected OK] /html/user-activation/propagation-sameorigin.html
    • NOTRUN [expected PASS] subtest: Propagation test
  • OK /infrastructure/testdriver/click_iframe.html (#47688)
    • FAIL [expected PASS] subtest: TestDriver click on a document in an iframe

      Unhandled rejection: assert_unreached: click failed Reached unreachable code
      

  • ERROR [expected TIMEOUT] /performance-timeline/not-restored-reasons/abort-block-bfcache.window.html (#42802)
  • TIMEOUT [expected OK] /pointerevents/compat/pointerevent_touch-action_two-finger_interaction.html (#44693)
    • NOTRUN [expected PASS] subtest: touch two-finger pan on 'touch-action: pan-x pan-y'
    • NOTRUN [expected FAIL] subtest: touch two-finger pan on 'touch-action: pinch-zoom'
  • OK /pointerevents/pointerevent_pointercapture_in_frame.html?pen (#45536)
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture.
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture to outer frame should not capture.
  • OK /resource-timing/buffer-full-then-increased.html (#44408)
    • FAIL [expected PASS] subtest: Test that overflowing the buffer and immediately increasing its limit does not trigger the resourcetimingbufferfull event

      assert_equals: Number of entries does not match the expected value. expected 3 but got 1
      

  • TIMEOUT /resource-timing/response-status-code.no-cors.html
    • TIMEOUT [expected FAIL] subtest: This test validates the response status of resources for no-CORS Requests. 108

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: This test validates the response status of resources for no-CORS Requests. 109
  • OK /sanitizer-api/sanitizer-inert-document.html (#45260)
    • PASS [expected FAIL] subtest: Test whether setHTML loads the image.
    • FAIL [expected PASS] subtest: Test whether setHTMLUnsafe loads the image.

      promise_test: Unhandled rejection with value: "The server observed a request. It shouldn't have."
      

  • TIMEOUT [expected PASS] /streams/readable-streams/crashtests/from-cross-realm.https.html
  • OK /touch-events/mouseevents-after-touchend.tentative.html (#46497)
    • PASS [expected FAIL] subtest: Single tap should cause a click
    • PASS [expected FAIL] subtest: Tapping too far points should not cause a dblclick
  • OK /upgrade-insecure-requests/gen/sharedworker-module-data.meta/unset/fetch.https.html
    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

  • OK /webdriver/tests/classic/perform_actions/pointer_mouse.py
    • FAIL [expected PASS] subtest: test_down_closes_browsing_context[without up]

      Failed: DID NOT RAISE <class 'webdriver.error.NoSuchWindowException'>
      

Stable unexpected results that are known to be intermittent (9)
  • TIMEOUT [expected OK] /_mozilla/mozilla/window-resize-event.html (#36741)
    • TIMEOUT [expected PASS] subtest: Popup onresize event fires after resizeTo

      Test timed out
      

  • OK /beacon/beacon-basic.https.window.html (#41723)
    • PASS [expected FAIL] subtest: Payload size restriction should be accumulated: type = string
    • PASS [expected FAIL] subtest: Payload size restriction should be accumulated: type = arraybuffer
  • OK [expected TIMEOUT] /fetch/api/redirect/redirect-keepalive.https.any.html (#32153)
    • PASS [expected TIMEOUT] subtest: [keepalive][iframe][load] mixed content redirect; setting up
  • OK [expected CRASH] /html/browsers/history/the-location-interface/replace-with-nested-iframe.html (#48219)
  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-location-replace-set-src.html (#32697)
  • CRASH [expected OK] /html/webappapis/dynamic-markup-insertion/opening-the-input-stream/remove-initial-about-blankness.window.html (#47638)
  • OK /resource-timing/test_resource_timing.https.html (#25216)
    • PASS [expected FAIL] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (link)
    • PASS [expected FAIL] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (xmlhttprequest)
  • OK [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?01-05 (#38975)
    • PASS [expected TIMEOUT] subtest: Navigate a window via anchor with javascript:-urls in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ default policy in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a frame via anchor with javascript:-urls in enforcing mode.
  • OK [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?16-20 (#44835)
    • PASS [expected TIMEOUT] subtest: Navigate a frame via area with javascript:-urls in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a frame via area with javascript:-urls w/ default policy in report-only mode.
Stable unexpected results (3)
  • OK /focus/hasfocus-different-site.html
    • PASS [expected FAIL] subtest: Check result
  • OK /focus/hasfocus-same-site.html
    • PASS [expected FAIL] subtest: Check result
  • TIMEOUT [expected PASS] /html/the-xhtml-syntax/parsing-xhtml-documents/adopt-while-parsing-001.html

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#36007974767) failed!

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#36011291090) failed!

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#36011307555) cancelled.

Instead of letting web content decide whether or not a `WebView` is
"focused," have the embedder tell Servo whether or not the `WebView` has
system focus and separate it from the concept of the focused browsing
context. This makes Servo match the model that the specification
describes.

Now, when a `WebView` does not have system focus or a frame is not
active its selection highlight is drawn in a different color (hardcoded
for now). In addition, specification-compliant behavior is implemented
around system focus. This means that when a `Document` gains system
focus proper focus events are fired and `hasFocus` starts to return the
correct value.

This allows properly implementing the concept of the `WebView` "selected
for interaction" in WebDriver versus the one with system focus. We were
conflating the two before.

There are API changes here. Now instead of calling `focus()` or `blur()`
on the `WebView` embedders are supposed to inform the `WebView` when it
receives system focus.

Signed-off-by: Martin Robinson <[email protected]>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 24, 2026
@mrobinson mrobinson added the T-ohos Do a try run on OpenHarmony label Sep 24, 2026
@github-actions github-actions Bot removed the T-ohos Do a try run on OpenHarmony label Sep 24, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#36015581464) for OpenHarmony

@github-actions

Copy link
Copy Markdown

🐰 Bencher Report

ProjectServo
Branch48364/PR
TestbedHUAWEI Mate 80 Pro

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown

✨ Try run (#36015581464) succeeded.

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have read the word focus too much and it doesn't look like a real word any more.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Sep 24, 2026
@mrobinson
mrobinson added this pull request to the merge queue Sep 24, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 24, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 24, 2026
@jdm

jdm commented Sep 25, 2026

Copy link
Copy Markdown
Member

Hmm, two timeouts for /html/the-xhtml-syntax/parsing-xhtml-documents/adopt-while-parsing-001.html in this PR.

@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 25, 2026
@mrobinson

Copy link
Copy Markdown
Member Author

Okay. I think I've narrowed this down to two separate issues:

  1. The needs display list flag in layout was never cleared when there is no root (there is no root in adopt-while-parsing-001.html).
  2. Since windows were stored in a HashMap in servoshell the focused window was up to chance after a window closes. I've corrected this by switching to using a Vec (cheap because there are usually only a couple windows at most).

@mrobinson mrobinson added T-linux-wpt Do a try run of the WPT T-ohos Do a try run on OpenHarmony labels Sep 25, 2026
@github-actions github-actions Bot removed T-linux-wpt Do a try run of the WPT T-ohos Do a try run on OpenHarmony labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#36124177456) for Linux (WPT), OpenHarmony

@github-actions

Copy link
Copy Markdown

🐰 Bencher Report

ProjectServo
Branch48364/PR
TestbedHUAWEI Mate 60 Pro

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown

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

Flaky unexpected result (32)
  • CRASH [expected OK] /IndexedDB/idbindex_indexNames.any.worker.html
  • FAIL [expected PASS] /_mozilla/css/image-percentage-dimen.html
  • TIMEOUT [expected OK] /_webgl/conformance/reading/read-pixels-test.html
  • CRASH [expected OK] /_webgl/conformance/uniforms/no-over-optimization-on-uniform-array-17.html
  • TIMEOUT [expected OK] /_webgl/conformance2/state/gl-object-get-calls.html
    • NOTRUN [expected PASS] subtest: Overall test
  • CRASH [expected OK] /_webgl/conformance2/wasm/readpixels-2gb-in-4gb-wasm-memory.html
  • CRASH [expected TIMEOUT] /css/css-animations/svg-use-transform-keyframes-custom-property-override.html
  • FAIL [expected PASS] /css/css-backgrounds/background-size-041.html
  • OK [expected ERROR] /css/selectors/invalidation/media-loading-pseudo-classes-in-has.sub.html
  • TIMEOUT [expected OK] /fetch/content-encoding/br/big-br-body.https.any.worker.html
    • TIMEOUT [expected PASS] subtest: large br data should be decompressed successfully

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: large br data should be decompressed successfully with byte stream
  • TIMEOUT [expected OK] /fetch/content-encoding/zstd/big-window-zstd-body.tentative.https.any.worker.html
    • TIMEOUT [expected FAIL] subtest: Consuming the body of a resource with too large of a zstd window size should reject

      Test timed out
      

  • TIMEOUT [expected OK] /fetch/content-encoding/zstd/big-zstd-body.https.any.worker.html
    • TIMEOUT [expected PASS] subtest: large zstd data should be decompressed successfully

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: large zstd data should be decompressed successfully with byte stream
  • 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
  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-requestsubmit.html (#44098)
    • FAIL [expected TIMEOUT] subtest: Replace before load, triggered by formElement.requestSubmit()

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?thereplacement=" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/resources/code-injector.html?pipe=sub(none)&amp;code=%0A%20%20%20%20const%20form%20%3D%20document.createElement(%22form%22)%3B%0A%20%20%20%20form.action%20%3D%20%22%2Fcommon%2Fblank.html%22%3B%0A%0A%20%20%20%20const%20input%20%3D%20document.createElement(%22input%22)%3B%0A%20%20%20%20input.type%20%3D%20%22hidden%22%3B%0A%20%20%20%20input.name%20%3D%20%22thereplacement%22%3B%0A%20%20%20%20form.append(input)%3B%0A%0A%20%20%20%20document.currentScript.before(form)%3B%0A%20%20%20%20form.requestSubmit()%3B%0A%20%20"
      

  • TIMEOUT /html/browsers/history/the-history-interface/001.html (#12580)
    • FAIL [expected PASS] subtest: traversing history must also traverse hash changes

      assert_equals: (this could cause other failures later on) expected "" but got "test"
      

  • TIMEOUT /html/semantics/embedded-content/media-elements/autoplay-default-permissions-policy.https.sub.html (#46805)
    • TIMEOUT [expected PASS] subtest: Default "autoplay" feature policy ["self"] allows the top-level document.

      Test timed out
      

  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-location-replace-set-src.html (#32697)
  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-reload-location-reload.html (#32595)
    • PASS [expected FAIL] subtest: Reloading iframe loading='lazy' before it is loaded: location.reload
  • TIMEOUT [expected OK] /html/user-activation/navigation-state-reset-sameorigin.html (#45151)
    • TIMEOUT [expected FAIL] subtest: Post-navigation state reset.

      Test timed out
      

  • ERROR [expected OK] /intersection-observer/v2/animated-opacity.html (#40827)
  • OK /mixed-content/tentative/autoupgrades/video-upgrade.https.sub.html (#41135)
    • FAIL [expected PASS] subtest: Video autoupgraded

      assert_equals: Length. expected 1 but got Infinity
      

  • ERROR [expected TIMEOUT] /performance-timeline/not-restored-reasons/abort-block-bfcache.window.html (#42802)
  • TIMEOUT [expected OK] /pointerevents/compat/pointerevent_touch-action_two-finger_interaction.html (#44693)
    • NOTRUN [expected PASS] subtest: touch two-finger pan on 'touch-action: pan-x pan-y'
    • NOTRUN [expected FAIL] subtest: touch two-finger pan on 'touch-action: pinch-zoom'
  • OK /pointerevents/compat/pointerevent_touch_target_after_pointerdown_target_removed.tentative.html (#42813)
    • FAIL [expected PASS] subtest: After a pointerdown listener removes its target, touch events should be fired on the touchstart target even though an orphan and pointer events should be fired on the parent

      assert_equals: expected "[ { type: pointerdown, target: Element node &lt;div id=\"pointerDownTarget\"&gt;&lt;/div&gt; }, { type: touchstart, target: Element node &lt;div id=\"pointerDownTarget\"&gt;&lt;/div&gt; }, { type: pointerup, target: Element node &lt;div id=\"pointerDownTargetParent\"&gt;&lt;/div&gt; }, { type: touchend, target: Element node &lt;div id=\"pointerDownTarget\"&gt;&lt;/div&gt; } ]" but got "[ { type: pointerdown, target: Element node &lt;div id=\"pointerDownTarget\"&gt;&lt;/div&gt; }, { type: touchstart, target: Element node &lt;div id=\"pointerDownTarget\"&gt;&lt;/div&gt; }, { type: pointerup, target: Element node &lt;div id=\"pointerDownTargetParent\"&gt;&lt;/div&gt; }, { type: touchend, target: Element node &lt;div id=\"pointerDownTarget\"&gt;&lt;/div&gt; }, { type: pointermove, target: Element node &lt;div id=\"pointerDownTargetParent\"&gt;&lt;/div&gt; }, { type: pointerdown, target: Element node &lt;div id=\"pointerDownTargetParent\"&gt;&lt;/div&gt; }, { type: pointerup, target: Element node &lt;div id=\"pointerDownTargetParent\"&gt;&lt;/div&gt; } ]"
      

  • OK /preload/prefetch-document.html (#37210)
    • PASS [expected FAIL] subtest: different-site document prefetch with 'as=document' should not be consumed
  • OK /resource-timing/buffer-full-add-then-clear.html (#40819)
    • FAIL [expected PASS] subtest: Test that if the buffer is cleared after entries were added to the secondary buffer, those entries make it into the primary one

      assert_equals: Number of entries does not match the expected value. expected 3 but got 0
      

  • OK /resource-timing/test_resource_timing.https.html (#25216)
    • PASS [expected FAIL] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)
  • OK /sanitizer-api/sanitizer-inert-document.html (#45260)
    • PASS [expected FAIL] subtest: Test whether setHTML loads the image.
    • FAIL [expected PASS] subtest: Test whether setHTMLUnsafe loads the image.

      promise_test: Unhandled rejection with value: "The server observed a request. It shouldn't have."
      

  • OK /touch-events/hover-state-caused-by-compatibility-mouse-events.tentative.html (#46277)
    • PASS [expected FAIL] subtest: The compatibility mouse events should set :hover: The compatibility mouse events should be fired
  • TIMEOUT [expected OK] /trusted-types/trusted-types-navigation.html?31-35 (#38034)
    • TIMEOUT [expected PASS] subtest: Navigate a frame via form-submission with javascript:-urls in report-only mode.

      Test timed out
      

    • NOTRUN [expected PASS] subtest: Navigate a frame via form-submission with javascript:-urls w/ default policy in report-only mode.
    • NOTRUN [expected FAIL] subtest: Navigate a window via form-submission with javascript:-urls w/ a default policy throwing an exception in enforcing mode.
    • NOTRUN [expected FAIL] subtest: Navigate a window via form-submission with javascript:-urls w/ a default policy throwing an exception in report-only mode.
    • NOTRUN [expected FAIL] subtest: Navigate a window via form-submission with javascript:-urls w/ a default policy making the URL invalid in enforcing mode.
  • OK /upgrade-insecure-requests/gen/sharedworker-classic-data.meta/upgrade/websocket.https.html
    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for websocket to cross-ws-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for websocket to same-ws-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

  • OK /webdriver/tests/classic/perform_actions/pointer_pen.py (#47618)
    • FAIL [expected PASS] subtest: test_pen_pointer_in_shadow_tree[outer-open]

      AssertionError
      

    • FAIL [expected PASS] subtest: test_pen_pointer_in_shadow_tree[inner-open]

      AssertionError
      

Stable unexpected results that are known to be intermittent (13)
  • TIMEOUT [expected OK] /_mozilla/mozilla/window-resize-event.html (#36741)
    • TIMEOUT [expected PASS] subtest: Popup onresize event fires after resizeTo

      Test timed out
      

  • OK /beacon/beacon-basic.https.window.html (#41723)
    • FAIL [expected PASS] subtest: Payload size restriction should be accumulated: type = blob

      assert_false: expected false got true
      

  • OK [expected TIMEOUT] /fetch/api/redirect/redirect-keepalive.https.any.html (#32153)
    • PASS [expected TIMEOUT] subtest: [keepalive][iframe][load] mixed content redirect; setting up
  • CRASH [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/005.html (#27062)
  • 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"
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/media-elements/autoplay-disabled-by-permissions-policy.https.sub.html (#46012, #46804)
    • TIMEOUT [expected FAIL] subtest: Permissions-Policy header: autoplay "none" disallows same-origin iframes.

      Test timed out
      

  • OK /html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html (#47290)
    • PASS [expected FAIL] subtest: expect-no-linked-resources hint was ignored
  • OK /html/webappapis/user-prompts/print-during-unload.html (#35944)
    • PASS [expected FAIL] subtest: print() during unload
  • OK /pointerevents/pointerevent_pointercapture_in_frame.html?pen (#45536)
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture.
    • PASS [expected FAIL] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture to outer frame should not capture.
  • OK /resource-timing/buffer-full-then-increased.html (#44408)
    • FAIL [expected PASS] subtest: Test that overflowing the buffer and immediately increasing its limit does not trigger the resourcetimingbufferfull event

      assert_equals: Number of entries does not match the expected value. expected 3 but got 1
      

  • OK [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?06-10 (#37920)
    • PASS [expected TIMEOUT] subtest: Navigate a frame via anchor with javascript:-urls in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a frame via anchor with javascript:-urls w/ default policy in report-only mode.
    • FAIL [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ a default policy throwing an exception in enforcing mode.

      promise_test: Unhandled rejection with value: "Unexpected message received: \"No securitypolicyviolation reported!\""
      

    • FAIL [expected NOTRUN] subtest: Navigate a window via anchor with javascript:-urls w/ a default policy throwing an exception in report-only mode.

      promise_test: Unhandled rejection with value: "Unexpected message received: \"No securitypolicyviolation reported!\""
      

  • OK [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?26-30 (#38807)
    • PASS [expected TIMEOUT] subtest: Navigate a window via form-submission with javascript:-urls in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a window via form-submission with javascript:-urls w/ default policy in report-only mode.
    • PASS [expected NOTRUN] subtest: Navigate a frame via form-submission with javascript:-urls in enforcing mode.
    • PASS [expected NOTRUN] subtest: Navigate a frame via form-submission with javascript:-urls w/ default policy in enforcing mode.
  • OK /user-timing/measure_associated_with_navigation_timing.html (#47273)
    • PASS [expected FAIL] subtest: loadTime plus loadEventEnd to a mark "a" should equal to navigationStart to "a".

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#36124177456) succeeded with failures of jobs that don't block the Merge Queue. Please check the workflow run for details.

@mrobinson
mrobinson added this pull request to the merge queue Sep 25, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 25, 2026
Merged via the queue into servo:main with commit 15aa067 Sep 25, 2026
93 of 94 checks passed
@mrobinson
mrobinson deleted the focus branch September 25, 2026 15:18
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 25, 2026
RichardTjokroutomo pushed a commit to RichardTjokroutomo/servo that referenced this pull request Oct 6, 2026
Instead of letting web content decide whether or not a `WebView` is
"focused," have the embedder tell Servo whether or not the `WebView` has
system focus and separate it from the concept of the focused browsing
context. This makes Servo match the model that the specification
describes.

Now, when a `WebView` does not have system focus or a frame is not
active its selection highlight is drawn in a different color (hardcoded
for now). In addition, specification-compliant behavior is implemented
around system focus. This means that when a `Document` gains system
focus proper focus events are fired and `hasFocus` starts to return the
correct value.

This allows properly implementing the concept of the `WebView` "selected
for interaction" in WebDriver versus the one with system focus. We were
conflating the two before.

There are API changes here. Now instead of calling `focus()` or `blur()`
on the `WebView` embedders are supposed to inform the `WebView` when it
receives system focus.

Testing: This gets one new WPT test passing.
Fixes: servo#9482.
Fixes: servo#44308.
Fixes: servo#48254.

---------

Signed-off-by: Martin Robinson <[email protected]>
hhhwsqhhh pushed a commit to hhhwsqhhh/servo that referenced this pull request Oct 12, 2026
Instead of letting web content decide whether or not a `WebView` is
"focused," have the embedder tell Servo whether or not the `WebView` has
system focus and separate it from the concept of the focused browsing
context. This makes Servo match the model that the specification
describes.

Now, when a `WebView` does not have system focus or a frame is not
active its selection highlight is drawn in a different color (hardcoded
for now). In addition, specification-compliant behavior is implemented
around system focus. This means that when a `Document` gains system
focus proper focus events are fired and `hasFocus` starts to return the
correct value.

This allows properly implementing the concept of the `WebView` "selected
for interaction" in WebDriver versus the one with system focus. We were
conflating the two before.

There are API changes here. Now instead of calling `focus()` or `blur()`
on the `WebView` embedders are supposed to inform the `WebView` when it
receives system focus.

Testing: This gets one new WPT test passing.
Fixes: servo#9482.
Fixes: servo#44308.
Fixes: servo#48254.

---------

Signed-off-by: Martin Robinson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

4 participants