importNode fails with NS_ERROR_UNEXPECTED - Mozilla

This is a discussion on importNode fails with NS_ERROR_UNEXPECTED - Mozilla ; This does not seem to be https://bugzilla.mozilla.org/show_bug.cgi?id=460460 .. One of the documents (original source of the imported node) is created through: var parser = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance (Ci.nsIDOMParserJS); parser.init(null, uri, uri); var document = parser.parseFromStream(stream, channel.contentCharset, stream.available(), "text/xml"); The other one through ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: importNode fails with NS_ERROR_UNEXPECTED

  1. importNode fails with NS_ERROR_UNEXPECTED

    This does not seem to be https://bugzilla.mozilla.org/show_bug.cgi?id=460460
    ..
    One of the documents (original source of the imported node) is created
    through:
    var parser = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance
    (Ci.nsIDOMParserJS);
    parser.init(null, uri, uri);
    var document = parser.parseFromStream(stream, channel.contentCharset,
    stream.available(), "text/xml");

    The other one through Cc["@mozilla.org/xml/xml-document;
    1"].createInstance(Ci.nsIDOMDocument).implementation. createDocument
    ("", "root", null).

    During addon initialization the node is imported flawlessly, but in
    runtime it fails with NS_ERROR_UNEXPECTED. In During runtime this
    process is initialized by a button click in the navigator window
    (chrome context). But if I try to trigger it with a timer which is set
    in the internals of my extension, importNode works.
    If I remove parser.init(null, uri, uri) it works again, but it's vital
    to pass base uri to the parser. init takes some nsIPrincipal as a
    first argument which seems to be responsible for security, so it looks
    like some kind of a security problem. Is it a bug or should I really
    create this principal and pass it to init to fix the issue?




  2. Re: importNode fails with NS_ERROR_UNEXPECTED

    BTW, it's firefox 3.5. And the issue is not reproduced in 3.0.

+ Reply to Thread