In my XPI I am fetching javascript code from the user’s PC (file://) and run the js code in sandbox.
For some reason I get not well formed error on the first line of my code which is a comment:
// Yosy
My code is still running but this error is annoying and I want to fix this, any suggestions?
Code Example for running the code:
var sandbox = new Components.utils.Sandbox(safeWin);
sandbox.window = win;
sandbox.doc = win.doc;
sandbox.__proto__ = win;
“Not well-formed” is an XML processing error. Somewhere the browser attempts to interpret your JavaScript code as XML. Your code example doesn’t show it but I guess that you are using
XMLHttpRequestto download your script – and by defaultXMLHttpRequestwill attempt to parse the XML code (as it name already says). You want to tell it that you are downloading plain text that should not be parsed: