private void AttachEvents() { if (_eventsAttached) { return; } var domWindow = Browser.GetContentDOMWindowAttribute(); EventTarget = Xpcom.GetPrivateRoot((nsISupports)domWindow).AsComPtr(); foreach (string sEventName in this.DefaultEvents) { using (var eventType = new nsAString(sEventName)) EventTarget.Instance.AddEventListener(eventType, this, true, true, 2); } _eventsAttached = true; }