Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4b6613ca069a322a8f61834f979707b8b0683467
      
https://github.com/WebKit/WebKit/commit/4b6613ca069a322a8f61834f979707b8b0683467
  Author: Qianlang Chen <[email protected]>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    M Source/WebCore/inspector/InstrumentingAgents.h
    M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
    M Source/WebCore/inspector/agents/frame/FrameCSSAgent.cpp

  Log Message:
  -----------
  [Site Isolation] Web Inspector: CSS style sheets can still be double-reported 
with frame targets enabled
https://bugs.webkit.org/show_bug.cgi?id=323390

Reviewed by BJ Burg.

The patch to Bug 320937 tried to fix this by having FrameCSSAgent stay
silent when a page-level InspectorCSSAgent is enabled for the same
process. That check is susceptible to a race: targets are announced to
the frontend not in a consistent order, so a frame's CSS.enable can be
processed before the page's, and the gate finds nothing enabled yet.

This checks agent existence instead of enabled state. A page's
InspectorCSSAgent registers itself in didCreateFrontendAndBackend,
which runs as part of the same target-connect step that constructs
the agent -- before either agent's CSS.enable can be processed, since
enable is a separate round trip through the frontend in reaction to
Target.targetCreated. Existence is therefore settled before either
enable() runs, regardless of announce order.

The race was caught by running the whole inspector/ directory, not
inspector/css/ alone: whether a frame's CSS.enable lands before or
after the page's depends on where their target identifiers (the
frame's also folds in a process identifier) fall in a hash map, which
shifts with how many targets already existed earlier in the run.

The four failing tests in inspector CSS domain when run while frame
targets are always vended (in Bug 321734) should now consistently
progress.

* Source/WebCore/inspector/InstrumentingAgents.h:
* Source/WebCore/inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::didCreateFrontendAndBackend):
(WebCore::InspectorCSSAgent::willDestroyFrontendAndBackend):
* Source/WebCore/inspector/agents/frame/FrameCSSAgent.cpp:
(WebCore::FrameCSSAgent::documentIsReportedByPageCSSAgent const):

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



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

Reply via email to