Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d3c4861d70b136272b26f7fea2573dbb3f2b1736
https://github.com/WebKit/WebKit/commit/d3c4861d70b136272b26f7fea2573dbb3f2b1736
Author: Basuke Suzuki <[email protected]>
Date: 2025-12-06 (Sat, 06 Dec 2025)
Changed paths:
M Source/WebCore/inspector/CommandLineAPIHost.cpp
M Source/WebCore/inspector/CommandLineAPIHost.h
M Source/WebCore/inspector/FrameInspectorController.cpp
M Source/WebCore/inspector/PageInspectorController.cpp
M Source/WebCore/inspector/WebInjectedScriptManager.cpp
M Source/WebCore/inspector/WebInjectedScriptManager.h
M Source/WebCore/inspector/WorkerInspectorController.cpp
Log Message:
-----------
CommandLineAPIHost should use WeakPtr for InstrumentingAgents.
https://bugs.webkit.org/show_bug.cgi?id=302829
rdar://165462131
Reviewed by BJ Burg.
CommandLineAPIHost is a garbage-collected object. Using RefPtr to hold
InstrumentingAgents
could incorrectly extend its lifetime, as the timing of CommandLineAPIHost's
destruction is
controlled by the garbage collector.
Changed m_instrumentingAgents from RefPtr to WeakPtr. In normal cases,
disconnect() is called
before destruction and sets m_instrumentingAgents to nullptr, so this issue
shouldn't occur.
The RELEASE_ASSERT in the destructor verifies this invariant.
To ensure the invariant always holds, WebInjectedScriptManager now calls
disconnect() in its
destructor if it is still connected. This prevents the RELEASE_ASSERT from
firing in edge cases
where inspector controllers are destroyed without their cleanup methods being
called. The
isConnected() helper method provides a clear state check without relying on
implementation
details of the parent class or on disconnect() being idempotent across future
changes.
* Source/WebCore/inspector/CommandLineAPIHost.cpp:
(WebCore::CommandLineAPIHost::~CommandLineAPIHost):
* Source/WebCore/inspector/CommandLineAPIHost.h:
(WebCore::CommandLineAPIHost::init):
* Source/WebCore/inspector/FrameInspectorController.cpp:
(WebCore::FrameInspectorController::createLazyAgents):
(WebCore::FrameInspectorController::disconnectFrontend):
* Source/WebCore/inspector/PageInspectorController.cpp:
(WebCore::PageInspectorController::createLazyAgents):
(WebCore::PageInspectorController::disconnectFrontend):
* Source/WebCore/inspector/WebInjectedScriptManager.cpp:
(WebCore::WebInjectedScriptManager::~WebInjectedScriptManager):
* Source/WebCore/inspector/WebInjectedScriptManager.h:
* Source/WebCore/inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::createLazyAgents):
Canonical link: https://commits.webkit.org/304055@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications