1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Components.utils.import('resource://greasemonkey/prefmanager.js');
const EXPORTED_SYMBOLS = ['isGreasemonkeyable'];
const ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
function isGreasemonkeyable(url) {
var scheme = ioService.extractScheme(url);
switch (scheme) {
case "http":
case "https":
case "ftp":
return true;
case "about":
// Always allow "about:blank".
if (/^about:blank/.test(url)) return true;
// Never allow the rest of "about:". See #1375.
return false;
case "data":
return GM_prefRoot.getValue('dataIsGreaseable');
case "file":
return GM_prefRoot.getValue('fileIsGreaseable');
case "unmht":
return GM_prefRoot.getValue('unmhtIsGreaseable');
}
return false;
}
|