I've been playing with nsISecurityCheckedComponent quite a bit lately and have been wrestling with getting it to work on a js implemented component. I was even trying to use aggregation to have an 'inner' class do the implementation (need to have nsISCC implemented on lots of classes).
I just discovered an issue that I hadn't expected. When implementing nsISCC and nsIClassInfo the call to getClassDescription is actually a check for a property and causes the canGetProperty() method to be called asking about classDescription. Good times. I hadn't even thought to add those pieces to the list of approved properties and methods. Now I know.
I'm digging around in the source for the XPCOM proxy implementation. Trying to determine how things work and how we should go about implementing some cross thread notification stuff for songbird. In particular we want to move from our current dataremote system which uses prefs to pass only strings, integers and booleans around to a system that can pass nsISupports pointers and objects around. We're planning on using this system for publishing the progress of background jobs and want to be able to reflect that in the UI, so we're looking into ways to proxy notification calls from background threads to the UI thread, or just to any old thread you might be on.
More in the extended text...
Continue reading "XPCOM Proxy"I've been doing a bunch of architecture work at Songbird for the past month or two. A large part of that has been digging around in mozilla source and asking questions in #developers to find out if certain things are possible and how to do them. I've been focusing on browser related stuff and in particular I've been looking at adding tabbed browsing to Songbird and adding an API for website to use that will give access to songbird controls (Yeah, I know security issue!!! ).
We're going to be posting all the docs we wrote on our website very soon so I won't get into the details of our plans here. But I will be writing some posts that detail some of the interesting things I've learned and discovered. I just feel that part of being in the mozilla community is contributing to the documentation as I go. If I get enough stuff on any particular section that it makes sense to move it over to one of the mozilla wikis I'll, of course, do that.
I'm starting some work on Mozilla/Gecko Embedding. To help me keep track of where I'm at I've started a page on embedding. Not much there yet, just some background and links to mozilla sites that contain documentation. My plan is to be able to comment on the state of those files and ultimatley to start updating them as I find out more information.
I've posted a new version 0.4 of the helloworld tutorial that has the proper verisoning. I was in a hurry to get it up the other day and posted it with v0.3 strings and install.rdf info.
v0.5 will have a C++ component and will communicate with the core XPCOM system to display something you can't normally get to from a webpage, like a pref or something. I'm also going to look into the update mechanism so ffox will look to my website to find a new version. I have no idea what that entails beyond adding the url to the install.rdf file and properly versioning the xpis on my website.
Hello World may not extend past the 0.5 mark since it will have accomplished most of my goals by then. Namely creating an extension that has xpcom components and can communicate with the core XPCOM system. But I may use it as a testground as I get further down the road and need to test out more advanced scenarios related to skinning and localization or whatever.
Well, I've finished the next 2 versions (0.3 and 0.4) of the tutorial. v0.3 adds the ability to install on Firefox, Thunderbird or Sunbird and v0.4 adds a javascript xpcom component to the mix. I'll be cleaning them up and posting them tomorrow or over the weekend.
I've been noticing more extension tutorials and docs appearing on the web lately and that is awesome. I still am not sold on Mozilla's documentation efforts, but things are just getting going over there so I'll cut 'em some slack. As I get things nailed down over here I'll probably start contributing some documentation to their wiki's at wiki.mozilla.org and developer.mozilla.org (still don't know why they have 2).
A little more description of what is going on in the second tutorial and some cleaned up formatting hit the tutorial page. Look for version 0.3 of the tutorial tomorrow and some clarification of things in the rest of the tutorial (namely some things I said I would look into).
As a side note, I'm trying to find a new layout for the tutorial page because I find it hard to read like it is. (in fact I'm working on a[nother] complete site revision as I have some other content in mind that doesn't fit well into this design) - stay tuned.
I just went to a page that required the Viewpoint plugin. Okay, I clicked on the FFox link that said install now. It couldn't find it but had a link to the Viewpoint webpage that had the download. Very convenient. Yay. And then I clicked on that link (from the Viewpoint page) and a window opened with a download link and a message that said "This page requires the Viewpoint Player".
lol. Fabulous. Design a page to download a plugin that requires the plugin to completely render. It didn't interfere with the download of the plugin, but man it looks stupid!
Kudos to the Firefox folks for making plugin installation easier.
There is a new mozilla extension tutorial up. Or rather the 2nd phase of the one that was there before. I've added the ability to localize using the locale and skin folders. Next up an example that opens a seperate XUL window and can be installed into Firefox and Thunderbird.
I've started my Extensions Tutorial! It over here. I have a first, very simple, extension up there (hello world of course), and an explanation of it. In the next couple days I will have more advanced extensions there. I'll get into skins, localization and components as well as talking about setting up a development environment to make things so much easier to iterate the dev of extensions.
Of course if you want to just take a look at my other proof-of-concept extension you can get it here. It installs into Firefox/Sunbird/TBird trunk builds.
I now have a solid understanding of the chrome.manifest file and have successfully created a XPI file for my test extensions. I have placed it in a directory over here and feel free to download it. I have tested it on Firefox, Thunderbird and Sunbird and it works on all three. However they have to be trunk builds as I use the email-style id and not a GUID. The extension doesn't do much except give an example of an extension that installs across applications and uses skin and localization files.
I'm in the process of creating a tutorial describing what I did to make this extension, or rather, an introduction to making extensions. I'll save everyone the pain I felt going through the process. The tutorial will probably create several other basic extensions and I'll post them in the xpi-stage directory as well and of course link to the tutorial from here when I get it posted.
Incidentally I haven't been able to update the webserver to serve the XPI files so they will just install from the web. The mimetype on the server isn't registered and the .htaccess file isn't working. I'm going to email my support staff and try and get that fixed. UPDATE: works now, or maybe it always did. My cache may have just needed to expire.
I just read a bunch of comments posted on a page dealing with extension development for Firefox and most of them were post decrying the lack of documentation for extensions. I agree with them in part. There is actually quite a bit of documentation but it is scatter, some of it out-of-date and most of it stops at a very early level in the process and counts on the reader to download source and hack away.
What one reader brought up is that the nature of the OSS (Open Source Software) culture is inherently one of hackers. And I don't mean the guys who try to break into government databases. I mean the guys who wanted to know how some piece of software worked so they tore it apart and looked at it, or they experimented until they got it figured out.
I would tend to agree with that sentiment. And furthermore there is nothing wrong with it. I think a person learns a LOT more about programming by actually doing it themself and that is large part what hackers are about. However, Mozilla is now reaching a point where they are getting noticed and want to compete with the big boys (pronounced Microsoft). And one thing Microsoft does better than anyone is get people to adopt their products. One thing MS figured out early was that to get wide consumer adoption of their software they needed the geeks, er programmers, to use it and develop for it. So they wrote the tools and documentation so the programmers could do that. Training classes and certification classes and the whole enchilada.
Mozilla now has a corporate entity and they are increasing their employee base and really becoming a viable entity in the software industry. They are getting developers in other corporations interested and indeed other executives and companies interested in developing mozilla related software. But if they really want to make it to the next level I think they need to get very serious about making a platform out of their codebase and providing the tools and documentation for developers.
There have already been several great tools developed the js debugger and the DOM inspector are 2 examples. And with the work going on over at DevMo I can only hope that the mgmt is pushing for just such a thing. But right now DevMo is just collecting articles from all the other people that have written stuff. I know the line, "It's open source if you don't like it, fix it". And certainly I'm going to do what I can, but at some point it falls in the lap of MozCorp to make it a priority and to get it done.
I'll just sign off by saying I don't mean to be overly critical of Mozilla. I've known and worked with many of these folks for years and am thrilled at their success. I think their platform is one of the strongest things to develop in recent years and only talk this way because I want to see it succeed. Now, off to writing (and documenting) extensions!!
No XPI yet, but I did find a couple of great articles (linke off of DevMo about creating C++ Components for Firefox Extensions.
Here's one for complex extensions and one for simpler extensions, linked to from the first.
I have successfully created a simple extension that can be installed in Firefox, Thunderbird and Sunbird. Right now I'm using it in flat file format and pointing to it using a file with the user@domain.tld name that has the path to the root directory (as described here and here and here), keeping in mind this only works with the trunk builds, not the current releases. But today I'm going to put together a script or something that packages it all up into a .xpi and put it up here for download so others can see what I have done.
In short, what I did was take the helloworld extension (from roachfiend I think, but maybe from here I don't remember which it was) and modify it to launch a seperate XUL window with some basic XUL elements in it. Then I added the target application code to install.rdf for TBird and Sunbird (see earlier post about GUIDs for those apps). Then I modified the overlay's to overlay the proper XUL files for each app.
One thing I noticed is that it would be much easier and clearer if there was a standard for what XUL lives where and naming conventions for things like menu ids or ids for XUL elements in general. I put LXR to good use in order to browse the XUL files and find out where things were. I also mapped out the main windows for FFox and TBird with DOM Inspector in order to figure out just which XUL element was which.
Anyway, I didn't mean to go into this much detail yet. There will be a page with a full description of the extension and how I got to where I am. Yay!
I'm working on my little test extension and trying to get it working in Firefox, Thunderbird and Sunbird. Right now it doesn't do anything interesting I'm just trying to get the extension development environemtn familiar to myself and to track down any issues and gather information. For instance, right now I'm hunting around trying to find the GUIDs for the all 3 apps (Firefox is easy) so I can add them as target applications. I KNOW I've seen at least the Thunderbird GUID (paired with the Firefox GUID) but for the life of me can't find it. Which of course brings me back to my rant about documentation and the need for very centralized, standard, sensible easy to find and navigate docs.
In the meantime I'll post them here and try to come up with a system of gathering documentation better than I have over here.
Firefox GUID: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
Thunderbird GUID: {3550f703-e582-4d05-9a08-453d09bdfdc6}
Mozilla GUID: {86c18b42-e466-45a9-ae7a-9b95ba6f5640}
Sunbird GUID: {718e30fb-e89b-41dd-9da7-e25a45638b28}
Incidentally, the ability for extension developers to use email-style IDs instead of GUIDs is very cool. Makes for a much easier time figuring out what is what when you have several extensions in the profile directory. Documented here at developer.m.o
Looks like there is going to be some consolidation of documentation over in Mozilla-land. Mozilla Developer Central (DevMo for short) is online now and in Alpha! The effort is moving documentation from the mozilla.org website, at least the developer related stuff.
My only problem with this project is that now there is mozilla.org, wiki.mozilla.org, mozillazine.org, and developer.mozilla.org. All of which have documentation about using and building mozilla, some of which is out of date and a lot of which is not as complete as needed. My thought is that there needs to be an information czar who works for MoFo that lays down what goes where.
Well, I just wandered over to Mozillazine and read about the creation of the Mozilla Corporation. This adds another interesting spanner in the works. Should there now be seperate documentation on the commercial properties associated with MozCorp? I'll have more to write about all this.
I was chatting on IM tonight with Stuart (pavlov == stuart) and I walked in on an idea. We had been talking about the Mozilla calendar client and where it was going and the whole App vs. Extension thing. When I read the roadmap, and granted it is old, it read that mofo wants to move towards simplified stand alone apps with strong extension capabilities. A direction I think is great. The mozilla suite and the old Netscape suite where chok full of cruft and were slow and big because of it.
So now they have a browser and a mail app as strong stand alones. Except the mail app is also an extension that can be added to the browser (or at least there is work to go in that direction as I understand it - check the roadmap diagrams). And there is a calendar standalone but what good is a calendar without any mail support these days so that will be an extension for Thunderbird in addition to a stand alone. Well, do you see the pattern?
Enter my brilliant idea (I think I had this one a long time ago too and never acted it on it then - see the post from the other day). The idea stemmed from a little proof of concept done by Dave back in the Netscape days. He was elbow deep creating XUL Tabs and wondered if the mail app could be loaded into a tab in the browser. Sure enough it could, although it didn't function completely. Tonight I started thinking about that test and about all the extensions available for Mozilla/Firefox/TBird and about my Masters project. There is a huge headache dealing with integration of these applications. They were all developed seperatley without thoughts towards re-integrating them back together (at least not real deep thoughts). But what if these apps were all designed as extensions to an extensions container.
Instead of a web browser we would have a container for web related applications. In fact they might not even have to be web related, but they would be written using the Mozilla Platform (it's coming, it HAS to be) so they could make use of all the things you get for free. There would be lots of things to work out. In particular profiles would be a huge sticking point. I did some work on the profile sharing code for mozilla (darin did most of the hard stuff) and man are there a lot of issues. But looking at the direction the web is heading and what apps have worked and the state of things, this seems like the right move, especially for MoFo.
You could start with Firefox, and then strip it down to XUL frame code, profile code, maybe network code too, of course you'd need the nspr stuff probably too and security, but you're talking about a pretty small subset of stuff. It wouldn't even _have_ to know about HTML. Then expand the extension mechanism to allow changes to the toolbar and PTB and maybe even some basic menu changes. Maybe add menus as extensions are added, I don't know. Then create an api so extensions can advertise services to the rest of the extensions and the application itself. That would ease the integration issue, if mail hooked in and said hey, if you want to send an email to someone call this method and here ya go! Addressbook could be an extension and a filter for syncing with your palm could be an extension that knew how to talk to a/book and the palm.
So this is my big idea (TM), and I'd call it Hydra, like the multiheaded Greek monster. I thought I'd put that in my blog in case I actually get around to doing it and have to fight someone for the copyrights on the name. :-). Maybe MoFo's already on this and under way. I hope so. I also really hope they are making a prioirity of creating an actual Mozilla Platform, because I think that is how they survive. That's all for now, time for more wine and chocolate.