How Crashplan breaks xpcshell tests on Windows

Posted: November 23rd, 2011

I recently switched to a Windows laptop and have been going through the usual teething pains related. One thing that confused me though was that when I was running xpcshell tests on my new machine they would frequently fail with access denied errors. I’ve seen this sort of thing before so I know some service was monitoring files and opening them after they had changed, when this happens they can’t be deleted or edited until the service closes them again and often tests open, close and delete files so fast that there isn’t time for that to happen.

It took me a little while to remember that I can just use Process Monitor to track down the offending service. Just fire it up, set a filter to only include results to a particular directory (the temp directory in this case) and go create a file there and see what shows up. I was quite surprised to see Crashplan, the backup software I (and probably many people in Mozilla) use. Surprised because Crashplan isn’t set to backup my temp directory and really I shudder to think what the performance cost is of something continually accessing every file that changes in the temp directory.

Turns out you can turn it off though. Hidden in the depths of Crashplan’s advanced backup settings is an option to disable real-time filesystem watching. From what I can see online the downside to this is that files will only be backed up once a day, but that’s a pretty fine tradeoff to  having functioning xpcshell tests for me. There is also an option to put crashplan to sleep for an hour or so, that seems to work too but I don’t know exactly what that does.

It confuses me a little why Crashplan monitors files it never intends to backup (even when the backup server isn’t connected and backups aren’t in progress) and it is quite a lot of file accesses it does too. Seems likely to be a bug to me but at least I can workaround it for now.

Tags: , , ,

1 Comment »

Categories: general, mozilla

WebApp Tabs, version control and GitHub

Posted: November 7th, 2011

The extension I’ve been working on in my spare time for the past couple of weeks is now available as a first (hopefully not too buggy) release. It lets you open WebApps in Thunderbird, properly handling loading new links into Firefox and making all features like spellchecking work in Thunderbird (most other extensions I found didn’t do this). You can read more about the actual extension at its homepage.

Mostly I’ve been really encouraged during the development of this at just how far our platform has come for developing restartless add-ons. When we first made it possible in Firefox 4 there was a whole list of things that were quite difficult to do but we’ve come a long way since then. While there are still things that are difficult there are lots of things that are now pretty straightforward. My add-on loads simple XUL overlays, style overlays, installs JS XPCOM components with category manager registration, all similar to older add-ons. In fact I’m struggling to think of things that it is still hard to do though I’m sure other more prolific developers will have plenty of comments on that!

The other thing I’ve been doing with this extension is experimenting with git and GitHub. I think it’s been an interesting experience, there are continual arguments over which is better between git and mercurial with many pros and cons listed. I think most of these were done some time ago before mercurial and git really matured because from what I’ve seen there is really little difference between the two. They have slightly different default branching styles, but both can do the same kind of branching that the other can if you want and there are a few other minor differences but nothing that would really make me all that bothered over deciding which to use. I think the only place where git has a bonus is with GitHub, and really as far as I can see there isn’t a reason why someone couldn’t develop a similar site backed by mercurial repositories, it’s just that no-one really has.

GitHub is pretty nice with built-in basic issue tracking and documentation though it still has some frustrating issues. It seems odd for example that you can’t fork your own project, only someone else’s, but that’s only a minor niggle really. As project hosting goes I can’t say I’ve come across anything better that I can remember.

Tags: , , , , , , , ,

6 Comments »

Categories: extensions

Overlays without overlays in restartless add-ons

Posted: October 31st, 2011

Perhaps the most common way of making changes to Firefox with an extension has always been using the overlay. For a window’s UI you can make changes to the underlying XUL document, add script elements to be executed in the context of the normal window’s code and add new stylesheets to the window to change how the UI looks.

Restartless add-ons change this around completely, the normal overlay and style-overlay mechanisms just aren’t available to restartless add-ons and this is likely to remain true for a while, these methods don’t clean up after themselves when the add-on is uninstalled.

This can make things hard, particularly for porting older add-ons to become restartless. I was in this situation earlier this weekend. I was working on porting David Ascher‘s WebTabs for Thunderbird to be restartless. I could have just moved all the script code over to bootstrap.js but in many ways it is nice to keep the code that works on the main UI separate to the code that runs for the preferences UI etc. Plus I like to play around with new ways of doing things so I developed a JS module I’m calling the OverlayManager.

The OverlayManager watches for new windows being opened and for every new window it can run JS script and apply CSS stylesheets to the window in a way that is easy to undo if the add-on is disabled at runtime. Although it can’t do any XUL modifications right now (I didn’t need any for this particular extension) it would be pretty easy to extend this to support a minimum about of XUL overlays.

Stylesheets are loaded by adding a HTML style tag to the XUL document, so they can be removed easily when the add-on is disabled. Scripts are handled in a way that may even be better than normal overlays. In the old system extension scripts all run in the same context as the window they overlay giving rise to the possibility of conflicts. Restartless add-ons shouldn’t do this since it makes removing the script code again much more troublesome. The OverlayManager handles it by creating a sandbox to run the script in. The sandbox’s prototype is set to the window the script is being run for meaning the script sees all the functions and objects of the window directly in its own scope but as long as it doesn’t modify any of the objects in the main window’s code all we have to do is throw away the sandbox to get rid of its JS.

There are a few things different of course. The script shouldn’t use load and unload event handlers for the window as it may get loaded well after the window does or unloaded well before. Instead the OverlayManager looks for an OverlayListener object in the script and calls load and unload methods on it, these are called either with the window’s real load and unload events or while the window is open normally. You also can’t reference code in the script from JS string blocks, so if you set onclick="myfunc()" on a XUL element it wouldn’t work because that would run in the main window scope which can’t see the sandbox code at that point. This tends to be pretty simple to get around by using addEventListener for all your events though.

You can see the existing state of the code on github and an example of the structure you’d pass to OverlayManager.addOverlays is in the bootstrap script for the same project. It is appropriately licensed so go nuts!

Update: I changed the stylesheets to use XML processing instructions to be more like they work currently and just for fun I implemented the very basics of document overlaying, almost totally untested though so YMMV.

Tags: , , ,

7 Comments »

Categories: mozilla

Mossop Status Update: 2011-10-29

Posted: October 29th, 2011

Done:

  • Implemented a number of performance fixes for mobile (bug 696141 and dependents)
  • Reviewed more of the default to compatible work
  • Basic implementation for add-on hotfix (bug 694068)
  • Landed the final third-party add-on patches on aurora and beta
  • Product planning meeting for Firefoxes 8, 9 and 10

Next:

  • Finish the add-on hotfix work
  • Various HR stuff
  • Start planning Jetpack work week

Tags: , ,

Comments Off

Categories: mozilla

Mossop Status Update: 2011-10-14

Posted: October 14th, 2011

Done:

  • 7.0.1 Post Mortem
  • Hotfix planning work
  • Understanding the new mobile architecture
  • Problems with third party add-ons in Firefox 8
  • Default to compatible planning
  • Final draft of Q4 goals

Next:

  • Update module description for the Jetpack module
  • Fix third-party add-on detection problems

Tags: , ,

Comments Off

Categories: mozilla

Mossop Status Update: 2011-10-07

Posted: October 7th, 2011

Done:

  • Worked with the team to fix the version number problems with the last repacks
  • Security reviews for embedded add-on preferences and showing performance information to users
  • Working on Q4 goals for the team

Next:

  • Finalize Q4 goals
  • Update module description for the Jetpack module

Tags: , ,

Comments Off

Categories: mozilla

Mossop Status Update: 2011-09-02

Posted: September 2nd, 2011

Done:

  • Worked with the Jetpack drivers to come up with a new way to prioritise bugs
  • Talked over issues with add-on compatibility and version upgrades
  • Helped prepare a test plan for SDK repacks
  • Killed most of my review queue

Next:

  • Try to clear anything that is blocked on me before my vacation

Tags: , ,

1 Comment »

Categories: mozilla

Mossop Status Update: 2011-08-26

Posted: August 26th, 2011

Done:

  • Regular bug triage (epic bug triage deferred)
  • Tinkering with the Bugzilla APIs
  • Cleared out my inbox and review queues

Next:

  • Formalise priorities for the Jetpack team

Next week I'll probably be in and out randomly as relatives and friends are going to be in town

Tags: , ,

Comments Off

Categories: mozilla

Mossop Status Update: 2011-08-15

Posted: August 15th, 2011

Done:

  • Landed UI to allow users to check they have the add-ons they want on next upgrade (bug 596343)
  • Landed UI to allow users to confirm that they want third-party add-ons before they are enabled (bug 476430)
  • E10S planning

Next:

  • Fix test failures on aurora
  • Mobile planning

Tags: , ,

Comments Off

Categories: mozilla

Another 7 things…

Posted: August 7th, 2011

Thanks to robcee you get to learn a little more about me. Much like him I’ve done this once before (perhaps it’s a sign of our age?) but it was over two years ago so let’s see if I can manage to rustle up a whole other seven things. I believe that the original meme said the facts had to be surprising things that most people didn’t know but I think I’ve used up all the surprising stuff about me already so most of this is probably common knowledge to those that follow my twitter stream.

Here are the rules:

  1. Link to your original tagger(s) and list these rules in your post.
  2. Share seven facts about yourself in the post.
  3. Tag seven people at the end of your post by leaving their names and the links to their blogs.
  4. Let them know they’ve been tagged.

My new things:

  1. I like creating fractals. I guess this says that I have an artistic side but fractals are kind of cheating, you can create beautiful images mostly by tinkering with numbers in equations. I haven’t had chance to do it much lately mostly because the better software is Windows only and rebooting my laptop into Windows is tedious.
  2. Another part of my artistic side which has grown in the past couple of years is photography. I’ve liked taking photographs for some time but for a lot of that I was really just playing with simple point and shoots. Since moving onto the excellent Canon Powershot S90 and now the Nikon D7000 I like to think I’ve been able to get some really great shots. Of course I throw away more than I take. During a recent weekend trip to a lake I think I took around 1000 shots, kept about 90 of those and uploaded just 35 to flickr.
  3. I am engaged to the gorgeous Tiffney. We’re going to be married at the start of September, just five months after I proposed. We took the easy route of paying for a mostly pre-packaged wedding. I think some of our friends who are also getting married at the same time are a little jealous of how easy it’s been for us.
  4. We own a cat, Loki. He is curled up next to me as I write this. We named him before we knew just how appropriate it was. We had to buy sheets of plastic to lay by the sides of the bed to stop him scratching the mattress in the middle of the night. We used to also have a second cat, Ripley, but sadly she passed away at the start of the year from cancer.
  5. I have just bought a condo with my fiancée, the first place I’ve owned. It feels nice to no longer be answerable to a landlord though I guess we still have to answer to the homeowner’s association. Since we only just moved in we don’t know where any of our stuff is including the TV remote which is quite irritating.
  6. For a few years while I was at university I answered to the name Andy. This started because in my scuba diving class there was a large number of Andys and our instructor decided to just start calling us all Andy. I was one of the few from that year’s novices who got more involved in the club afterwards and so the name stuck. In fact I got so used to it that one evening in a noisy pub someone was trying to get my attention by calling “Dave” and when that didn’t work they called “Andy” which I heard right away.
  7. My IRC nickname (Mossop) originated in college. There was a childrens TV show on at the time featuring extremely badly modelled puppets. Someone in my physics class claimed that I looked like one of them, the nickname stuck and I’ve been using it online ever since. One bonus is the name is so unusual that I mostly get away with using it wherever I go.

Now for the tags, hopefully many of these are new to the game:

  1. Myk Melez who always has something interesting to say and hasn’t blogged enough lately.
  2. Dave Mason who needs to get his blog syndicated on planet.
  3. Jeff Griffiths who has only recently started at Mozilla and needs to get his new blog syndicated on planet before he follows through on this.
  4. Blair McBride, my chief partner in coding for the grand Add-ons Manager redesign for Firefox 4.
  5. Daniel Holbert, his blog title makes me laugh and the second coming of this meme needs to branch out into other teams.
  6. John Ford, so he can get the build and release teams in on this.
  7. Philipp von Weitershausen, I can’t pronounce his last name and I’m sure he’ll tag lots of the new services guys.

 

Tags:

3 Comments »

Categories: general, miscellaneous