home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
AIMP2
/
aimp_2.61.583.exe
/
$TEMP
/
YandexPackSetup.msi
/
filE8AA8329A56365DB876FC17E3ACD2C0B
< prev
next >
Wrap
Text File
|
2010-07-12
|
1KB
|
50 lines
let EXPORTED_SYMBOLS = ["ProtocolHandler"];
const Cc = Components.classes;
const Ci = Components.interfaces;
const IOS = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var gHandlers = [];
var ProtocolHandler = {
_scheme: "",
get scheme() {
return this._scheme;
},
set scheme(val) {
this._scheme = val;
},
addHandler: function(aHandler) {
if (gHandlers.some(function(handler) { return aHandler === handler; }))
return;
gHandlers.push(aHandler);
},
removeHandler: function(aHandler) {
gHandlers = gHandlers.filter(function(handler) { return aHandler !== handler; });
},
newURI: function(aSpec, aOriginalCharset, aBaseURI) {
let uri = null;
let spec = aSpec.replace(this.scheme + ":", "");
gHandlers.some(function(handler) {
return (null !== (uri = handler.newURI(spec, aOriginalCharset, aBaseURI)));
});
if (uri && typeof uri == "string")
uri = IOS.newURI(uri, aOriginalCharset, aBaseURI);
return uri;
},
newChannel: function(aURI) {
return null;
}
};