Extension development - can I overlay a vbox?

Talk about code development, features, specific bugzilla bugs, enhancements, patches, and other highly technical things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific referenced Bugzilla bugs, mercurial, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Most "bug reports" do not belong in this board and should initially be posted in Community Support or other relevant support boards.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
Post Reply
User avatar
moonbat
Board Warrior
Board Warrior
Posts: 1076
Joined: 2015-12-09, 15:45
Location: Australia

Extension development - can I overlay a vbox?

Post by moonbat » 2019-09-07, 04:00

First attempt at extension development.
I want to extend the about:permissions window with an additional section for site specific user-agent overrides. I opened it up in DOM inspector, and found that there is a hbox entry for each type of permission, all inside a vbox named 'permissions-box'. I tried to overlay this by adding another hbox block like so:

Code: Select all

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin/"?>
<?xml-stylesheet type="text/css" href="chrome://PermissionsPlus/skin/browserOverlay.css"?>
<overlay id="permissionsplus-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <stringbundleset id="stringbundleset">
    <stringbundle id="permissionsplus-string-bundle" src="chrome://permissionsplus/locale/browserOverlay.properties" />
  </stringbundleset>
  <vbox id="permissions-box" flex="1">
    <hbox id="permissionplus-user-agent-override" align="center">
      <label id="permissionsbox.section.useragent.label" value="&permissionsbox.section.useragent.label"/>
      <textbox id="permissionsbox.section.useragent.value" value="Add user agent override here."/>
    </hbox>
  </vbox>
</overlay>
and I have the relevant entry in chrome.manifest as well -

Code: Select all

overlay	chrome://browser/content/browser.xul chrome://permissionsplus/content/browserOverlay.xul
but when I install it on a fresh profile and restart, there's nothing to be seen (not in DOM inspector either).
Is it possible to overlay at the vbox level, or am I missing something here?
The only example of an overlay I could find when searching was for the main menu, in the XUL School tutorial.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 19.3 Xfce x64 on HP i5 laptop with 4 GB RAM, always latest versions of PM & Basilisk unless specified.

User avatar
FranklinDM
Add-ons Team
Add-ons Team
Posts: 215
Joined: 2017-01-14, 02:40
Location: Manila, Philippines
Contact:

Re: Extension development - can I overlay a vbox?

Post by FranklinDM » 2019-09-07, 05:31

  • You're applying the overlay at the wrong location. Since we want to overlay at the Permissions Manager (about:permissions), it should be:

    Code: Select all

    overlay	about:permissions chrome://permissionsplus/content/browserOverlay.xul
  • The parent element of permissions-box is missing:

    Code: Select all

    <hbox flex="1" id="permissions-content" class="main-content">
          <vbox id="permissions-box" flex="1">
            <hbox id="permissionplus-user-agent-override" align="center" insertafter="plugins-pref-item">
              <label id="permissionsbox.section.useragent.label" value="&permissionsbox.section.useragent.label;"/>
              <textbox id="permissionsbox.section.useragent.value" value="Add user agent override here."/>
            </hbox>
          </vbox>
    </hbox>
    
  • Avoid & and ; unless the string is defined in your extension's locale file.

    Code: Select all

    XML Parsing Error: not well-formed
    Location: chrome://permissionsplus/content/overlay.xul
    Line Number 8, Column 108:
    <label id="permissionsbox.section.useragent.label" value="&permissionsbox.section.useragent.label"/>
    
You might want to add an icon to make it match the rest of the content:
Snap
Snap
{29B1A65B-4080-4416-AAB3-1E3EAC4D0E69}.png.jpg (7.58 KiB) Viewed 230 times

User avatar
moonbat
Board Warrior
Board Warrior
Posts: 1076
Joined: 2015-12-09, 15:45
Location: Australia

Re: Extension development - can I overlay a vbox?

Post by moonbat » 2019-09-07, 05:42

Thank you so much! :thumbup:
I should be able to get started with this now.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 19.3 Xfce x64 on HP i5 laptop with 4 GB RAM, always latest versions of PM & Basilisk unless specified.

Post Reply