-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* TelnetProtocol.js : use XPCOMUtils.jsm instead and Fx4/Gecko 2 issues.
* chrome.manifest: Chrome registration for Gecko 2. * install.rdf: version up (0.2.1), Compatibility change: 3.6.* -> 4.0b5pre.
- Loading branch information
sst.dreams
committed
Aug 29, 2010
1 parent
ee643a8
commit f659e1a
Showing
3 changed files
with
35 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
* Contributor(s): | ||
* Darin Fisher <[email protected]> | ||
* Doron Rosenberg <[email protected]> | ||
* Hong Jen Yee (PCMan) <[email protected]> | ||
* Hsiao-Ting Yu <[email protected]> | ||
* | ||
* Alternatively, the contents of this file may be used under the terms of | ||
* either the GNU General Public License Version 2 or later (the "GPL"), or | ||
|
@@ -35,15 +37,8 @@ | |
* | ||
* ***** END LICENSE BLOCK ***** */ | ||
|
||
// Modified by Hong Jen Yee (PCMan) <[email protected]> on 2009-11-23 to be | ||
// used in PCMan firefox extension. | ||
|
||
// Test protocol related | ||
const kSCHEME = "telnet"; | ||
const kPROTOCOL_NAME = "Telnet Protocol"; | ||
const kPROTOCOL_CONTRACTID = "@mozilla.org/network/protocol;1?name=" + kSCHEME; | ||
const kPROTOCOL_CID = Components.ID("5FAF83FD-708D-45c0-988B-C7404FB25376"); | ||
|
||
// Mozilla defined | ||
const kSIMPLEURI_CONTRACTID = "@mozilla.org/network/simple-uri;1"; | ||
const kSTANDARDURL_CONTRACTID = "@mozilla.org/network/standard-url;1"; | ||
|
@@ -54,34 +49,31 @@ const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler; | |
const nsIURI = Components.interfaces.nsIURI; | ||
const nsIStandardURL = Components.interfaces.nsIStandardURL; | ||
|
||
// Compatiblity notice: 1.9+ only | ||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); | ||
|
||
function Protocol() | ||
{ | ||
} | ||
|
||
Protocol.prototype = | ||
{ | ||
QueryInterface: function(iid) | ||
{ | ||
if (!iid.equals(nsIProtocolHandler) && | ||
!iid.equals(nsISupports)) | ||
throw Components.results.NS_ERROR_NO_INTERFACE; | ||
return this; | ||
}, | ||
|
||
classDescription: "Telnet protocol support for BBS", | ||
classID: Components.ID("5FAF83FD-708D-45c0-988B-C7404FB25376"), | ||
contractID: "@mozilla.org/network/protocol;1?name="+ kSCHEME, | ||
QueryInterface: XPCOMUtils.generateQI([nsIProtocolHandler]), | ||
scheme: kSCHEME, | ||
defaultPort: 23, | ||
protocolFlags: nsIProtocolHandler.URI_NORELATIVE | | ||
nsIProtocolHandler.URI_NOAUTH | | ||
nsIProtocolHandler.URI_LOADABLE_BY_ANYONE | | ||
nsIProtocolHandler.URI_NON_PERSISTABLE, // We can not save URL from telnet :D | ||
|
||
allowPort: function(port, scheme) | ||
{ | ||
allowPort: function(port, scheme) { | ||
return false; | ||
}, | ||
|
||
newURI: function(spec, charset, baseURI) | ||
{ | ||
newURI: function(spec, charset, baseURI) { | ||
// for nsStandardURL test - http://groups.google.com.tw/group/pcmanfx/browse_thread/thread/ec757aa8c73b1432# | ||
// Parameters: | ||
// * aUrlType: URLTYPE_AUTHORITY will always convert telnet:, telnet:/, telnet://, telnet:/// to telnet:// | ||
|
@@ -95,8 +87,7 @@ Protocol.prototype = | |
return cleanURI; | ||
}, | ||
|
||
newChannel: function(aURI) | ||
{ | ||
newChannel: function(aURI) { | ||
/* create dummy nsIURI and nsIChannel instances */ | ||
var ios = Components.classes[kIOSERVICE_CONTRACTID] | ||
.getService(nsIIOService); | ||
|
@@ -105,59 +96,11 @@ Protocol.prototype = | |
}, | ||
} | ||
|
||
var ProtocolFactory = new Object(); | ||
|
||
ProtocolFactory.createInstance = function (outer, iid) | ||
{ | ||
if (outer != null) | ||
throw Components.results.NS_ERROR_NO_AGGREGATION; | ||
|
||
if (!iid.equals(nsIProtocolHandler) && | ||
!iid.equals(nsISupports)) | ||
throw Components.results.NS_ERROR_NO_INTERFACE; | ||
|
||
return new Protocol(); | ||
} | ||
|
||
|
||
/** | ||
* JS XPCOM component registration goop: | ||
* | ||
* We set ourselves up to observe the xpcom-startup category. This provides | ||
* us with a starting point. | ||
*/ | ||
|
||
var ThisModule = new Object(); | ||
|
||
ThisModule.registerSelf = function (compMgr, fileSpec, location, type) | ||
{ | ||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); | ||
compMgr.registerFactoryLocation(kPROTOCOL_CID, | ||
kPROTOCOL_NAME, | ||
kPROTOCOL_CONTRACTID, | ||
fileSpec, | ||
location, | ||
type); | ||
} | ||
|
||
ThisModule.getClassObject = function (compMgr, cid, iid) | ||
{ | ||
if (!cid.equals(kPROTOCOL_CID)) | ||
throw Components.results.NS_ERROR_NO_INTERFACE; | ||
|
||
if (!iid.equals(Components.interfaces.nsIFactory)) | ||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED; | ||
|
||
return ProtocolFactory; | ||
// Use NSGetFactory for Firefox 4 / Gecko 2 | ||
// https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0 | ||
if (XPCOMUtils.generateNSGetFactory) { | ||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([Protocol]); | ||
} else { | ||
var NSGetModule = XPCOMUtils.generateNSGetModule([Protocol]); | ||
} | ||
|
||
ThisModule.canUnload = function (compMgr) | ||
{ | ||
return true; | ||
} | ||
|
||
function NSGetModule(compMgr, fileSpec) | ||
{ | ||
return ThisModule; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
<Description about="urn:mozilla:install-manifest"> | ||
<em:id>[email protected]</em:id> | ||
<em:version>0.2.0</em:version> | ||
<em:version>0.2.1</em:version> | ||
<em:type>2</em:type> | ||
|
||
<!-- Target Application this extension can install into, | ||
|
@@ -14,7 +14,7 @@ | |
<Description> | ||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> | ||
<em:minVersion>3.5</em:minVersion> | ||
<em:maxVersion>3.6.*</em:maxVersion> | ||
<em:maxVersion>4.0b5pre</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
|
||
|
@@ -24,27 +24,30 @@ | |
<em:creator>洪任諭 (Hong Jen Yee) <[email protected]></em:creator> | ||
<em:developer>bootleq <[email protected]></em:developer> | ||
<em:developer>呂康豪 (Kang Hao Lu) <http://dig.csail.mit.edu/People/kennyluck#I></em:developer> | ||
<em:developer>littlebtc <http://blog.littleb.tc/></em:developer> | ||
<em:homepageURL>http://code.google.com/p/pcmanfx/</em:homepageURL> | ||
|
||
<em:localized> | ||
<Description> | ||
<em:locale>zh-TW</em:locale> | ||
<em:name>PCMan Firefox 擴充套件</em:name> | ||
<em:description>專為 BBS 瀏覽設計,採 GNU/GPL 授權的 telnet 連線程式套件</em:description> | ||
<em:creator>洪任諭 <[email protected]></em:creator> | ||
<em:developer>bootleq <[email protected]></em:developer> | ||
<em:developer>呂康豪 <http://dig.csail.mit.edu/People/kennyluck#I></em:developer> | ||
<em:description>專為 BBS 瀏覽設計,採 GNU/GPL 授權的 telnet 連線程式套件</em:description> | ||
<em:creator>洪任諭 <[email protected]></em:creator> | ||
<em:developer>bootleq <[email protected]></em:developer> | ||
<em:developer>呂康豪 <http://dig.csail.mit.edu/People/kennyluck#I></em:developer> | ||
<em:developer>littlebtc <http://blog.littleb.tc/></em:developer> | ||
</Description> | ||
</em:localized> | ||
|
||
<em:localized> | ||
<Description> | ||
<em:locale>zh-CN</em:locale> | ||
<em:name>PCMan Firefox 扩充</em:name> | ||
<em:description>专为 BBS 浏览设计,采 GNU/GPL 授权的 telnet 程序套件</em:description> | ||
<em:creator>洪任谕 <[email protected]></em:creator> | ||
<em:developer>bootleq <[email protected]></em:developer> | ||
<em:developer>吕康豪 <http://dig.csail.mit.edu/People/kennyluck#I></em:developer> | ||
<em:description>专为 BBS 浏览设计,采 GNU/GPL 授权的 telnet 程序套件</em:description> | ||
<em:creator>洪任谕 <[email protected]></em:creator> | ||
<em:developer>bootleq <[email protected]></em:developer> | ||
<em:developer>吕康豪 <http://dig.csail.mit.edu/People/kennyluck#I></em:developer> | ||
<em:developer>littlebtc <http://blog.littleb.tc/></em:developer> | ||
</Description> | ||
</em:localized> | ||
|
||
|