I'm not sure if this is a bug or not, but I figured I'd post it anyway.
If you add a "DOMNodeInserted" event to an element and have it call a GM_xmlhttpRequest, you get the following error:
Error: Greasemonkey access violation: unsafeWindow cannot call GM_xmlhttpRequest.
If you do this on a "click" event, there is no access violation.
Workaround is to use setTimeout within the DOMNodeInserted callback function and have that call GM_xmlhttpRequest instead, it seems to work.
(ie: setTimeout(function() { GM_xmlhttpRequest(...) }, 0); )
Sample script: http://64.90.176.34/greasemonkeyBug.user.js
Sample page: http://64.90.176.34/greasemonkeyBug.html
Result:
64.90.176.34/Bug Test: DOMNodeInserted - pre-GM_xmlhttpRequest
----------
Error: Greasemonkey access violation: unsafeWindow cannot call GM_xmlhttpRequest.
----------
64.90.176.34/Bug Test: DOMNodeInserted - post-GM_xmlhttpRequest
----------
64.90.176.34/Bug Test: click - pre-GM_xmlhttpRequest
----------
64.90.176.34/Bug Test: click - post-GM_xmlhttpRequest
----------
64.90.176.34/Bug Test: DOMNodeInserted - setTimeout - pre-GM_xmlhttpRequest
----------
64.90.176.34/Bug Test: DOMNodeInserted - setTimeout - post-GM_xmlhttpRequest
Firefox: 2.0.0.14
Greasemonkey: 0.7.20080121.0