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

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

  Log Message:
  -----------
  [Site Isolation] Web Inspector: CSS style sheets are double-reported with 
frame targets enabled
https://bugs.webkit.org/show_bug.cgi?id=320937
rdar://183968497

Reviewed by BJ Burg.

Console, Debugger, and Worker let their frame agent shadow the page one
through a shared InstrumentingAgents slot. CSS has a slot for each and
instrumentation dispatches to both, so with frame targets on every
inspection each style sheet is announced twice and the frontend tracks
two objects for it.

The page-level agent stays the source for the documents it already
covers, and the frame agent stays silent for those: per-node CSS
commands are routed by the DOM node's owning target, so local content
keeps coming from the page target until local DOM does too. Whether a
page-level CSS agent is live in this process is asked of it directly,
through the frame's fallback to the page's InstrumentingAgents. A
cross-origin frame's process has none, so those frames report as before.

Only the dispatch is suppressed; the agent's bookkeeping still runs, so
it can serve commands for style sheets it does not announce. The gate
sits in setActiveStyleSheetsForDocument, which every announcement funnels
through, including the initial batch from enable().

These tests now pass under Site Isolation:
- inspector/css/add-rule.html
- inspector/css/createStyleSheet.html
- inspector/css/getAllStyleSheets.html
- inspector/css/manager-preferredInspectorStyleSheetForFrame.html
- inspector/css/stylesheet-events-imports.html
- inspector/css/stylesheet-events-inspector-stylesheet.html
- inspector/css/stylesheet-events-multiple-documents.html

* Source/WebCore/inspector/agents/frame/FrameCSSAgent.cpp:
(WebCore::FrameCSSAgent::mediaQueryResultChanged):
(WebCore::FrameCSSAgent::documentIsReportedByPageCSSAgent const):
(WebCore::FrameCSSAgent::setActiveStyleSheetsForDocument):
* Source/WebCore/inspector/agents/frame/FrameCSSAgent.h:

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



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

Reply via email to