RFC: Extension Developer Extension

Talk about add-ons and extension development.
Post Reply
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

(Hope you don't mind me spamming here, I don't know where to put it otherwise :))

Got bit by this because I was tired: the paths into the jar must end with a slash, which I hadn't put there, which made installation fail with something like "missing or corrupt contents.rdf". Could be a nice convenience to have those slashes added. Also, it would be nice to add a dummy contents.rdf to those dirs automatically, if that is possible?

Otherwise I seem to make progress using this (Linux only atm), looking nice. :D

Also, it would be extremely nice if there could be some mode for "development installation" where the install paths are simply pointed to the working directory, like described here: http://kb.mozillazine.org/index.phtml?t ... id_of_JARs

I tried pointing the paths to my working dir, which is in a completely different place, and it works just fine... so if the extension could be "installed" that way via this system, that would be awesome - the turnaround time is magnitudes shorter. I usually have a few tabs with docs open, and maybe chatzilla, and other things, and this does not play well at all with reloading chrome. But by doing this, I can just have a separate window that I close and reopen instead, everytime I need to try something out. It gets really fast.

I'm not sure what way is best though, just setting the paths in an install.rdf and leave it empty otherwise (does that work?), or so a real install and then manipulate chrome.rdf? I get the feeling the first would be much better, at least if new installs via install.rdf changes old paths. Then you could just have two install modes, in case one wants to try the jar version too. Maybe I'll experiment some more with this a bit. :)
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Yeah, I caught that Linux zip bug a while ago. Sorry I haven't posted a build yet!

I guess I hadn't tested that maybeMkDir on Linux. Oops! I've been doing most of my development on my (Windows) laptop, not on my Linux machine.

I need to add error checking to the install.rdf editor, it's one of those things I've been really lazy about.

And yes, I do have plans to make the "New" button on the Extension Builder actually work, with a "New Extension Wizard".

Finally, I'm looking into a "development install" where you can just point the chrome paths at your working directory. I chatted with bsmedberg briefly on irc but I didn't get a good feel for the best way to do it. I'll let you know if I find anything out.
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

I sat down this evening and tried to add the development install to a copy of your extension, but I got stuck - not in an unexpected way, but I would like to toss out apporximately what I did and tried to do, and see if anyone got any bright ideas. :)

It feels a bit dangerous to, from inside of Firefox, change chrome.rdf directly on disk, so instead I loaded it as a datasource the internal way, via rdf:chrome. Then I used the info from current extension in extension builder to retrieve all relevant info that needs to be change, and computed new paths. So far, so good, and this works. Then, I tried calling Change on these places, and I get no errors. However, when trying to save, I do get errors, and that I think is because it is a chrome rdf, which is not supposed to be allowed to change. However, I was kinda hoping that if this didn't work, that it could be overridded somehow, at least for the session, but it doesn't seem to be, although the code does not complain when calling change.

I feel that I don't really know exactly what is happening now, or which way to go with this, so I thought I'd better throw it out here and see. The alternative would of course be to load chrome.rdf as a file and save it back, that should be allowed. But it feels a bit more risky. If there was some way to get Firefox to read from temporary changes or something instead, that would really be great.

Tell me if you have any ideas... this would really be convenient. :)
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Modifying chrome.rdf through the datasource won't work, I think. I checked in some code last night that's the beginnings of a development install. It adds entries to installed-chrome.txt, which I've tested and works.

I need to flesh it out a bit more, and then figure out how I want to hook it all up to the GUI. I'm thinking some sort of toggle between "Development Mode" and "Release Mode", where one does the development install, and the other does xpi build/install.

Anyway, check out the code and let me know what you think. I haven't packaged a new XPI with it since it's not hooked up yet. Anyone else who wants to check out the bleeding-edge code from my repository, drop me a line and I'll give you the URL.
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

Well, talk about barking up the wrong tree. :)

I totally missed that chrome.rdf was a generated file... ah well, if one could have done it in-memory, it would have been ok.

Anyways, just quickly eyeing the code, not testing, it looks pretty nice if it works as it should. One thing though, the special directory "AChrom" isn't that the global install chrome directory? I don't think unix permissions will get along very well with that.. of course, it could be manually changed, at least for those with root access, but it is not right. ;) Would it work the same with profile chrome dir, "UChrm"?

As for the UI, my test code just used another button next to the first, that works fine for me, but then again, so does a toggle... :)
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

UChrm will not work, installed-chrome.txt only exists in the app directory. This sucks.

I'm still looking at it, but I don't have a clean solution yet. If the extension is already installed, adding it to installed-chrome.txt won't do anything because the chrome.rdf from the profile directory/chrome will override it.

I can make an inelegant solution for sure, but not the one I want. I think I need to chat with bsmedberg again...

EDIT:

Add to list of things that will break your browser : hand editing chrome.rdf files.
IsoLin.CHiP
Posts: 3
Joined: January 12th, 2005, 10:22 am

Some Issues with 7-zip fixed, now working

Post by IsoLin.CHiP »

Stoffe wrote: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. ;)


I can confirm this Problem. After editing as afore mentioned 7z.exe is properly located.

However I have had some more problems. The build processes failed anyway. I finally tracked it down to two issues (at least after these changes it worked for me):

change in 7zip.bat:

Code: Select all

shift
set DIR=%1
cd /d %DIR%
shift


I added the "/d", because my files resided on D:, whereas FF and 7x were on C: . And without that parameter the NTs (i dont quite recall about 9x) dont change the dir to another drive.

The other problem was, that you didnt specify the compression parameters corrently for 7x.exe in the JS file ( you mention "-mx0" in the .bat, but its "-m0" in the JS)

change in extensionbuilder.js:

Code: Select all

dump("found 7-Zip: " + zpath + "\n");
   return new zipUtil("7-Zip",
            zfile.path,
            "7zip.bat",
            "-mx0",
            "-mx9");


Thereafter it builds properly.

Version-info:

extensiondeveloper : 0.2.0.20041209
7-zip: 4.14 beta
WinXP

Nice extension, keep up the good work :) Looking forward to the devel-install feature
IsoLin.CHiP
Posts: 3
Joined: January 12th, 2005, 10:22 am

premature joy :-/

Post by IsoLin.CHiP »

Well, I did indead fix the errors I got thrown at my head, but unfortunately I dont get a valid XPI.

Now, i've only very superficially studied your code and only just started with developing for mozilla so bare with me please, as I dont entirely understand how your extension works. ;-)

Im trying to build a barebones xpi with this hiearchy:

project\
- install.rdf
+ chrome\
-+ contents\
--- contents.rdf
--- project_overlay.xul

I select project\ as the dir in ext builder.

The way I understand it, you change the CWD to the folder in which the install.rdf and chrome-dir are ("project\" , then issue a createzip on "content\*" (which of course doesnt exists there, its in "chrome\"). If I'd do it manually, I'd first change to chrome and then issue the createzip.

So what I get is an empty project.jar in chrome\ which is then packaged up into project.xpi (btw without the install.rdf, not yet quite sure why)

Am I doing something wrong or is this another bug?
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

IsoLin.CHiP: the content directory should be named content, not contents, and it should be side-by-side with the chrome directory, not inside. As should the locale, skin and default directories, if/when you add those. Hope that helps a bit longer on the way. :)
asqueella
Posts: 4019
Joined: November 16th, 2003, 3:05 am
Location: Russia, Moscow

Post by asqueella »

"content" (without "s") should be inside "chrome". Here are a few nice directory trees with clear explanation of what should be where.

Or were you talking about what kind of input tree extensiondev expects, Stoffe?
User avatar
Stoffe
Posts: 105
Joined: August 23rd, 2003, 5:48 am
Location: Sweden
Contact:

Post by Stoffe »

Talking about extensiondev.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Yes, extensiondev doesn't really have good support for project folders that don't meet its expectations. Hopefully I'll fix that in the future. Right now your directory tree should look like:
<pre>
myext
|- install.rdf
|- chrome
| |- myext.jar
|- content
| |- contents.rdf
| |- myext.js,xul,etc
</pre>

Also, sorry for the lack of updates, Real Life caught up. Been really busy with work among other things. I have two working prototypes of the "Dev Install" feature, and a skeleton for the New Extension Wizard. IsoLin.CHiP, thanks for taking the time to track down those errors. I'll get those fixes in the next version.
corwin
Posts: 65
Joined: December 26th, 2002, 8:15 am
Location: France
Contact:

Post by corwin »

I've been using this extension for 2 weeks now, it works great ! It really is a timesaver.
IsoLin.CHiP
Posts: 3
Joined: January 12th, 2005, 10:22 am

Post by IsoLin.CHiP »

asqueella wrote:"content" (without "s") should be inside "chrome". Here are a few nice directory trees with clear explanation of what should be where.

Or were you talking about what kind of input tree extensiondev expects, Stoffe?


Sorry, that was a typo only in the posting. And as a matter of fact I was following just that tutorial, very good one if I might add. 8)

the "content" (without s ;) ) directory is infact inside the "chrome" directory, which IMO is causeing the trouble, when takeing Ted's answer into considderation. (The way I see it you expect chrome and content dir's to be at the same level?)

Right now your directory tree should look like:

myext
|- install.rdf
|- chrome
| |- myext.jar
|- content
| |- contents.rdf
| |- myext.js,xul,etc


As Im only just starting, I dont know if that makes any difference, but the aforementioned tutorial used a different dir-structure.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

It only matters if you're using some sort of tool (i.e. extensiondev). The only thing that Firefox cares about is where everything winds up in the XPI file. I should eventually put some code in extensiondev to handle the directory structure where content/ exists inside chrome/.
Post Reply