In the webextension version, you need to modify file "lib\jsonformatter.js". Replace function toHTML with this one:
Code: Select all
toHTML: function(content, title) {
function read_file(url)
{
var rc;
var istream = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newChannel(url, null, null)
.open();
var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"]
.createInstance(Components.interfaces.nsIScriptableInputStream);
sstream.init(istream);
rc = sstream.read(sstream.available()); // sstream.read(-1) also reads all.
sstream.close(); sstream = null;
istream.close(); istream = null;
return rc;
}
return '<!DOCTYPE html>\n' +
'<html><head><title>' + this.htmlEncode(title) + '</title>' +
'<style type="text/css">' + read_file(addonData.url("default.css")) + '</style>' +
'<script type="text/javascript">' + read_file(addonData.url("default.js")) + '</script>' +
'</head><body>' +
content +
'</body></html>';
}