Sunday, 1 March 2015

Firefox SDK pagemod not working with xml document



I have installed the following extensions: EPUBReader and Google Translator.


Google Translator is built using Firefox SDK. Its page-mod snippet is as following:



var workers = [], content_script_arr = [];
pageMod.PageMod({ /* page */
include: ["*","file://*","about:*"],
contentScriptFile: [data.url("content_script/inject.js")],
contentScriptWhen: "ready",
contentStyleFile : data.url("content_script/inject.css"),
onAttach: function(worker) {
array.add(workers, worker);
worker.on('pageshow', function() { array.add(workers, this); });
worker.on('pagehide', function() { array.remove(workers, this); });
worker.on('detach', function() { array.remove(workers, this); });
content_script_arr.forEach(function (arr) {
worker.port.on(arr[0], arr[1]);
});
}
});


As you can see, it should bind javascript to all documents with a URL starting with about:*. EPUBReader loads documents in URLs like about:epubreader?id=5 so javascript from Google Translator should be injected. But it doesn't.


Is the problem caused because EPUBReader opens documents in an XML format? (with its own Doctype statement also). If so, how can i solve this?


Thanks


No comments:

Post a Comment