Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 462503322444ad95b557bdee4b9d99c6718976a3
      
https://github.com/WebKit/WebKit/commit/462503322444ad95b557bdee4b9d99c6718976a3
  Author: BJ Burg <[email protected]>
  Date:   2025-09-15 (Mon, 15 Sep 2025)

  Changed paths:
    M 
LayoutTests/security/contentSecurityPolicy/plugins-types-allows-youtube-plugin-replacement.html
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Modules/applepay/ApplePaySession.cpp
    M Source/WebCore/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/UncheckedLocalVarsCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/js/ScriptCachedFrameData.cpp
    M Source/WebCore/bindings/js/ScriptController.cpp
    M Source/WebCore/bindings/js/WindowProxy.cpp
    M Source/WebCore/css/StyleSheetContents.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/ScriptableDocumentParser.h
    M Source/WebCore/inspector/InspectorInstrumentation.h
    M Source/WebCore/inspector/agents/page/PageAuditAgent.cpp
    M Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp
    M Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp
    M Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
    M Source/WebCore/loader/ResourceLoader.cpp
    M Source/WebCore/page/DOMWindow.cpp
    M Source/WebCore/page/DOMWindow.h
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    A Source/WebCore/page/FrameConsoleClient.cpp
    A Source/WebCore/page/FrameConsoleClient.h
    M Source/WebCore/page/IntersectionObserver.cpp
    M Source/WebCore/page/LocalDOMWindow.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    R Source/WebCore/page/PageConsoleClient.cpp
    R Source/WebCore/page/PageConsoleClient.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/workers/WorkerGlobalScope.cpp
    M Source/WebCore/worklets/WorkletGlobalScope.cpp
    M Source/WebCore/xml/XSLStyleSheetLibxslt.cpp
    M Source/WebCore/xml/XSLTProcessorLibxslt.cpp
    M Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
    M Source/WebKitLegacy/mac/Misc/WebCoreStatistics.mm

  Log Message:
  -----------
  Web Inspector: move PageConsoleClient to FrameConsoleClient in preparation 
for Site Isolation
https://bugs.webkit.org/show_bug.cgi?id=298543
rdar://160131751

Reviewed by Devin Rousso.

The current implementation of console logging in Web Inspector is broken under 
site isolation because
the inspector frontend is not made aware of cross-site iframes that were 
created in a
new web content process. Without a frontend connected, `InstrumentingAgents` in 
the new process
will not handle most instrumentation calls to the various Agents unless the 
agent is enabled.

Console domain events (such as `Console.messageAdded`) are not received because 
the `Console.enable`
command is never processed by the ConsoleAgent in this new web content process, 
which normally is sent
right after a frontend connects. Even without enablement, ConsoleAgent will 
buffer up to
`maximumConsoleMessages` (currently 100) without a frontend connection and then 
drop them on the floor.

Web Inspector needs to be able to connect to multiple web content processes in 
order to inspect
cross-origin iframes. In the case of ConsoleAgent, we want every frame to be 
able to log to console
regardless of which web process it is ultimately hosted in. That means there 
needs to be a ConsoleAgent
instance for each frame. Upon connecting to the new web content process, the 
frontend will drain
any buffered console messages.

To make this per-frame tracking possible, we are separately adding a new 
'Frame' target type to the Target
domain, to notify the frontend about Frame target lifecycle events. Using a 
separate Frame target means
that we can classify existing web instrumenting agents as 'Frame' or 'Page' 
based on how many instances we
expect to exist when Site Isolation is enabled. Agents with multiple instances 
should stay in WebProcess
and move from being Page-based to being LocalFrame-based. Agents with a single 
instance are those that
provide data collated from multiple iframes, such as Page, Network, and 
Storage. These agents will need to
move to UIProcess.

As a first step towards frame-based agents, move away from page-based console 
logging and instead
log messages through the relevant document's frame. These changes are needed to 
accomplish this:

- store a WeakRef to a Frame rather than a Page.
- store FrameConsoleClient on both LocalFrame and RemoteFrame.
- bail out if the Frame WeakRef went away or if the associated frame is remote.
- move consoleMessageListener (a test-only fixture) to Page so it is accessible 
from local subframes.

No new tests, no changes to functionality expected. This paves the way for 
refactoring ConsoleAgent to
be frame-based.

* 
LayoutTests/security/contentSecurityPolicy/plugins-types-allows-youtube-plugin-replacement.html:
Revert to not depending on a specific console message in order for the test to 
finish. This test
creates a subframe as part of plugin replacement, which caused us to create 
more than one FrameConsoleClient.
In the future we should consider removing consoleMessageListener entirely and 
using something more flexible.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Modules/applepay/ApplePaySession.cpp:
* Source/WebCore/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncheckedLocalVarsCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::restore):
* Source/WebCore/bindings/js/ScriptController.cpp:
(WebCore::ScriptController::initScriptForWindowProxy):
* Source/WebCore/bindings/js/WindowProxy.cpp:
(WebCore::WindowProxy::setDOMWindow):
* Source/WebCore/css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::addConsoleMessage):
(WebCore::Document::addMessage):
* Source/WebCore/dom/ScriptableDocumentParser.h:
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::addMessageToConsole):
(WebCore::InspectorInstrumentation::consoleCount):
(WebCore::InspectorInstrumentation::consoleCountReset):
(WebCore::InspectorInstrumentation::takeHeapSnapshot):
(WebCore::InspectorInstrumentation::startConsoleTiming):
(WebCore::InspectorInstrumentation::logConsoleTiming):
(WebCore::InspectorInstrumentation::stopConsoleTiming):
(WebCore::InspectorInstrumentation::consoleTimeStamp):
(WebCore::InspectorInstrumentation::startProfiling):
(WebCore::InspectorInstrumentation::stopProfiling):
* Source/WebCore/inspector/agents/page/PageAuditAgent.cpp:
(WebCore::PageAuditAgent::muteConsole):
(WebCore::PageAuditAgent::unmuteConsole):
* Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::muteConsole):
(WebCore::PageDebuggerAgent::unmuteConsole):
(WebCore::PageDebuggerAgent::breakpointActionLog):
* Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp:
(WebCore::PageNetworkAgent::addConsoleMessage):
* Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::muteConsole):
(WebCore::PageRuntimeAgent::unmuteConsole):
* Source/WebCore/loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveResponse):
* Source/WebCore/page/DOMWindow.cpp:
(WebCore::DOMWindow::console const):
(WebCore::DOMWindow::checkedConsole const):
(WebCore::DOMWindow::printErrorMessage const):
(WebCore::DOMWindow::isInsecureScriptAccess):
* Source/WebCore/page/DOMWindow.h:
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame):
* Source/WebCore/page/Frame.h:
(WebCore::Frame::console):
(WebCore::Frame::console const):
* Source/WebCore/page/FrameConsoleClient.cpp: Renamed from 
Source/WebCore/page/PageConsoleClient.cpp.
(WebCore::FrameConsoleClient::FrameConsoleClient):
(WebCore::FrameConsoleClient::shouldPrintExceptions):
(WebCore::FrameConsoleClient::setShouldPrintExceptions):
(WebCore::FrameConsoleClient::mute):
(WebCore::FrameConsoleClient::unmute):
(WebCore::FrameConsoleClient::logMessageToSystemConsole):
(WebCore::FrameConsoleClient::addMessage):
(WebCore::FrameConsoleClient::messageWithTypeAndLevel):
(WebCore::FrameConsoleClient::count):
(WebCore::FrameConsoleClient::countReset):
(WebCore::FrameConsoleClient::profile):
(WebCore::FrameConsoleClient::profileEnd):
(WebCore::FrameConsoleClient::takeHeapSnapshot):
(WebCore::FrameConsoleClient::time):
(WebCore::FrameConsoleClient::timeLog):
(WebCore::FrameConsoleClient::timeEnd):
(WebCore::FrameConsoleClient::timeStamp):
(WebCore::FrameConsoleClient::record):
(WebCore::FrameConsoleClient::recordEnd):
(WebCore::FrameConsoleClient::screenshot):
* Source/WebCore/page/FrameConsoleClient.h: Renamed from 
Source/WebCore/page/PageConsoleClient.h.
* Source/WebCore/page/IntersectionObserver.cpp:
Add missing header caused by changes to UnifiedSources segmentation.
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::processPostMessage):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setConsoleMessageListenerForTesting):
(WebCore::Page::consoleMessageListenerForTesting const):
(WebCore::Page::injectUserStyleSheet):
* Source/WebCore/page/Page.h:
(WebCore::Page::console): Deleted.
(WebCore::Page::console const): Deleted.
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setConsoleMessageListener):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::addConsoleMessage):
* Source/WebCore/worklets/WorkletGlobalScope.cpp:
(WebCore::WorkletGlobalScope::logExceptionToConsole):
(WebCore::WorkletGlobalScope::addConsoleMessage):
* Source/WebCore/xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::parseString):
* Source/WebCore/xml/XSLTProcessorLibxslt.cpp:
(WebCore::XSLTProcessor::parseErrorFunc):
(WebCore::docLoaderFunc):
* Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::openFunc):
* Source/WebKitLegacy/mac/Misc/WebCoreStatistics.mm:
(+[WebCoreStatistics shouldPrintExceptions]):
(+[WebCoreStatistics setShouldPrintExceptions:]):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to