I'm having a problem migrating some code to my Firefox for Android extension. I need to extract some information from a request, something like this fiddle, but in mobile (I put the response in a var because the same origin policy, in order to reproduce similar characteristics from WebPage).
I know that code works fine, because the fiddle works. But when migrating to Firefox for Android it doesn't work.
var parser = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser);
//ERROR IN NEXT STEP (DOESN'T THROW ANY MESSAGE - CONTROL FLOW JUST DISSAPPEARS)
var parsedXml = parser.parseFromString(response, "text/xml");
var xpathExpression = "//td[contains(.,'Raw text')]/../td[2]/pre";
var res = document.evaluate(xpathExpression, parsedXml, null, window.XPathResult.STRING_TYPE , null);
I debugged the extension but there was no error message, neither exceptions. So I put a breakpoint in the first line (var parser =...), I could see the parser being created, but in the next step the flow control dissapeared, and all the following code is never excecuted. Everything is inside a try-catch statement, so there is no reason for dissapear.
I really don't understand what is happening. Can you help me?
The adb logcat says: JavaScript Error: "WrongDocumentError: Node cannot be used in a document other than the one in which it was created" {file: "resource://gre/modules/addons/XPIProvider.jsm