I've been into Firefox extension development recently, and ran into some issues:
So, in browser.xul i defined these lines:
<overlay id="sample" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="jquery.js" />
<script src="global.js" />
</overlay>
So, in global.js i have access to all jQuery stuff, and trying to load a simple script there:
var inner = null;
var o = function () {
var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
return {
init : function () {
alert('here loading inner..');
$.get('http://www.example.com/script.js', function(d) {
alert('loaded inner script!');
inner = d;
gBrowser.addEventListener("load", function () {
alert('onload');
}, false);
}).error(function(e) { alert('error loading inner..'); setTimeout(o.init,1000); });
$(this).ajaxError(function() { alert('ajaxError'); });
}
}
}
window.addEventListener("load", o.init, false);
But nor i receive a "loaded inner script", nor a "error loading inner" alert.. And i don't see the error console to log any errors from the extension... I assume the $.get
is silently failing due to some restrictions maybe, but is there a proper way to debug the errors normally? The error console is silent for the extension, it only shows errors from the web pages
<script>
tag (regardless if done from an extension or even the HTML of the page itself) that does not use SSL for the script's url? Since such an example runs inside the web page sandbox, presumably the browser has to guard against rogue web pages. Of course the browser can't prevent phishing due to script injection into the web page sandbox. Phishing and script injection can be done from the HTML too, so are you implying all urls should be https? – Dallis