Bug 204532

Summary: Web Inspector: Console: the saved result value is still shown after page reload
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Devin Rousso 2019-11-22 12:58:47 PST
# STEPS TO REPRODUCE:
1. inspect any page
2. go to the Console Tab
3. enable Preserve Log
4. evaluate `{a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7}`
 => notice the " == $1" next to it
5. reload the page
 => the " == $1" stays visible
6. repeat step 4
 => two " == $1" are shown
Comment 1 Devin Rousso 2019-11-22 13:00:27 PST
Created attachment 384188 [details]
Patch
Comment 2 BJ Burg 2019-11-22 14:42:23 PST
Comment on attachment 384188 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=384188&action=review

> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:248
> +        for (let node of this._messageBodyElement.querySelectorAll(".console-saved-variable"))

This seems fragile. Can we re-render() the messages in ConsoleMessageView and not draw the saved result index element if the message is older than the epoch (uh, probably since last page reload)?
Comment 3 Devin Rousso 2019-11-22 15:01:42 PST
Comment on attachment 384188 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=384188&action=review

>> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:248
>> +        for (let node of this._messageBodyElement.querySelectorAll(".console-saved-variable"))
> 
> This seems fragile. Can we re-render() the messages in ConsoleMessageView and not draw the saved result index element if the message is older than the epoch (uh, probably since last page reload)?

Fragile in what way?  We don't ever save the `.console-saved-variable` element to a member variable, so it's basically "dropped" into the DOM with no expectations about it afterwards.

Re-rendering all of the messages would likely have pretty awful performance, especially if there are a lot of messages from previous sessions.
Comment 4 BJ Burg 2019-12-02 10:38:15 PST
Comment on attachment 384188 [details]
Patch

r=me

I don't think it's worth making this any more complicated at this point.
Comment 5 WebKit Commit Bot 2019-12-02 11:22:29 PST
Comment on attachment 384188 [details]
Patch

Clearing flags on attachment: 384188

Committed r253000: <https://trac.webkit.org/changeset/253000>
Comment 6 WebKit Commit Bot 2019-12-02 11:22:30 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-12-02 11:23:20 PST
<rdar://problem/57564556>