Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 17fd4c9c02bfa2bb3aef379a9aedf9ab847c8dfc
      
https://github.com/WebKit/WebKit/commit/17fd4c9c02bfa2bb3aef379a9aedf9ab847c8dfc
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-04 (Sat, 04 Apr 2026)

  Changed paths:
    M Source/WebCore/html/HTMLInputElement.cpp

  Log Message:
  -----------
  Avoid redundant updateValidity() in 
HTMLInputElement::initializeInputTypeAfterParsingOrCloning()
https://bugs.webkit.org/show_bug.cgi?id=311484

Reviewed by Darin Adler.

initializeInputTypeAfterParsingOrCloning() was calling 
updateWillValidateAndValidity()
followed by registerForSuspensionCallbackIfNeeded(), runPostTypeUpdateTasks(), 
and then
a second updateValidity(). Since m_willValidateInitialized is always false at 
this point,
updateWillValidateAndValidity() never takes its early return and always calls
updateValidity() internally. The code between the two calls does not affect 
validity
state (no renderer exists during parsing, the element is not focused, and
registerForSuspensionCallbackIfNeeded() only checks autocomplete state). So the 
second
updateValidity() recomputed the same result and discarded it.

This is meaningful because updateValidity() calls computeValidity() which calls 
value()
which calls shouldApplyScriptTrackingPrivacyProtection(), and that walks the JS 
call
stack via sourceTaintedOriginFromStack() on every invocation. Eliminating the 
redundant
call avoids one JS stack walk per input element initialization.

Fix by moving the single updateWillValidateAndValidity() call to the end, after
registerForSuspensionCallbackIfNeeded() and runPostTypeUpdateTasks(), and 
removing the
separate updateValidity() call.

* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::initializeInputTypeAfterParsingOrCloning):

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



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

Reply via email to