Skip to content

Conversation

@blakegearin
Copy link
Contributor

Summary

  • Updated ZenSiteDataPanel.sys.mjs to support multiple panels and pass relevant objects to browser-addons.js

  • Patched browser-addons.js to accept panel objects

  • Patched navigator-toolbox.js to get panel objects from window.gZenSiteDataPanel

  • Updated zen-single-components.css to conditionally hide extensions on unified panel

Screenshots

  • hide-unified-extensions-button: true

    image
  • hide-unified-extensions-button: false

    image image

Notes

  • Toggling hide-unified-extensions-button does require a browser restart to fully take effect and swich over. This is because the list of extensions are added on browser initialization. It does not appear browser/components/customizableui/CustomizableUI.sys.mjs is able to natively support adding and removing extensions from multiple areas

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Feature labels Nov 18, 2025
Copy link
Member

@mr-cheffy mr-cheffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of choosing what panel should be used every time, we could just revert these changes if the preference is off:

if (!this._panel) {
- let template = document.getElementById(
- "unified-extensions-panel-template"
- );
- template.replaceWith(template.content);
- this._panel = document.getElementById("unified-extensions-panel");
+ this._panel = document.getElementById("zen-unified-site-data-panel");
let customizationArea = this._panel.querySelector(
"#unified-extensions-area"

- const anchorID = "unified-extensions-button";

Or at least simply override it? gUnifiedExtensions._panel = ...

@blakegearin
Copy link
Contributor Author

blakegearin commented Nov 19, 2025

Instead of choosing what panel should be used every time, we could just revert these changes if the preference is off:
...
Or at least simply override it? gUnifiedExtensions._panel = ...

Yes, that's true. Effectively that's what setMainPanel was for, but that approach is cleaner. And we can safely remove the patches on get panel() which is a nice side effect

notInPanel ||
document.querySelector("#unified-extensions-area > :first-child")
- ?.id === widgetId
+ ?.id === widgetIdz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's widgetIdz defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, just an extra character that slipped in. Good catch.

Commit: 31f4d4e

- let template = document.getElementById(
- "unified-extensions-panel-template"
- );
- template.replaceWith(template.content);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing, you should just see if the preference is enabled and then do what the patch is originally doing or firefox's addon functionality.

https://github.com/zen-browser/desktop/pull/11335/files#r2545668861

Copy link
Member

@mr-cheffy mr-cheffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a test try later today, looks good overall

// Partial implementation of "get panel()" from engine/browser/base/content/browser-addons.js
const { BrowserAddonUI, CustomizableUI } = this.window;

CustomizableUI.registerPanelNode(customizationArea, CustomizableUI.AREA_ADDONS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure about this, as doing re-implementations might be hard to sync when updating upstream. Maybe some unit tests would help this issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do unit tests live? I could give it a shot

Copy link
Member

@mr-cheffy mr-cheffy Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can give it a try here: https://github.com/zen-browser/desktop/tree/dev/src/zen/tests

Making a new directory like "control-panel" for example

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants