Bug 230286

Summary: Web Inspector: Don't maintain a back-forward stack for `ContentBrowser`/`ContentViewContainer` when not necessary
Product: WebKit Reporter: Patrick Angle <pangle>
Component: Web InspectorAssignee: Patrick Angle <pangle>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch v1.0
none
Patch v1.1
none
Patch v1.1.1 - Add reviewer to change log none

Description Patrick Angle 2021-09-14 18:16:10 PDT
Many content views explicitly request hidden back/forward navigation buttons, but many of them also do not need to maintain a full stack of back/forward history for navigation. This makes it more difficult for us to ensure that stale views are discarded in a timely manner, particularly on page reload.
Comment 1 Radar WebKit Bug Importer 2021-09-14 18:16:23 PDT
<rdar://problem/83125792>
Comment 2 Patrick Angle 2021-09-14 18:38:22 PDT
Created attachment 438202 [details]
Patch v1.0
Comment 3 Devin Rousso 2021-09-15 11:20:32 PDT
Comment on attachment 438202 [details]
Patch v1.0

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

r=me, awesome stuff =D

> Source/WebInspectorUI/UserInterface/Views/AuditTabContentView.js:32
> +            disableBackForwardButtons: true,

NIT: `disableBackForwardButtons` makes me think that it's gonna leave the buttons where they are but just `.enabled = false`.  Perhaps `hideBackFowardButtons` instead?

> Source/WebInspectorUI/UserInterface/Views/AuditTabContentView.js:33
> +            disableBackForwardNavigation: true,

Does this tab also need to remember selection like the Graphics Tab, or am I misremembering/mistaken?

> Source/WebInspectorUI/UserInterface/Views/NetworkDetailView.js:88
> +        this._contentBrowser = new WI.ContentBrowser(element, this, {disableBackForwardButtons: true, disableBackForwardNavigation: true, contentViewNavigationItemsFlexItem, contentViewNavigationItemsGroup});

I feel like this may want to keep a back-forward list for the various alternate representations of the resource's content (e.g. "Response" vs "Response (JSON)").  Can you confirm?
Comment 4 Patrick Angle 2021-09-16 12:12:46 PDT
Comment on attachment 438202 [details]
Patch v1.0

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

>> Source/WebInspectorUI/UserInterface/Views/AuditTabContentView.js:33
>> +            disableBackForwardNavigation: true,
> 
> Does this tab also need to remember selection like the Graphics Tab, or am I misremembering/mistaken?

I've confirmed you are correct - this was hidden before by Bug 230322 which hid either the only, or most noticeable, use for the stack in the Audit tab.

>> Source/WebInspectorUI/UserInterface/Views/NetworkDetailView.js:88
>> +        this._contentBrowser = new WI.ContentBrowser(element, this, {disableBackForwardButtons: true, disableBackForwardNavigation: true, contentViewNavigationItemsFlexItem, contentViewNavigationItemsGroup});
> 
> I feel like this may want to keep a back-forward list for the various alternate representations of the resource's content (e.g. "Response" vs "Response (JSON)").  Can you confirm?

This state isn't remembered in ToT/STP... I'll open a bug for that.
Comment 5 Patrick Angle 2021-09-16 12:19:21 PDT
Comment on attachment 438202 [details]
Patch v1.0

This patch appears to have unintentionally moved the "Response" format dropdown menu in network details from being right justified to being left justified because of a name mismatch for that variable in this patch. contentViewNavigationItemsGroup is also affected.
Comment 6 Patrick Angle 2021-09-16 12:32:46 PDT
Created attachment 438386 [details]
Patch v1.1
Comment 7 Patrick Angle 2021-09-16 12:33:53 PDT
Created attachment 438387 [details]
Patch v1.1.1 - Add reviewer to change log
Comment 8 EWS 2021-09-16 15:35:33 PDT
Committed r282610 (241770@main): <https://commits.webkit.org/241770@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 438387 [details].