[Project_owners] XPCNativeWrapper and nsIDOMNSHTMLDocument object

Didier Ernotte didier at ernotte.com
Fri Aug 5 05:05:55 EDT 2005


This give me the following error
 
Exception... "Node cannot be inserted at the specified point in the
hierarchy"  code: "3" nsresult: "0x80530003
(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)"

if I add

while (doc.firstChild != null) { doc.removeChild(doc.firstChild); }

to clean the doc object before, because it seems that there are a
pre-defined hierarchy in the browser object like
<html><body></body></html>, FF does not crash, and I have not
exception, but nothing append.

If I replace 

var htmlElem = document.createElement("html");
var bodyElem = document.createElement("body");
var embedElem = document.createElement("embed");

by

var htmlElem = document.createElement("HTMLHtmlElement");
var bodyElem = document.createElement("HTMLBodyElement");
var embedElem = document.createElement("HTMLEmbedElement");


same result (nothing append)

If I replace by

var htmlElem = doc.createElement("HTMLHtmlElement");
var bodyElem = doc.createElement("HTMLBodyElement");
var embedElem = doc.createElement("HTMLEmbedElement");


same result (nothing append)




Didier


--- Eric Jung <grimholtz at yahoo.com> wrote:

> What if you continue to use DOM methods to add content to doc; i.e.,
> 
> var br = document.createElement("browser");
> someObject.appendChild(br);
> var doc = br.contentDocument;
> var htmlElem = document.createElement("html");
> var bodyElem = document.createElement("body");
> var embedElem = document.createElement("embed");
> htmlElem.appendChild(bodyElem);
> bodyElem.appendChild(embedElem);
> doc.appendChild(htmlElem);
> 
> Haven't tried it, but maybe it would work?
> 
> -eric
> 
> --- Didier Ernotte <didier at ernotte.com> wrote:
> 
> > Ok, back to the begining. In my extension, I have to dynamicaly
> > create
> > a <browser> and then populate the content with a dynamic string
> > like
> > "<html><body><embed.....></embed></body></html>".
> > In Firefox 1.0.6, I use:
> > 
> > var br = document.createElement("browser");
> > someObject.appendChild(br);
> > var doc = br.contentDocument;
> > doc.write("<HTML><BODY><EMBED.....></embed></body></html>");
> > 
> > 
> > but this doesn't work with firefox 1.1. I have an
> > (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLDocument.write...)
> > exception.
> > 
> > What I have read (but I may be wrong) is that , with firefox 1.1, I
> > have to use:
> > 
> > var br = document.createElement("browser");
> > someObject.appendChild(br);
> > var contentWrapper = new XPCNativeWrapper(br.contentWindow,
> > 'document');
> > var docWrapper = new XPCNativeWrapper(contentWrapper.document, '',
> > 'write()');
> > docWrapper.write("<HTML><BODY><EMBED.....></embed></body></html>");
> > 
> > but it doesn't work either.
> > 
> > Didier
> > 
> > --- Neil <neil at parkwaycc.co.uk> wrote:
> > 
> > > Didier Ernotte wrote:
> > > 
> > > >There is no javascript in it.
> > > >  
> > > >
> > > So where do the XPCNativeWrappers fit in?
> > > _______________________________________________
> > > Project_owners mailing list
> > > Project_owners at mozdev.org
> > > http://mozdev.org/mailman/listinfo/project_owners
> > > 
> > 
> > _______________________________________________
> > Project_owners mailing list
> > Project_owners at mozdev.org
> > http://mozdev.org/mailman/listinfo/project_owners
> > 
> 
> 
> 
> 		
> __________________________________ 
> Yahoo! Mail for Mobile 
> Take Yahoo! Mail with you! Check email on your mobile phone. 
> http://mobile.yahoo.com/learn/mail 
> 



More information about the Project_owners mailing list