Closed Bug 96923 Opened 23 years ago Closed 22 years ago

[ActiveX] IHTMLDocument2::open and obviously IHTMLDocument2::write always failed when called on an activeX mozilla browser from VB

Categories

(Core Graveyard :: Embedding: ActiveX Wrapper, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: dgervalle, Assigned: adamlock)

Details

(Keywords: crash)

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
BuildID:    My build of 0.9.3 and the NS6.1

When embedding mozilla in a VB form using the activeX wrapper, filling the 
document through IHTMLDocument2::Open and IHTMLDocument2::Write[ln] failed.

Reproducible: Always
Steps to Reproduce:
1. Open a new VB project
2. Put an ActiveX Mozilla browser on the form and call it mb
3. In the form load event, do mb.navigate("about:blank") to have a DOM
4. In the mb_DocumentComplete event, put the following:
mb.Document.open
mb.Document.write "<html><head><title>test</title></head><body><p>test</p></body
></html>"
mb.Document.close


Actual Results:  The document.open calls reports:
Run-Time error '-2147417848 (80010108)':
Method 'open' of object 'IHTMLDocument2' failed

Expected Results:  This should replace de about:blank document by a document 
containing word "test". By the way, this works well with the IE activeX.

I have track the problem in the source, and this not seems to be a wrapper 
problem. Here is my stack dump:

nsHTMLDocument::GetSourceDocumentURL(JSContext * 0x00000000, nsIURI * * 
0x0012f2ac) line 2004
nsHTMLDocument::Open(nsHTMLDocument * const 0x04f02824, nsIDOMDocument * * 
0x0012f2cc) line 2230 + 22 bytes
nsHTMLDocument::Open(nsHTMLDocument * const 0x04f02820) line 2205 + 40 bytes
CIEHtmlDocument::open(CIEHtmlDocument * const 0x04edf5d0, unsigned short * 
0x001d2724, tagVARIANT {0x80020004 VT_ERROR}, tagVARIANT {0x80020004 VT_ERROR}, 
tagVARIANT {0x80020004 VT_ERROR}, IDispatch * * 0x0012f370) line 659 + 30 bytes

Has you can see here, the nsHTMLDocument::GetSourceDocumentURL receive a null 
pointer for the JSContext pointer in its first argument. This will crash later 
the nsContentUtils::GetDynamicScriptGlobal calls using the same null pointer.

If I skip the call to nsHTMLDocument::GetSourceDocumentURL in 
nsHTMLDocument::Open when the JSContext *cx is null, and follow the recover way 
that calls NS_NewURI when the URL can't be found, it works as expected.

Since I have not any sources of mozilla this morning, getting this information 
has been quite hard and I hopes it will helps.
Marking NEW.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: crash
Target Milestone: --- → Future
Summary: IHTMLDocument2::open and obviously IHTMLDocument2::write always failed when called on an activeX mozilla browser from VB → [ActiveX] IHTMLDocument2::open and obviously IHTMLDocument2::write always failed when called on an activeX mozilla browser from VB
Marking this fixed.

document.open, write & close all function correctly. The test case triggers an
infinite loop (the document.close fires a new DocumentComplete event causing it
to run forever, but otherwise it appears to be working.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.