Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4d8f6d0f464caa32a3970a23e2f9dd5475e8b21
      
https://github.com/WebKit/WebKit/commit/a4d8f6d0f464caa32a3970a23e2f9dd5475e8b21
  Author: Sammy Gill <[email protected]>
  Date:   2026-09-02 (Wed, 02 Sep 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/resource-metadata-management/load-event-after-readystatechange-starts-load-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/resource-metadata-management/load-event-after-readystatechange-starts-load.html
    M Source/WebCore/loader/FrameLoader.cpp

  Log Message:
  -----------
  bankofamerica.com: cannot complete a wire transfer because the window load 
event is never dispatched
https://bugs.webkit.org/show_bug.cgi?id=323179
rdar://186373617

Reviewed by Chris Dumez.

On bankofamerica.com's wire transfer page the "Continue Transfer" button stays
disabled because the 2FA step-up modal never appears. The site's
sparta-stepup-loader-util.js creates the step-up widget's container element 
from a
window.onload handler, so when the load event is not dispatched the container 
is missing
and sparta-widget-loader-util.js throws on 
document.getElementById(params.containerId).style.

FrameLoader::checkCompleted() checked its completion conditions, set 
m_isComplete,
and only then called setReadyState(Complete), which dispatches readystatechange
synchronously which can as a result start new loads. In some cases, like
in bankofamerica.com and the test case, we may end up incrementing the load
event delay count. This can then result in us bailing out early in
checkCallImplicitClose(). Later on we will enter checkCompleted again but
bail out really early since we set m_isComplete.

Here we slightly modify the logic so that we check the completion
conditions (e.g. document->isDelayingLoadEvent()) after the call to 
setReadyState()
before setting m_isComplete in case anything changed as a result of
setReadyState(). Both checks now share one lambda so the two condition lists 
cannot
drift apart. An outstanding subresource request is deliberately left out of the 
second
check, since it never gated the load event before this change.

Author script running from readystatechange can also re-enter checkCompleted() 
and
complete the frame before we get back here. In that case the rest of the 
function has
already run, so we return early on m_isComplete rather than dispatching the 
load event
from inside the readystatechange dispatch and running the tail a second time.

Tests: 
imported/w3c/web-platform-tests/html/dom/documents/resource-metadata-management/load-event-after-readystatechange-starts-load.html

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkCompleted): Set m_isComplete after 
setReadyState(Complete)
rather than before it, and re-check the completion conditions once the 
readystatechange
handlers have run.
* 
LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/resource-metadata-management/load-event-after-readystatechange-starts-load.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/resource-metadata-management/load-event-after-readystatechange-starts-load-expected.txt:
 Added.
Starts an async script from a readystatechange handler and checks that the 
window load
event is still dispatched rather than being dropped. Whether that new load 
delays the
load event is not interoperable, so the test asserts no ordering between the 
two.

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



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

Reply via email to