Skip to content

Conversation

@dklassic
Copy link
Contributor

@dklassic dklassic commented Apr 11, 2025

This PR addresses a crash in text input element due to a hack to prevent text input being trimmed.

The updated behavior will only add zero width space unicode character to the node if there's no text content instead of adding it constantly. Also by adding the same zero width space unicode character to text area when there's no text content within will allow text area element to properly display caret.

截圖 2025-04-11 中午12 51 00

This PR also addresses issues with multiple glyph runs:

2025-04-11.1.54.53.mov

Testing: This PR is tested using:

  • ./mach run -d 'data:text/html,<input id="input_element" value="xxxxxxxxxxxxxxxxxxxx">'
  • ./mach run -d 'data:text/html,<textarea id="input_element" value="xxxxxxxxxxxxxxxxxxxx">'

without causing crashes, while the results should be covered by WPT tests

Fixes: #36449

Signed-off-by: DK Liao <dklassic@gmail.com>
@dklassic dklassic added the T-linux-wpt Do a try run of the WPT label Apr 11, 2025
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Apr 11, 2025
@github-actions
Copy link

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

Signed-off-by: DK Liao <dklassic@gmail.com>
@github-actions
Copy link

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

Flaky unexpected result (19)
  • FAIL [expected PASS] /css/css-sizing/dynamic-available-size-iframe.html (#31559)
  • FAIL [expected PASS] /css/css-tables/table-cell-overflow-auto-scrolled.html (#35011)
  • OK /encoding/legacy-mb-japanese/euc-jp/eucjp-encode-form-cseucpkdfmtjapanese.html?1-1000
    • FAIL [expected PASS] subtest: U+30AE ギ %A5%AE

      assert_equals: expected "%A5%AE" but got ""
      

    • FAIL [expected PASS] subtest: U+30AF ク %A5%AF

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B0 グ %A5%B0

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B1 ケ %A5%B1

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B2 ゲ %A5%B2

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B3 コ %A5%B3

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B4 ゴ %A5%B4

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B5 サ %A5%B5

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B6 ザ %A5%B6

      str is undefined
      

    • FAIL [expected PASS] subtest: U+30B7 シ %A5%B7

      str is undefined
      

    • And 390 more unexpected results...
  • OK /encoding/legacy-mb-korean/euc-kr/euckr-encode-form-errors-misc.html?1-1000
    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+242 ɂ %26%23578%3B

      assert_equals: expected "%26%23578%3B" but got ""
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+243 Ƀ %26%23579%3B

      assert_equals: expected (string) "%26%23579%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+244 Ʉ %26%23580%3B

      assert_equals: expected (string) "%26%23580%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+245 Ʌ %26%23581%3B

      assert_equals: expected (string) "%26%23581%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+246 Ɇ %26%23582%3B

      assert_equals: expected (string) "%26%23582%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+247 ɇ %26%23583%3B

      assert_equals: expected (string) "%26%23583%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+248 Ɉ %26%23584%3B

      assert_equals: expected (string) "%26%23584%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+249 ɉ %26%23585%3B

      assert_equals: expected (string) "%26%23585%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+24A Ɋ %26%23586%3B

      assert_equals: expected (string) "%26%23586%3B" but got (undefined) undefined
      

    • FAIL [expected PASS] subtest: latin, greek, cyrillic, etc U+24B ɋ %26%23587%3B

      assert_equals: expected (string) "%26%23587%3B" but got (undefined) undefined
      

    • And 390 more unexpected results...
  • ERROR /fetch/metadata/generated/serviceworker.https.sub.html (#36247)
    • FAIL [expected PASS] subtest: sec-fetch-site - Same origin, no options - registration

      promise_test: Unhandled rejection with value: object "Error: Failed to query for recorded headers."
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/iframe-src-aboutblank-navigate-immediately.html (#29048)
    • FAIL [expected PASS] subtest: Navigating to a different document with form submission

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?1=" but got "about:blank"
      

  • OK /html/browsers/history/the-history-interface/traverse_the_history_2.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • 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 lengths differ, expected array [6, 5] length 2, got [6, 3, 3] length 3
      

  • ERROR [expected TIMEOUT] /html/canvas/element/manual/imagebitmap/createImageBitmap-serializable.html (#34120)
  • OK [expected CRASH] /html/canvas/offscreen/canvas-host/2d.canvas.host.size.large.worker.html (#30164)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/skip-another-top-level-browsing-context.html (#24161)
    • TIMEOUT [expected PASS] subtest: Autofocus elements queued in another top-level browsing context's documents should be skipped.

      Test timed out
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/media-elements/offsets-into-the-media-resource/currentTime-move-within-document.html
    • TIMEOUT [expected PASS] subtest: playback should not reset when moving within a document

      Test timed out
      

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

      Test timed out
      

  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • OK [expected TIMEOUT] /performance-timeline/navigation-id-detached-frame.tentative.html (#34773)
    • PASS [expected TIMEOUT] subtest: The navigation_id getter does not crash a window of detached frame
  • CRASH [expected OK] /webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html (#21408)
  • ERROR [expected OK] /workers/baseurl/alpha/import-in-moduleworker.html (#21315)
  • OK [expected ERROR] /workers/constructors/Worker/Worker-constructor.html (#22991)
  • OK /workers/dedicated-worker-from-blob-url.window.html (#22286)
    • PASS [expected FAIL] subtest: Creating a dedicated worker from a blob URL works immediately before revoking.
Stable unexpected results that are known to be intermittent (12)
  • OK /fetch/metadata/generated/css-font-face.https.sub.tentative.html (#32732)
    • PASS [expected FAIL] subtest: sec-fetch-site - Same site
    • PASS [expected FAIL] subtest: sec-fetch-user
  • 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/navigation-unload-cross-origin.sub.window.html (#29056)
    • FAIL [expected PASS] subtest: Cross-origin navigation started from unload handler must be ignored

      promise_test: Unhandled rejection with value: object "SecurityError: The operation is insecure."
      

  • 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/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)
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • FAIL [expected NOTRUN] subtest: Check that popups from a sandboxed iframe do not escape the sandbox

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

  • OK /navigation-timing/test-navigation-type-reload.html (#33334)
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventEnd &gt; Original domContentLoadedEventEnd
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventStart &gt; Original domContentLoadedEventStart
    • PASS [expected FAIL] subtest: Reload domInteractive &gt; Original domInteractive
    • PASS [expected FAIL] subtest: Reload fetchStart &gt; Original fetchStart
  • OK /resize-observer/eventloop.html (#33599)
    • PASS [expected FAIL] subtest: test0: multiple notifications inside same event loop
  • ERROR /service-workers/idlharness.https.any.html (#36250)
    • TIMEOUT [expected PASS] subtest: ServiceWorkerContainer interface: operation register((TrustedScriptURL or USVString), optional RegistrationOptions)

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation enable()

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation disable()

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation setHeaderValue(ByteString)

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation getState()

      Test timed out
      

  • OK /webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html (#22849)
    • FAIL [expected PASS] subtest: X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}. Index Actual Expected AbsError RelError Test threshold [14680] -3.3196886736716706e-39 2.0512369275093079e-1 2.0512369275093079e-1 1.0000000000000000e+0 3.8985999999999999e-3 [14681] 1.1480505578219891e-2 1.4340442419052124e-1 1.3192391861230135e-1 9.1994315626575540e-1 3.8985999999999999e-3 Max AbsError of 2.0512369275093079e-1 at index of 14680. Max RelError of 1.0000000000000000e+0 at index of 14680.

      assert_true: expected true got false
      

Stable unexpected results (3)
  • TIMEOUT [expected OK] /_mozilla/mozilla/img_placeholder_load.html
    • TIMEOUT [expected PASS] subtest: Loading a placeholder image should trigger an error on the img element

      Test timed out
      

  • OK /css/css-inline/baseline-source/baseline-source-first-textarea-001.tentative.html
    • PASS [expected FAIL] subtest: .target &gt; * 1
    • FAIL [expected PASS] subtest: .target &gt; * 7

      assert_equals: 
      &lt;span data-offset-y="80"&gt;&lt;/span&gt;
      offsetTop expected 80 but got 85
      

  • PASS [expected FAIL] /html/rendering/widgets/button-layout/input-type-button-clip.html

@github-actions
Copy link

⚠️ Try run (#14395202705) failed.

Signed-off-by: DK Liao <dklassic@gmail.com>
@github-actions
Copy link

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

Flaky unexpected result (2)
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-cross-origin.sub.window.html (#29056)
    • FAIL [expected PASS] subtest: Cross-origin navigation started from unload handler must be ignored

      promise_test: Unhandled rejection with value: object "SecurityError: The operation is insecure."
      

Stable unexpected results that are known to be intermittent (2)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/009.html (#24456)
    • PASS [expected FAIL] subtest: Link with onclick form submit to javascript url with document.write and href navigation
  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • FAIL [expected NOTRUN] subtest: Check that popups from a sandboxed iframe do not escape the sandbox

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

Stable unexpected results (2)
  • OK /css/css-inline/baseline-source/baseline-source-first-textarea-001.tentative.html
    • PASS [expected FAIL] subtest: .target &gt; * 1
    • FAIL [expected PASS] subtest: .target &gt; * 7

      assert_equals: 
      &lt;span data-offset-y="80"&gt;&lt;/span&gt;
      offsetTop expected 80 but got 85
      

  • PASS [expected FAIL] /html/rendering/widgets/button-layout/input-type-button-clip.html

@github-actions
Copy link

⚠️ Try run (#14395202705) failed.

@dklassic dklassic force-pushed the multi-glyph-run-crash branch from 1e00bf7 to 4ff5806 Compare April 11, 2025 05:14
Signed-off-by: DK Liao <dklassic@gmail.com>
@dklassic dklassic force-pushed the multi-glyph-run-crash branch from 4ff5806 to b2cd88e Compare April 11, 2025 05:15
@dklassic dklassic force-pushed the multi-glyph-run-crash branch from 11e1c79 to be6e66a Compare April 11, 2025 06:18
@jdm jdm enabled auto-merge April 11, 2025 06:19
Signed-off-by: DK Liao <dklassic@gmail.com>
auto-merge was automatically disabled April 11, 2025 06:19

Head branch was pushed to by a user without write access

@dklassic dklassic force-pushed the multi-glyph-run-crash branch from be6e66a to 88e8313 Compare April 11, 2025 06:19
@jdm jdm enabled auto-merge April 11, 2025 06:22
@jdm jdm added this pull request to the merge queue Apr 11, 2025
Merged via the queue into servo:main with commit 5df4c76 Apr 11, 2025
21 checks passed
@dklassic dklassic deleted the multi-glyph-run-crash branch April 11, 2025 10:22
Loirooriol added a commit to Loirooriol/servo that referenced this pull request Apr 11, 2025
This avoids some minor code duplication.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Loirooriol added a commit to Loirooriol/servo that referenced this pull request Apr 11, 2025
This avoids some minor code duplication.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
github-merge-queue bot pushed a commit that referenced this pull request Apr 11, 2025
This avoids some minor code duplication.

Testing: not needed (no behavior change)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
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.

Multi glyph runs in text input could crash

3 participants