-1

I just recently switched from using the outdated cfx to jpm for developing my Firefox add-ons. Every time I make a change to my code and want to test it again, I have to use the "jpm run" command it literally takes 3 to 5 minutes to launch the browser with the new code inside. This makes it pretty much impossible to develop my add-on because, every time I want to test a new line of code, I have to wait several minutes.

This kind of problem doesn't occur in Chrome so I'm not sure what the people at Mozilla are thinking. Do they want to make it nearly impossible to develop add-ons for their browser?

What are other Firefox add-on developers doing to test their code? Do they just spend hours launching and relaunching the browser very very slowly? Or is there a workaround?

user1850261
  • 105
  • 1
  • 7
  • Starting Firefox with `jpm run` and a minimal add-on takes less than 10 seconds for me (just tested). How big is your add-on? What version of `jpm --version` are you using? Which version of Firefox are you using? Lots more information is required (e.g. machine type, OS, etc., etc.). – Makyen Nov 07 '16 at 16:46
  • I got it down to under 30 seconds by deleting some of the files in my add-on folder (it was like 50MB). I had some copies of the XPI file itself in there and that might have slowed it down. It's still super annoying that I have to relaunch the browser every single time. I am using Firefox developer edition and there really ought to be a way to just sideload unpackaged add-ons as there is in Chrome. When I'm developing in Chrome, I just have to visit the chrome:\\extensions page and hit refresh to see latest version of my work. – user1850261 Nov 07 '16 at 18:10

2 Answers2

0

You can use jpm watchpost together with the extension auto-installer instead to auto-reload the extension in a running firefox session.

But even without that it should not not take minutes, only seconds.

the8472
  • 40,999
  • 5
  • 70
  • 122
0

As the8472 has mentioned, you can test Add-on SDK extensions without the need to restart the browser using jpm by using jpm watchpost. Using this appears to take a bit of configuring. I have not used this, as I would find having the add-on automatically updated upon every write to a file a bit annoying. I often change multiple files, or make multiple writes to the same file between the times I run the add-on to test. Basically, I want to maintain more control as to when the add-on is reloaded than to have it automatically done each time a file is changed.

There is a way to load temporary add-ons which works for both unpacked add-ons and .xpi files. The problem is that prior to running jpm, your add-on is not actually a complete Firefox add-on. jpm adds wrappers around the contents of your add-on to make it a normal bootstrapped add-on. Without those wrappers, your add-on will not function. One possibility would be to run jpm xpi each time you want to test a new version: Once you have initially loaded the add-on as a temporary add-on, you would run jpm xpi, then click on the "Reload" button for your add-on in about:debugging.

[This method will have issues which you will need to work through]: Alternately, you could unpack the .xpi file and continue your development from the files contained in the resulting directories while using the temporary add-on method of installing your add-on (click on any file in the directory where you unpacked the files to install as a temporary add-on). However, this method may prevent you from using jpm at all with your add-on. In addition, jpm performs somewhat different actions when packaging your add-on into an .xpi file depending on the contents of your add-on. If so, things may start to break if you significantly change your add-on's functionality (e.g. changes in package.json won't propagate to install.rdf). With this method, you would, probably, need to use a "normal", non-jpm method of creating an .xpi file when you want to publish your add-on.

Makyen
  • 31,849
  • 12
  • 86
  • 121