Hello dear mozillaners.
Okay so I created my own event component for XPCOM so that I can send parameters with an event. What I basically did is this: - Create a new XPCOM component as specified on this site( http://www.iosart.com/firefox/xpcom ) and other resources. - I derived my component class from nsIDOMEvent interface. - In the constructor I create an event object using the method nsIDocumentEvent::CreateEvent(..) and all nsIDOMEvent methods are redirected to that object's pointer. - I registered the component with XPCOM and it is visible from Javascript and C++ meaning I can create an instance of my component. The Problem is that calling initEvent("eventName",true,true) fails with return code 0x80070057 meaning NS_ERROR_ILLEGAL_VALUE. This is how I dispatch the event in Javascript: var cid = "@mydomain.com/Whatever/DOMCustomEvent;1"; if (!(cid in Components.classes)) { alert("component not found"); return; } var ev = Components.interfaces.nsIDOMEvent; var obj = Components.classes[cid].createInstance(ev); obj.initEvent("myevent", true, true); window.dispatchEvent(obj); This fails unfortunately at initEvent. I ran out of ideas on what the problem might be and so I turn to any knowledgeable and kind-hearted soul on this forum. Thank you very much. _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
