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
/
fil2B3FEC0E4EFD97841E426FC022386A40
< prev
next >
Wrap
Text File
|
2010-07-12
|
2KB
|
70 lines
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const ProtocolScheme = "bar";
const Cc = Components.classes;
const Ci = Components.interfaces;
const IOS = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
function YaResProtocolHandler() {
Components.utils.import("resource://yasearch/bar.protocol.jsm", this);
this.ProtocolHandler.scheme = ProtocolScheme;
this._scheme = ProtocolScheme;
}
YaResProtocolHandler.prototype = {
_scheme: "",
get scheme() {
return this._scheme;
},
get protocolFlags() {
return Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD;
},
get defaultPort() {
return -1;
},
allowPort: function YRPH_allowPort(port, scheme) {
return false;
},
newURI: function YRPH_newURI(aSpec, aOriginalCharset, baseURI) {
let uri = this.ProtocolHandler.newURI(aSpec, aOriginalCharset, baseURI);
if (!uri)
throw Components.results.NS_ERROR_MALFORMED_URI;
return uri;
},
newChannel: function YRPH_newChannel(aURI) {
let channel = this.ProtocolHandler.newChannel(aURI);
if (!channel) {
channel = IOS.newChannel("data:,", null, null);
}
channel.originalURI = aURI;
return channel;
},
classDescription: "Yandex.Bar protocol handler",
classID: Components.ID("69a91d28-4b81-11de-97de-eb99b362b158"),
contractID: ("@mozilla.org/network/protocol;1?name=" + ProtocolScheme),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]),
_xpcom_categories: [{
category: "app-startup",
service: true
}]
}
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([YaResProtocolHandler]);
}