GAAARR!!!! January 10, 2007
Posted by andy in : coding, screengrab , 7 commentsDeveloping 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.