I tried the code @ https://wiki.mozilla.org/Embedding/NewApi/XpcomAccess
by inserting

  nsCOMPtr<nsIDOMHTMLDocument> htmldoc = do_QueryInterface
(domDocument);
  if (htmldoc)
  {
    nsCOMPtr<nsIDOMNode> retval;
    nsCOMPtr<nsIDOMHTMLElement> body;
    htmldoc->GetBody(getter_AddRefs(body));
    nsCOMPtr<nsIDOMElement> newdiv;
   // crashes on this line
    domDocument->CreateElement(NS_LITERAL_STRING("div"), getter_AddRefs
(newdiv));
    nsCOMPtr<nsIDOMElement> newhr;
    domDocument->CreateElement(NS_LITERAL_STRING("hr"), getter_AddRefs
(newhr));
    newdiv->AppendChild(newhr, getter_AddRefs(retval));
    nsCOMPtr<nsIDOMText> text;
    domDocument->CreateTextNode(NS_LITERAL_STRING("Provided by
MozEmbed"), getter_AddRefs(text));
    // this line gave a compiler error
    //newdiv->AppendChild(text, getter_AddRefs(retval));
    body->AppendChild(newdiv, getter_AddRefs(retval));
  }

into the DocumentLoaded() function.

Crashes when calling CreateElement on the domDocument too.

I got this idea from:
http://groups.google.com/group/mozilla.dev.embedding/browse_thread/thread/49ac1925b4f9f478
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to