Ok, so there have been some developments.
Before I go into this though, I just want to make it clear that I have very little knowledge or experience working with XUL, or writing Firefox extensions in general. I’ve dabbled, but I’m mostly ignorant. So all you Firefox aficionados out there…go easy on me.
Using this site, I created a skeleton for my extension, calling it “alertCheck”.
And then I hit a brick wall right away, trying to find the right “alert” to override.
Thankfully, this forum and this forum provided some help.
Now, after the appcontent is loaded, I wait for the DOMContentLoaded event to fire, and then write my new alert function to here:
Phew. Big mouthful.
So, where does that leave me? Well, I was just hanging out in irc.mozilla.net in the #extdev channel. Here’s a chunk of what was said:
<mike_conley> Hey all - I'm trying to write an extension to override window.alert, with an alertCheck that allows users to disable future alerts.
<mike_conley> So far, I'm able to override alert by writing to document.getElementById('content').contentWindow.wrappedJSObject.alert
<mike_conley> however, now it's a matter of timing - I'm doing the override after the DOMContentLoaded event is fired
<mike_conley> So my question is, when should I do the override?
<Mook> I suspect just overriding commonDialog.xul is easier
<Mook> trying to poke the content JS's definition is going to be full of pain
<mike_conley> Cool, I'll look into that - thanks!
<Mook> (the content JS starts around http://mxr.mozilla.org/mozilla/source/dom/src/base/nsGlobalWindow.cpp#4022 and goes the the prompt service which pokes that xul)
<mike_conley> Excellent - I appreciate it.
So maybe there’s another approach that I should be taking – I’m going to look into overriding commonDialog.xul… I’ll write more when I have it.