Closed Bug 1891777 Opened 8 months ago Closed 6 months ago

Persist sidebar settings from Customize Sidebar menu

Categories

(Firefox :: Sidebar, task)

task

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: sclements, Assigned: nsharpley)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-sidebar])

Attachments

(1 file, 1 obsolete file)

In bug 1891775, we'll be adding a menu to customize sidebar settings and we'll need to persist these settings across windows and sessions (same as we do now for position and whether the sidebar is opened or closed).

With Nikki's work in bug 1885894, we're moving off persistence of XULstore in browser-sidebar, and the way the sidebar attributes persistence works is that window attributes are added as properties to the "sidebar-box" element, and when windows are closed, those are saved in sessionstore._updateWindowsAndFeatures. And then, in a new session once the initial window loads, we retrieve properties attached to "sidebar-box" from that window per here. And in various places in browser-sidebar, this._box.setAttribute(... is called in response to the sidebar being toggled and the position of sidebar changing.

However we'll be adding more settings to this with each part of the customization menu starting with the toolsAndExtensions in the sidebar. This bug should persist those particular settings (continuing work done in bug 1891775) and create a generic API that can be called in the SidebarController to handle any customization setting we need to update. We should also consolidate all of the sidebar properties into a single sidebarProperties object/attribute rather than saving each setting as individual attributes, so it will eventually look something like this:

sidebarProperties = {
   sidebarCommand, 
   positionend,
   style,
   toolsAndExtensions,
   visibility,
   hideHorizontalTabs
}
Depends on: 1892033
Assignee: nobody → nsharpley
Attachment #9401506 - Attachment description: WIP: Bug 1891777 - Persist order of sidebar tools and extensions → Bug 1891777 - Persist order of sidebar tools and extensions
Attachment #9401506 - Attachment description: Bug 1891777 - Persist order of sidebar tools and extensions → Bug 1891777 - Persist order of sidebar tools and extensions r=#sidebar-reviewers
Attachment #9401506 - Attachment description: Bug 1891777 - Persist order of sidebar tools and extensions r=#sidebar-reviewers → Bug 1891777 - Persist sidebar tools and extensions r=#sidebar-reviewers

Rather than persisting via SessionStore, as the original bug suggests, use a prefs
to globally store the disabled/enabled state of the sidebar tools.

Not entirely unrelated, I added a test for adopting the sidebar from an opener window as well.

Attachment #9401506 - Attachment is obsolete: true
Pushed by nsharpley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8c48512a48de Add a tools pref to the sidebar revamp r=sidebar-reviewers,kcochrane

Backed out for causing mochitest failures on browser_sidebar_prefs.js

[task 2024-06-12T14:22:09.697Z] 14:22:09     INFO - TEST-PASS | browser/components/sidebar/tests/browser/browser_sidebar_prefs.js | The button for the viewBookmarksSidebar entrypoint has been added. - 
[task 2024-06-12T14:22:09.697Z] 14:22:09     INFO - Buffered messages finished
[task 2024-06-12T14:22:09.698Z] 14:22:09     INFO - TEST-UNEXPECTED-FAIL | browser/components/sidebar/tests/browser/browser_sidebar_prefs.js | History and syncedtabs have been removed from the pref, and bookmarks added - Got ",bookmarks", expected "bookmarks"
[task 2024-06-12T14:22:09.698Z] 14:22:09     INFO - Stack trace:
[task 2024-06-12T14:22:09.698Z] 14:22:09     INFO - chrome://mochikit/content/browser-test.js:test_is:1620
[task 2024-06-12T14:22:09.699Z] 14:22:09     INFO - chrome://mochitests/content/browser/browser/components/sidebar/tests/browser/browser_sidebar_prefs.js:test_tools_prefs:66
[task 2024-06-12T14:22:09.699Z] 14:22:09     INFO - chrome://mochikit/content/browser-test.js:handleTask:1139
[task 2024-06-12T14:22:09.700Z] 14:22:09     INFO - chrome://mochikit/content/browser-test.js:_runTaskBasedTest:1211
[task 2024-06-12T14:22:09.700Z] 14:22:09     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1353
[task 2024-06-12T14:22:09.701Z] 14:22:09     INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1128
[task 2024-06-12T14:22:09.701Z] 14:22:09     INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/<:1058
[task 2024-06-12T14:22:09.967Z] 14:22:09     INFO - GECKO(21383) | 1718202129966	Marionette	TRACE	Received observer notification browser-delayed-startup-finished
[task 2024-06-12T14:22:10.119Z] 14:22:10     INFO - Console message: [JavaScript Warning: "Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content." {file: "chrome://browser/content/sidebar/sidebar-customize.html" line: 0}]
[task 2024-06-12T14:22:10.172Z] 14:22:10     INFO - TEST-PASS | browser/components/sidebar/tests/browser/browser_sidebar_prefs.js | 1 Firefox Tool button is shown in the sidebar matching 1 shown in the Customize Menu. - 
[task 2024-06-12T14:22:10.175Z] 14:22:10     INFO - TEST-PASS | browser/components/sidebar/tests/browser/browser_sidebar_prefs.js | The number of tool inputs checked matches that of the other window's sidebar - 
[task 2024-06-12T14:22:10.177Z] 14:22:10     INFO - TEST-PASS | browser/components/sidebar/tests/browser/browser_sidebar_prefs.js | The bookmarks input is checked, as suggested by the pref. - 
[task 2024-06-12T14:22:10.182Z] 14:22:10     INFO - Not taking screenshot here: see the one that was previously logged
[task 2024-06-12T14:22:10.184Z] 14:22:10     INFO - TEST-UNEXPECTED-FAIL | browser/components/sidebar/tests/browser/browser_sidebar_prefs.js | Only bookmarks should be present in the pref - Got ",bookmarks", expected "bookmarks"
[task 2024-06-12T14:22:10.185Z] 14:22:10     INFO - Stack trace:
[task 2024-06-12T14:22:10.185Z] 14:22:10     INFO - chrome://mochikit/content/browser-test.js:test_is:1620
[task 2024-06-12T14:22:10.185Z] 14:22:10     INFO - chrome://mochitests/content/browser/browser/components/sidebar/tests/browser/browser_sidebar_prefs.js:test_tools_prefs:114
[task 2024-06-12T14:22:10.186Z] 14:22:10     INFO - chrome://mochikit/content/browser-test.js:handleTask:1139
[task 2024-06-12T14:22:10.186Z] 14:22:10     INFO - chrome://mochikit/content/browser-test.js:_runTaskBasedTest:1211
[task 2024-06-12T14:22:10.186Z] 14:22:10     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1353
[task 2024-06-12T14:22:10.186Z] 14:22:10     INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1128
[task 2024-06-12T14:22:10.187Z] 14:22:10     INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/<:1058
[task 2024-06-12T14:22:10.254Z] 14:22:10     INFO - Leaving test bound test_tools_prefs
[task 2024-06-12T14:22:10.571Z] 14:22:10     INFO - GECKO(21383) | MEMORY STAT | vsize 11906MB | residentFast 516MB | heapAllocated 358MB
[task 2024-06-12T14:22:10.573Z] 14:22:10     INFO - TEST-OK | browser/components/sidebar/tests/browser/browser_sidebar_prefs.js | took 1697ms
[task 2024-06-12T14:22:10.588Z] 14:22:10     INFO - checking window state
[task 2024-06-12T14:22:10.599Z] 14:22:10     INFO - TEST-START | browser/components/sidebar/tests/browser/browser_toolbar_sidebar_button.js
Flags: needinfo?(nsharpley)
Pushed by nsharpley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7a3a2864b017 Add a tools pref to the sidebar revamp r=sidebar-reviewers,kcochrane
Regressions: 1902051
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
Flags: needinfo?(nsharpley)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: