Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a942e1e61628d1a24bc8d20f3dea469a9b523aa1
      
https://github.com/WebKit/WebKit/commit/a942e1e61628d1a24bc8d20f3dea469a9b523aa1
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-02 (Thu, 02 Jul 2026)

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

  Log Message:
  -----------
  [Web Inspector] adopted (constructable) stylesheets misclassified as User 
Agent in the per-frame CSS agent
https://bugs.webkit.org/show_bug.cgi?id=318423
rdar://181204768

Reviewed by Devin Rousso.

FrameCSSAgent::detectOrigin lacked the wasConstructedByJS() guard that
InspectorCSSAgent::detectOrigin already has. A constructable stylesheet
(`new CSSStyleSheet()` applied via `document.adoptedStyleSheets`) has no
owner node and an empty href, so it fell into the User Agent branch of the
ownerNode/href heuristic. In the Web Inspector those author styles then
appeared as uneditable User Agent styles.

Mirror the InspectorCSSAgent fix: check wasConstructedByJS() first and
report such stylesheets as Author, keeping the two near-duplicate
detectOrigin implementations in sync.

FrameCSSAgent is only the active CSS backend dispatcher under Site
Isolation (it is created by FrameInspectorController per LocalFrame and
reached via FrameInspectorTarget), which is not enabled yet. The existing
regression test 
LayoutTests/inspector/css/getMatchedStylesForNodeAdoptedStyleSheet.html
therefore exercises the page-level InspectorCSSAgent path, not this one,
so this fix is currently untestable via a protocol layout test. Once Site
Isolation is enabled that same test will cover the frame path.

* Source/WebCore/inspector/agents/frame/FrameCSSAgent.cpp:
(WebCore::FrameCSSAgent::detectOrigin):

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



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

Reply via email to