Bug 168105 - Web Inspector: ContentViewContainer can have redundant back-forward entries after ContentView close
Summary: Web Inspector: ContentViewContainer can have redundant back-forward entries a...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-09 22:11 PST by Matt Baker
Modified: 2017-02-10 16:46 PST (History)
2 users (show)

See Also:


Attachments
Patch (8.42 KB, patch)
2017-02-09 22:18 PST, Matt Baker
no flags Details | Formatted Diff | Diff
Patch for landing (8.47 KB, patch)
2017-02-10 16:07 PST, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2017-02-09 22:11:21 PST
Summary:
ContentViewContainer can have redundant back-forward entries content view close. The container guards against adding a BackForwardEntry with the same ContentView/cookie as the current entry, but doesn't check that consecutive entries are unique after replacing/splicing an entry in the list.

Note:
This doesn't seem to cause any bad behavior, but it can make ContentViewContainer debugging unnecessarily complicated and would be nice to fix.

Steps to Reproduce:
1. Open Inspector
2. Switch back and forth between two tabs (Debugger/Elements) multiple times.
3. Open Inspector²
4. Console prompt: `WebInspector.tabBrowser._contentViewContainer._backForwardList`
=> Outputs something like:
    BackForwardEntry {_listeners: null, _contentView: ElementsTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    BackForwardEntry {_listeners: null, _contentView: DebuggerTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    BackForwardEntry {_listeners: null, _contentView: ElementsTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    BackForwardEntry {_listeners: null, _contentView: DebuggerTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    BackForwardEntry {_listeners: null, _contentView: ElementsTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    BackForwardEntry {_listeners: null, _contentView: DebuggerTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    ...

5. Close Elements tab
6. Re-run script in Inspector²
=> Expected:
    BackForwardEntry {_listeners: null, _contentView: DebuggerTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
=> Actual:
    BackForwardEntry {_listeners: null, _contentView: DebuggerTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    BackForwardEntry {_listeners: null, _contentView: DebuggerTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    BackForwardEntry {_listeners: null, _contentView: DebuggerTabContentView, _tombstone: false, _cookie: {}, _scrollPositions: []}
    ...
Comment 1 Matt Baker 2017-02-09 22:18:43 PST
Created attachment 301132 [details]
Patch
Comment 2 Joseph Pecoraro 2017-02-10 15:30:28 PST
Comment on attachment 301132 [details]
Patch

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

r=me

> Source/WebInspectorUI/ChangeLog:3
> +        Web Inspector: ContentViewContainer can have redundant back-forward entries content view close

Please fix the grammar of the bug title. (I see you just did)

> Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js:470
> +    _removeDuplicateBackForwardEntires()

Typo: Entires => Entries

Note that this is only removing duplicate adjacent entries, right?
Comment 3 Matt Baker 2017-02-10 16:01:12 PST
Comment on attachment 301132 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js:470
>> +    _removeDuplicateBackForwardEntires()
> 
> Typo: Entires => Entries
> 
> Note that this is only removing duplicate adjacent entries, right?

Correct. Will rename to _removeAdjacentIdenticalBackForwardEntries() to better express the intent. The term "identical" is used in an existing comment around line 108.
Comment 4 Matt Baker 2017-02-10 16:07:49 PST
Created attachment 301209 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2017-02-10 16:46:17 PST
Comment on attachment 301209 [details]
Patch for landing

Clearing flags on attachment: 301209

Committed r212166: <http://trac.webkit.org/changeset/212166>
Comment 6 WebKit Commit Bot 2017-02-10 16:46:21 PST
All reviewed patches have been landed.  Closing bug.