Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1a9813d49b1b047214403cd0b6a26ce46eabb270
      
https://github.com/WebKit/WebKit/commit/1a9813d49b1b047214403cd0b6a26ce46eabb270
  Author: Basuke Suzuki <[email protected]>
  Date:   2025-10-21 (Tue, 21 Oct 2025)

  Changed paths:
    M Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js
    M 
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
    M Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
    M Source/WebInspectorUI/UserInterface/Views/LogContentView.js

  Log Message:
  -----------
  Wrong console message's repeat count is updated when messages are mixed from 
page and Web Workers.
https://bugs.webkit.org/show_bug.cgi?id=300728
rdar://162612099

Reviewed by Devin Rousso.

Console messages are compared in each target in Web Content process. If the 
message is
same with previous message, it sends `messageRepeatCountUpdated` message to the 
frontend.
In frontend, it updates simply previously displayed messageView's repeat count.

If a Worker sends a message, the things get messy. Because comparison happens 
in each
target, they don't know each other. Only checks if the message is same with the 
one from
the target. But that message can be not the one in the frontend.

1. main frame send a message A.
2. Worker send a message B.
3. Now console UI have line A and B.
4. In main frame, send identical message A.
5. Before sending the message, ConsoleAgent compares the one with previously 
sent message at step 1.
6. Because they are identical, it send `messageRepeatCountUpdated` with count 2.
7. Frontend get `messageRepeatCountUpdated` and it tries to update previous 
message view, but that is view for B.
8. B has updated with [2] count label.

To fix this, keep storing the messageView for each target. When 
`updatePreviousMessageRepeatCount`
is called, it checks _previousMessageView has same target and if not, it 
creates the new
messageView with previous message to avoid updating the wrong message count.

* Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js:
(WI.ConsoleManager.prototype.messageRepeatCountUpdated):
* 
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:
(WI.JavaScriptLogViewController):
(WI.JavaScriptLogViewController.prototype.startNewSession):
(WI.JavaScriptLogViewController.prototype.appendConsoleMessage):
(WI.JavaScriptLogViewController.prototype.updatePreviousMessageRepeatCount):
(WI.JavaScriptLogViewController.prototype._appendConsoleMessageView):
(WI.JavaScriptLogViewController.prototype._didRenderConsoleMessageView):
* Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js:
(WI.ConsoleObserver.prototype.messageRepeatCountUpdated):
* Source/WebInspectorUI/UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype._previousMessageRepeatCountUpdated):

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



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

Reply via email to