How to access the context menu directly

Hi,

My goal is to reorder the context menu.

Unfortunately that’s not actually possible with userChrome.css despite the claims it is. Basically userChrome will often move everything you specify ordering on to the bottom of the menu. It’s due to menu items not being given a default -moz-box-ordinal-group value (i.e. 100) so trying to reorder creates 2 groups the ordered and the unordered. The ordered is typically rendered after the unordered instead of before it causing major problems.

So i’m looking to write an addon to do it.

Unfortunately I can’t find any documentation to access browser objects at a suitable level.

So what api’s or objects can we access in an addon to interact with the browsers “physical” layer?

There is no such direct API. You can write a WebExtension API experiment, which will only run in Nightly and Dev Edition if you really want to mess with it.

Thanks for the response.

Actually I discovered how to set up userChrome.js and while looking at that realised I could actually do in userChrome.css what I lamented the default css not having…

A default value for -moz-box-ordinal-group

Adding the following solved my issue:

#contentAreaContextMenu menuitem {
    -moz-box-ordinal-group: 100;
}
#contentAreaContextMenu menuseparator {
    -moz-box-ordinal-group: 100;
}
#contentAreaContextMenu menu {
    -moz-box-ordinal-group: 100;
}

As for my actual question it’s disappointing that there are no api’s for interacting with the application.
I’ve been using firefox since it was first released and the only addons I’ve ever installed are to fix problems in the UI and most of those problems come from people changing things that never needed changing.