📜 ⬆️ ⬇️

How to quickly start and effectively continue to write the extension for the fox

Usually the development cycle is as follows:


1) make a change in the source code,
2) repacking sources in * .xpi ( scripts ),
3) switch to the fox,
4) Ctrl + O, select the resulting * .xpi,
5) Setup dialog appears, wait 4 seconds,
6) click “Install”,
7) then “Restart Firefox” and see what has changed.

Got scared? Then…

userChrome.js


Once:
- install the userChrome.js extension
- run the fox (only once)
- in the fox profile, fill the chrome/userChrome.js file with the original content, for example:

// -! :-)
if (location != "chrome://browser/content/browser.xul") throw "stop";

// .
// 'load' window,
// . .

//
getBrowser().mTabContainer.addEventListener(
'click',
function(event) { alert('clckkkkkkkkkkkkk!') },
false
)

')

And this is how the development cycle looks now.


1) make changes to the userChrome.js code,
2) in the fox we open a new window, see what has changed (all changes apply only to new windows).

The difference is obvious.

Of course, with the development of a normal * .xpi, the development will not be so easy, but the start is quick!


Utility


It would be nice to stock up on the Console 2 extension and configure it so that it pops up itself in case of errors.

There is another branch, userChromeJS - the import function has been added and something has been changed about the overlays.

This extension works for other Mozilla products.

Source: https://habr.com/ru/post/48498/


All Articles