GAAARR!!!! January 10, 2007
Posted by andy in : coding, screengrab , trackbackDeveloping extensions for Firefox is like an exercise in futility that pretends to be a challenge and leads you down the path to hell! Or maybe I really am just being too tricky, like Sisyphus, and I’m somehow being punished?
The development cycle for improving or creating an extension is as follows:
1. Think of great idea / Fulfil user request - Copy to clipboard
2. Imagine it won’t be too hard - Just copy some bytes to a buffer somewhere or something - setX(data)
3. Go looking for the Mozilla docs that pertain to the thing you’re trying to do. - surely it’s on “the interweb”
4. Fail. Look harder. - but where?
5. Eventually turn over the correct rock - Of course! I couldn’t find it because both Google and I are obviously too stupid.
6. Discover that the documentation only documents the straight forward text-only path, idly mentioning that you can use this interface to copy images and other stuff as well, but cleverly neglecting to mention the fact that this IS IMPOSSIBLE because there is nothing published anywhere that tells you how to do it.
7. Go looking for a particular component that you think might work but that is hidden deep within some archaic XPCOM interfaces that you can’t possibly find and even if you could, you’d have to trawl through the Gecko source to understand it because the documentation just doesn’t cover it and EVEN THEN, the source is next to useless so you’re just flapping your arms wildly in the air trying to figure something out.
8. Remember that you are part of a “great development community” with “active forums” and post a question.
9. Prepare a cup of tea as you wait for the iminent replies.
10. Watch lots of stupid questions get answered (the ones that Google CAN help on) for days while still blindly searching through source code, reference material and just trying random combinations of things you think could maybe magically work.
10. Give up.
11. Lie awake at night knowing that there HAS to be a way.
12. Start thinking outside the box.
13. Use a completely different approach that involves creating hidden images and hacking around in order to use some existing functionality that you found.
14. Have SUCCESS!! As long as your users will be happy to click an error box a few times and then somehow miraculously have it randomly work.
15. Try the old way again.
16. Harangue yourself for doing something so stupid.
17. Start thinking about doing those other projects you want to do. That game with the lasers and things.
18. Post to blog.
Please. If someone knows how to take an image, either as a Data URL, a series of bytes, or as an HTMLElement/XPCOMWrapper and get it onto the clipboard, tell me how you did it. Then I will tell you that it doesn’t work for me, but at least there’ll be some sort of discourse!
Then we can start trying to do it in Java as well as using the canvas.
Comments»
Just to be clear here, Firefox is fine. Where is the documentation people?
Java has so much USEFUL stuff and so much of it is from Sun. You Mozilla guys have revenue now. SPEND IT ON HIRING PEOPLE TO DOCUMENT YOUR PLATFORM!
Phew! It’s okay!
All of you people who were about to help me (I’m sure there’s a lot of you out there) don’t worry. I’ve managed to get my latest “workaround” to work, the way I always have to get things to work in Firefox. With a mysterious combination of setTimeout statements and closures.
The thing that always ruins my days is that things don’t happen INSTANTLY in chrome. A change in the DOM or an assignment doesn’t seem to mean that it’s actually happened. It just means that Firefox is considering doing it at some point in the future and that the underlying Gecko code will be notified of that possibility in due course.
This means that if your code keeps executing, things aren’t ready. Or they might be… depending on your platform, processor etc… But you can’t just wait, because there’s no way to wait in JS. You have to split your code in twain and set a timeout. But then you’ll find you have some sort of strange scoping issue or something. And all the time that you’re doing this, you have no idea whether any of the code that you’ve written is actually going to work.
It’s all of these things that I want documented! Nuances damn it! Nuances!
Well, thanks for persisting.. Your plug-in is one of the more useful ones out there. If only the world all had this installed when you have idiot IE users doing a 5 meg paste of a BMP into outlook when they want to show you something..
I agree with the comment about java being great for documentation compared to pretty much everything else out there.. Open source documenters are few and far between it seems.. Which is a pity given that the thing that lets down an otherwise great API or program is the empty comments in the javadoc or tutorials full of outdated or “TODO: add section here”
Also good to see another useful bit of aussie software out there!
I don’t know where else to type this…
But I just wanted to say that your extension saves me about 30mins / job. So something in the order of a week or two a year. I’m dedicating my vacation time to you. Thanks for making it past step 10.
Frank Goertzen
Ecliptical Media
I need a simple extension designed. Do you have paypal? Let me know and I’ll send you the specs.
Heh… Sorry Richard, I only do this stuff to punish myself for the various wrongs in my life.
Just wanna say, you extention is great and it seems to have dissaoeared off the official add-on website.