RESOLVED FIXED 155629
Web Inspector: Adding a new console message shouldn't modify DOM when the console log is hidden
https://bugs.webkit.org/show_bug.cgi?id=155629
Summary Web Inspector: Adding a new console message shouldn't modify DOM when the con...
Nikita Vasilyev
Reported 2016-03-18 00:34:20 PDT
Steps: 1. Open about:blank 2. Open Web Inspector console 3. Enter the following code: setInterval(function() {console.log(Math.random())}, 1) 4. Open Elements tab Expected: No repaints in the console prompt area. Web Inspector UI remains responsive. Actual: Console prompt gets repainted every millisecond. Web Inspector UI quickly becomes unresponsive.
Attachments
WIP (7.23 KB, patch)
2016-03-18 00:40 PDT, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
[Animated GIF] With the patch applied (203.41 KB, image/gif)
2016-03-18 00:45 PDT, Nikita Vasilyev
no flags
WIP (8.16 KB, patch)
2016-03-21 22:51 PDT, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
WIP (13.59 KB, patch)
2016-04-22 16:13 PDT, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
Patch (12.79 KB, patch)
2016-04-29 12:58 PDT, Nikita Vasilyev
timothy: review-
Patch (13.31 KB, patch)
2016-04-30 13:42 PDT, Nikita Vasilyev
timothy: review+
timothy: commit-queue-
Patch (13.16 KB, patch)
2016-05-02 11:26 PDT, Nikita Vasilyev
nvasilyev: commit-queue-
Patch (13.26 KB, patch)
2016-05-02 12:59 PDT, Nikita Vasilyev
no flags
Patch (14.03 KB, patch)
2016-05-03 14:11 PDT, Nikita Vasilyev
timothy: review+
Patch (14.06 KB, patch)
2016-05-03 14:25 PDT, Nikita Vasilyev
no flags
Radar WebKit Bug Importer
Comment 1 2016-03-18 00:34:44 PDT
Nikita Vasilyev
Comment 2 2016-03-18 00:40:46 PDT
Created attachment 274389 [details] WIP Known issues: 1. Clicking on the dashboard error/warning/log icons for the first time doesn't filter out console messages. 2. The unread messages dot in the console scope bar selector is broken.
Nikita Vasilyev
Comment 3 2016-03-18 00:45:20 PDT
Created attachment 274390 [details] [Animated GIF] With the patch applied No repaints around console prompt area.
Nikita Vasilyev
Comment 4 2016-03-21 22:51:46 PDT
Created attachment 274642 [details] WIP > Known issues: > 1. Clicking on the dashboard error/warning/log icons for > the first time doesn't filter out console messages. > 2. The unread messages dot in the console scope bar selector is broken. These are fixed. Known issue: - Repeat counter sometimes doesn't update.
Nikita Vasilyev
Comment 5 2016-04-22 16:13:07 PDT
Created attachment 277111 [details] WIP This WIP doesn't have any known bugs. It also fixes bug 156484.
Joseph Pecoraro
Comment 6 2016-04-22 16:34:46 PDT
Comment on attachment 277111 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=277111&action=review > Source/WebInspectorUI/UserInterface/Models/ConsoleCommand.js:26 > +WebInspector.ConsoleCommand = class ConsoleMessage extends WebInspector.Object Nit: class name here is wrong.
Nikita Vasilyev
Comment 7 2016-04-26 13:30:02 PDT
(In reply to comment #5) > Created attachment 277111 [details] > WIP > > This WIP doesn't have any known bugs. > It also fixes bug 156484. Known issues: Repeat counts don't update if the console message hasn't been rendered. Steps: 1. Open Elements tab, hide split console. 2. Click on <button onclick="console.log(1)">click</button> twice. 3. Open console tab. Also, WebInspector.JavaScriptLogViewController#appendImmediateExecutionWithResult still modifies DOM right away. I'm working on it.
Nikita Vasilyev
Comment 8 2016-04-29 12:58:00 PDT
Timothy Hatcher
Comment 9 2016-04-30 10:48:48 PDT
Comment on attachment 277728 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277728&action=review Looks good, with one comment. > Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:269 > + if (WebInspector.consoleContentView.visible) > + requestAnimationFrame(() => this.renderPendingMessages()); You should only need to do this one. As-is it will request multiple animation frames if there are multiple messages appended. You should keep the animation frame identifier around and not request again if we already have a pending request.
Nikita Vasilyev
Comment 10 2016-04-30 13:42:14 PDT
Timothy Hatcher
Comment 11 2016-04-30 16:59:19 PDT
Comment on attachment 277831 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277831&action=review > Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:273 > + renderPendingMessages() You should cancel and clear _scheduledRenderIdentifier here, otherwise the call in shown() will still let the rAF fire once. > Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:300 > + let renderOnRequestAnimationFrame = function() { > + this._scheduledRenderIdentifier = 0; > + this.renderPendingMessages(); > + }.bind(this); If you clear in renderPendingMessages() you would not need to do this here.
Timothy Hatcher
Comment 12 2016-05-02 09:10:28 PDT
*** Bug 152221 has been marked as a duplicate of this bug. ***
Nikita Vasilyev
Comment 13 2016-05-02 11:26:07 PDT
Nikita Vasilyev
Comment 14 2016-05-02 11:48:38 PDT
*** Bug 157186 has been marked as a duplicate of this bug. ***
Nikita Vasilyev
Comment 15 2016-05-02 12:08:45 PDT
Comment on attachment 277914 [details] Patch [Error] TypeError: undefined is not an object (evaluating 'lastMessageView.message.type') renderPendingMessages (JavaScriptLogViewController.js:286)
Nikita Vasilyev
Comment 16 2016-05-02 12:59:27 PDT
WebKit Commit Bot
Comment 17 2016-05-02 14:00:33 PDT
Comment on attachment 277926 [details] Patch Clearing flags on attachment: 277926 Committed r200337: <http://trac.webkit.org/changeset/200337>
WebKit Commit Bot
Comment 18 2016-05-02 14:00:38 PDT
All reviewed patches have been landed. Closing bug.
Joseph Pecoraro
Comment 19 2016-05-02 17:15:55 PDT
Comment on attachment 277926 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277926&action=review > Source/WebInspectorUI/UserInterface/Views/LogContentView.js:127 > + this._logViewController.renderPendingMessages(); This should probably call super.shown().
WebKit Commit Bot
Comment 20 2016-05-02 19:54:52 PDT
Re-opened since this is blocked by bug 157294
Nikita Vasilyev
Comment 21 2016-05-03 12:36:49 PDT
(In reply to comment #20) > Re-opened since this is blocked by bug 157294 Steps: 1. Open Elements tab, keep the split console *closed* 2. Type 1+1 in the console prompt 3. Press Enter Web Inspector freezes https://github.com/WebKit/webkit/blob/eeda037140553acaab606ed51ed69af023582116/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js#L273 renderPendingMessages calls _didRenderConsoleMessageView, which opens the split console, which triggers WebInspector.LogContentView#shown, which calls renderPendingMessages again.
Nikita Vasilyev
Comment 22 2016-05-03 14:11:44 PDT
Timothy Hatcher
Comment 23 2016-05-03 14:20:36 PDT
Comment on attachment 278023 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=278023&action=review > Source/WebInspectorUI/UserInterface/Views/LogContentView.js:128 > + shown() > + { > + this._logViewController.renderPendingMessages(); > + } This should call super.shown() to be future proof.
Nikita Vasilyev
Comment 24 2016-05-03 14:22:40 PDT
(In reply to comment #23) > Comment on attachment 278023 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=278023&action=review > > > Source/WebInspectorUI/UserInterface/Views/LogContentView.js:128 > > + shown() > > + { > > + this._logViewController.renderPendingMessages(); > > + } > > This should call super.shown() to be future proof. Yes! I saw Joe's comment but forgot about it.
Nikita Vasilyev
Comment 25 2016-05-03 14:25:53 PDT
Created attachment 278024 [details] Patch Added super.shown().
WebKit Commit Bot
Comment 26 2016-05-03 18:18:41 PDT
Comment on attachment 278024 [details] Patch Clearing flags on attachment: 278024 Committed r200401: <http://trac.webkit.org/changeset/200401>
WebKit Commit Bot
Comment 27 2016-05-03 18:18:46 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.