Mozilla ActiveX Control is unuseable as a subclassed control in .Net 2.0

RESOLVED INVALID

Status

Core Graveyard
Embedding: ActiveX Wrapper
--
enhancement
RESOLVED INVALID
11 years ago
5 years ago

People

(Reporter: Norman Rasmussen, Unassigned)

Tracking

({helpwanted})

Trunk
x86
Windows XP
helpwanted

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Gecko/20060508 Firefox/1.5.0.4

I've subclassed the System.Windows.Forms.WebBrowser as such:

    class MozillaWebBrowser : WebBrowser
    {
        public MozillaWebBrowser()
        {
            Guid clsid = new Guid("1339b54c-3453-11d2-93b9-000000000000");
            typeof(WebBrowserBase).InvokeMember("clsid", BindingFlags.SetField | BindingFlags.Instance | BindingFlags.NonPublic, null, this, new object[] { clsid });
        }
    }

This enables me to add a Web Browser control to a form, and it uses the Mozilla rendering engine.  However certain functionality fails to work: 

    HtmlDocument doc = mozillaWebBrowser1.Document;

The (built-in .net) Document property retrieves the IHTMLDocument2 interface and calls GetLocation (get_location), which is NotImplemented, so the entire method fails.

Reproducible: Always

Steps to Reproduce:
1. Create MozillaWebBrowser Class as described above
2. Add MozillaWebBrowser control to a new System.Windows.Forms.Form as mozillaWebBrowser1
3. Access mozillaWebBrowser1.Document (in Form_Load or Button1_Click)

Actual Results:  
Application Crashes:
System.NotImplementedException: The method or operation is not implemented.
   at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()
   at System.Windows.Forms.WebBrowser.get_Document()

Expected Results:  
HtmlDocument object should be returned (HtmlDocument is a wrapper for IHtmlDocument2 - but the document's location is required to 'build' the wrapper)

I expect a few more bugs to come up once this one is fixed.  Currently I'm limiting code to getElementById (IHTMLDocument3), and setting styles (IHTMLElement.GetStyle, and IHTMLStyle.{Get/Set}CssText()).  Both of those are NotImplemented at the moment. :-(
(Reporter)

Comment 1

11 years ago
Sorry, meant to add that pages load in the control perfectly, it's just the access to the dom objects that's impossible, because of the properties the .net wrappers try and access.

Comment 2

11 years ago
reporter: i don't suppose you could work on fixing this? i'm not sure how much time adamlock has to do this work.
Severity: normal → enhancement
Keywords: helpwanted
(Reporter)

Comment 3

11 years ago
Created attachment 225467 [details] [diff] [review]
first pass at adding get_location

Here's my first pass at adding code to the activex control.  This gets makes the document object available to the .net framework.

If someone could comment on where I should be doing the nsIDOMWindowInternal - in control/IEHtmlDocument (like it is atm) or common/IEHtmlLocation (make a CreateFromSomething method that takes ref to document or window or something) that would be great.

(Next up IHTMLDocument3 support for getElementById)
(Reporter)

Comment 4

11 years ago
Should I fold common/IHTMLLocationImpl.h into common/IEHtmlLocation.h?

I believe that plugin/XPCDocument.cpp uses it, so I'm scared to touch it.
Norman, I'm going to try and remember to send you a private mail very soon: I have concerns about trying to emulate the full MSHTML DOM interfaces, and I was thinking about dropping all of that emulation in favor of an IDispatch wrapper around XPCOM. This may not suit your .NET needs though.
(Reporter)

Comment 6

11 years ago
Created attachment 226088 [details] [diff] [review]
second pass, now has getelementbyid too

Added IHTMLDocument3.getElementById
Attachment #225467 - Attachment is obsolete: true
(Reporter)

Comment 7

11 years ago
Created attachment 226915 [details] [diff] [review]
activex_v3.patch

This is the complete patch required to implement the methods I'm trying to use from .Net.  It is hardly feature complete, but it does add some critical functionality like getElementById and style.
Attachment #226088 - Attachment is obsolete: true
Assignee: adamlock → nobody
QA Contact: dunn5557 → activex
Status: UNCONFIRMED → NEW
Ever confirmed: true
The ActiveX embedding API was removed in bug 662023 and friends, making this INVALID.

[Filter bugspam on activexinvalid]
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
(Assignee)

Updated

5 years ago
Component: Embedding: ActiveX Wrapper → Embedding: ActiveX Wrapper
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.