public GeckoMarkupDocumentViewer GetMarkupDocumentViewer()
        {
            if (_MarkupDocumentViewer != null)
                return _MarkupDocumentViewer;

            if (WebNav == null)
                return null;

            nsIDocShell shell = Xpcom.QueryInterface<nsIDocShell>(WebNav);
            nsIContentViewer contentViewer;
            IntPtr contentViewerPtr = shell.GetContentViewerAttribute();
            contentViewer = (nsIContentViewer)Xpcom.GetObjectForIUnknown(contentViewerPtr);

            _MarkupDocumentViewer = new GeckoMarkupDocumentViewer((nsIMarkupDocumentViewer)contentViewer);

            return _MarkupDocumentViewer;
        }
        public GeckoMarkupDocumentViewer GetMarkupDocumentViewer()
        {
            if (WebNav == null)
                return null;

            nsIDocShell shell = Xpcom.QueryInterface<nsIDocShell>(WebNav);
            IntPtr contentViewerPtr = shell.GetContentViewerAttribute();
            nsIContentViewer contentViewer = (nsIContentViewer)Xpcom.GetObjectForIUnknown(contentViewerPtr);

            // caching/reusing the GeckoMarkupDocumentViewer will (currently) cause memory corruption exceptions in some cases 
            // (likely due to multiple instances of GeckoBrowser being used) so we create a new one every time here
            GeckoMarkupDocumentViewer markupDocumentViewer = new GeckoMarkupDocumentViewer((nsIMarkupDocumentViewer)contentViewer);
            return markupDocumentViewer;
        }