RFC: Extension Developer Extension

Talk about add-ons and extension development.
Post Reply
User avatar
RaiseMachine
Posts: 1764
Joined: December 6th, 2004, 6:05 pm
Location: England

Post by RaiseMachine »

WinRAR's trial period lasts for 40 days, I think that's just enough time to get testing done. ;)

I must admit I'm not up with the RAR/UNRAR command lines, when I've worked it out, if you're interested I'll post the info here.

Thanks
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Ok, I've updated the code to support WinRAR and 7-Zip (mostly, still need an answer to the question above), as well as the WinZip Command Line Support Addon. (which is free if you have WinZip). Are there any other common zipping tools people use?

What about Mac support? Does a command line zip program come with OSX? I have no way to test this.

I'll post a new build tonight.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

mrtech wrote:Just a quick note, Firefox is getting stricter on the installer rdf's formats. Used your great tool to update my rdf and the changes it made were bounced back since they didn't match the recommended format. They referred me to the knowledgebase article here:
http://kb.mozillazine.org/index.phtml?t ... nstall.rdf

Hope you can incorporate these changes in future builds, thanks.


Just wanted to make a note here, Extension Builder produces perfectly valid install.rdf files, but due to bug 271272 in UMO, extensions built with it won't currently be accepted to UMO. I'm looking at patching that bug, since I intend to use Extension Builder for everything I do going forward.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Update is out, with extra zip util support. Please test the Extension Builder.
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

I went looking for an answer to the 7zip question, but I see you already asked in the same places I was gonna try: http://sourceforge.net/forum/forum.php? ... m_id=45798 ;) Hope that did solve it. :)

I'm gonna try this new version out soon I think, I'm curious as to if I can get a good workflow somehow without working directly into the installed extensions directory with unwrapped jars. Using the extension builder might just be the way, if it starts to come together now. :)
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

I hadn't seen Igor's reply, I'll try fixing that. You can manually fix that by going to the install directory and editing 7zip.bat.

My workflow currently consists of testing code in jsshell/jsenv, then editing my files, building/installing and restarting Firefox. I intend to make the "install extension" smarter, so it can just copy over jar files if it doesn't really need to do a full install. That way you could use "reload chrome" to test quickly. (at least in trunk builds)
asqueella
Posts: 4019
Joined: November 16th, 2003, 3:05 am
Location: Russia, Moscow

Post by asqueella »

Could the "install extension" module be made to change the target installation paths (if it doesn't do that yet)?

Anyways, you should be able to package the XPI without jar file, as it's describe in the link I gave you, should be easy to implement.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

You would like the option to install unjarred chrome?
asqueella
Posts: 4019
Joined: November 16th, 2003, 3:05 am
Location: Russia, Moscow

Post by asqueella »

Yes, and preferably in a different location (for example I keep my own extensions separate from my profile, on X:\ and just change chrome.rdf to point there).
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

Reload chrome makes really strange things at times, no fault of the actual functions, but if you are doing things in other tabs or for instance have chatzilla open, it will reload all that too. So I prefer to just have one extra Firefox window that I close and reopen, works thanks to disabled XUL cache.

I also think it could be a great idea to have extensions in development installed without zipping and someplace else... with the help of knowledgebase, I managed to unwrap an extension I was working on inside the installed extensions directory and being able to work directly there. Suboptimal of course, but much better than having to reinstall again and again and again, especially for small changes and try-outs. :)

Having the ability to point to a development directory and say "Look there! That is where the extension is!" to Firefox/Mozilla automatically would be wonderful. Then one could just simply work on the files, reloading chrome/browser now and then, and when it's time for release, ask the extension to wrap it up in something distributable. That would indeed be a giant leap ahead for extension development, something that now takes a lot of fiddling just to be able to work. :)
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Bug report: Neither 7-Zip nor WinZip found

Post by Stoffe »

Ok, trying it out for the first time on Windows now and I have some bugs to report, and some solutions, I hope. :)

First, 7-Zip was not detected, "No suitable zip program found" or something similar. Although, when looking at the code, and in the registry, the entry was there. The reason is that the path in the registry is wrong:

Code: Select all

zpath = getRegKey("HKLM", "\\SOFTWARE\\7-Zip", "Path");

should be:

Code: Select all

zpath = getRegKey("HKLM", "SOFTWARE\\7-Zip", "Path");

Note the forward slashes in front of SOFTWARE; when I removed them, it started to work. At least the program ran, I didn't actually have any content for it at that moment. ;)

Also, in the process of debugging this, I installed WinZip just for the heck of it, and it didn't work either. In this case it was because the key it was looking for did in fact not exist at all. :) Finding a similar entry and adding another check made it work. What I added, and you could have a look at was this:

Code: Select all

    // look for winzip again
    zpath = getRegKey("HKCR", "WinZip\\shell\\open\\command\\", "");
    if(zpath) {
      zpath = zpath.replace(/ +"%1" *$/, '');
      zfile.initWithPath(zpath);
      if(zfile.exists()) {
   dump("found WinZip: " + zpath + "\n");
   return new zipUtil("WinZip",
            zpath,
            "winzip.bat",
            "-e0",
            "-ex");
      }
    }


That is, same code again, but with another path, where the entry exists on my machine.

I am testing this on Windows XP, SP2 I'm pretty sure, Firefox 1.0, and the WinZip version was whatever is put right in your face on the homepage. ;)

Hope this helps, now I'll go testing/bughunting some more, will report more issues if I find them.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Interesting, I'm not sure about the 7-Zip code (I tested it earlier, but I may have changed it), but the WinZip code definitely worked on my machine. I guess it might depend on a few things. I kind of wish they just had a Software\WinZip\InstallDir key or something similar. It'd make everything a lot easier!

Just as a note, you need to use 7-Zip 4.12 beta to get the best results. WinZip is also pretty crummy, I recommend installing the free Command Line Extensions if you intend to use it. Basic WinZip doesn't support an exclude mask on the command line, so your CVS/SVN directories and emacs autosave files will get added to your jar/xpi.

I've also just noticed that the version I currently have installed on my Linux machine crashes Firefox and Thunderbird when you open XULEdit and click "Open Preview in New Window". I need to look at that. In addition, Thunderbird 1.0 does nothing when you click the links in the Javascript Shell. It works in TB 0.7, but not 1.0. I'd like to figure out why that is.

asqueella / Stoffe: I'm looking at installing chrome from a directory, I think I need to chat with bsmedberg and see what I can do. It would be nice to install your working directory as chrome and just run right from there. I know it's possible by hand-editing the chrome registry rdf, but I'd like to find an easier solution.

I'm on business travel for the next few days, but I'll try to get a new version up soon.
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

Ted Mielczarek wrote:asqueella / Stoffe: I'm looking at installing chrome from a directory, I think I need to chat with bsmedberg and see what I can do. It would be nice to install your working directory as chrome and just run right from there. I know it's possible by hand-editing the chrome registry rdf, but I'd like to find an easier solution.

I'm on business travel for the next few days, but I'll try to get a new version up soon.


That would be great! :)

One more quick thing:

It seems that the format for specifying compression has changed to -mx=0, -mx=9 etc in the new versions, and try as I might, I can't get that to escape properly when passing through the BAT file - the = disappears and the result is well, wrong. ;)

If anyone knows how to do that properly, please speak up. :) Of course, I could just install Cygwin or something, but I'd rather have it working. Not that anyone should put that much effort into it, though.

Also, I wonder if it wouldn't be easier in the long run to construct separate command lines directly for the programs than having BAT files execute like middlemen?
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Stoffe wrote:It seems that the format for specifying compression has changed to -mx=0, -mx=9 etc in the new versions, and try as I might, I can't get that to escape properly when passing through the BAT file - the = disappears and the result is well, wrong. ;)

I'll see what I can do. Seems like a pain.

Stoffe wrote:Also, I wonder if it wouldn't be easier in the long run to construct separate command lines directly for the programs than having BAT files execute like middlemen?

Unfortunately this is needed, since there's no way to set a working directory with nsIProcess, and to get the right paths in the right places in the zip file, you have to run zip from the extension working directory. The only thing that the batch files do that couldn't be done by running the program directly is cd to the extension working directory. At this point though, I might be able to use a single batch file for all of the zip programs. I'll have to look at it.
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

Ted Mielczarek wrote:
Stoffe wrote:It seems that the format for specifying compression has changed to -mx=0, -mx=9 etc in the new versions, and try as I might, I can't get that to escape properly when passing through the BAT file - the = disappears and the result is well, wrong. ;)

I'll see what I can do. Seems like a pain.


Nah, never mind. I can do with Cygwin or something, if 7zip wants to be a hassle, then let them. :) There are more important things to do...

Now, for some more bug reports with fixes, this time for the Linux zip side:

In extensionbuilder.js, around line 570 or so, zfile is declared inside the win32 block, which means that it is NULL for Linux and others, and so it chokes. Moving it outside makes it work, something like:

Code: Select all

function determineZipUtil()
{

  var zfile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
  /*
   * For Windows, we look for various zip programs
   * by looking in the Windows registry.
   */
  if(navigator.platform == "Win32") {



And around line 120 or so, the function maybeMkDir sets incorrect permissions, actually it sets them to "nobody is allowed to touch these, ever!" - it works in Windows, because it is silently ignored. A better value would be 0755, like so (tried and it works):

Code: Select all

function maybeMkDir(indir, dirname)
{
  var subDir = indir.clone();
  subDir.append(dirname);
  if(!subDir.exists()) {
    subDir.create(subDir.DIRECTORY_TYPE, 0755);
  }
  return subDir;
}


With these fixes, correct xpi with correct jar inside is produced at least on my machine. ;)

I guess I'll punish the extension a bit more in a while and see what I can shake down from the tree.
Post Reply