[Exception… "Could not convert JavaScript" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"

What the heck is..

uncaught exception: [Exception… “Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: PATH_TO_MY_JAVASCRIPT_FILE :: THE_METHOD_NAME :: line #” data: no]

For me it was just an appendChild() that was causing the problems. You can always try the innerHTML+= way if all else fails 😉

4 thoughts on “[Exception… "Could not convert JavaScript" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"”

  1. got this too, but after I looked more carefully I noticed the problem. the code was:

    var a = document.createElement(“a”);
    a.appendChild(‘hello world’);

    someDiv.appendChild(a);

    Problem is at line 2. The correct way is:
    a.appendChild(document.createTextNode(‘hello world’));

    1. Thanks for your comment on this issue!

      As you have noticed a string is not a valid DOM element and should rather be used within an actual element like the TextNode you instantiated it on.

Leave a Reply

Your email address will not be published.