IntPtr nsIInterfaceRequestor.GetInterface(ref Guid uuid)
{
object obj = this;
// note: when a new window is created, gecko calls GetInterface on the webbrowser to get a DOMWindow in order
// to set the starting url
if (this.WebBrowser != null)
{
if (uuid == typeof(nsIDOMWindow).GUID)
{
obj = this.WebBrowser.GetContentDOMWindowAttribute();
}
else if (uuid == typeof(nsIDOMDocument).GUID)
{
obj = this.WebBrowser.GetContentDOMWindowAttribute().GetDocumentAttribute();
}
}
IntPtr ppv, pUnk = Marshal.GetIUnknownForObject(obj);
Marshal.QueryInterface(pUnk, ref uuid, out ppv);
Marshal.Release(pUnk);
return ppv;
}