Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5ab99ca27efb3bacdaf597bf202e7fd7227abb1c
      
https://github.com/WebKit/WebKit/commit/5ab99ca27efb3bacdaf597bf202e7fd7227abb1c
  Author: Chris Dumez <[email protected]>
  Date:   2025-12-18 (Thu, 18 Dec 2025)

  Changed paths:
    M Source/WebCore/workers/WorkerOrWorkletGlobalScope.cpp
    M Source/WebCore/workers/WorkerOrWorkletGlobalScope.h

  Log Message:
  -----------
  
html/semantics/scripting-1/the-script-element/json-module/repeated-imports.any.sharedworker.html
 is a flaky crash in debug
https://bugs.webkit.org/show_bug.cgi?id=304378
rdar://162879256

Reviewed by Sihui Liu.

Upon shared worker shutdown, when the shared worker is getting destroyed, we
see a `isContextThread()` check failing, even though we are on the shared worker
thread. The issue is that `WorkerOrWorkletGlobalScope::m_thread->thread()` is
null already by this point and so `isContextThread()` falls back to checking if
we're on the main thread. To address the issue, we now store the UID of the
context thread on `WorkerOrWorkletGlobalScope` and simply check it in
`isContextThread()`, which should be a lot more reliable. This made the crashes
go away for me locally.

No new tests, covered by 
html/semantics/scripting-1/the-script-element/json-module/repeated-imports.any.sharedworker.html.

* Source/WebCore/workers/WorkerOrWorkletGlobalScope.cpp:
(WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope):
(WebCore::WorkerOrWorkletGlobalScope::isContextThread const):
* Source/WebCore/workers/WorkerOrWorkletGlobalScope.h:

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



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

Reply via email to