[Bbs2ch-cvs 211] [193] nsBbs2chProtocolHandler と nsBbs2chContentHandler を b2rProtocolHandler に統合

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 8月 10日 (金) 00:59:51 JST


Revision: 193
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=193
Author:   flyson
Date:     2007-08-10 00:59:51 +0900 (Fri, 10 Aug 2007)

Log Message:
-----------
nsBbs2chProtocolHandler と nsBbs2chContentHandler を b2rProtocolHandler に統合

Added Paths:
-----------
    trunk/bbs2chreader/components/b2rProtocolHandler.js

Removed Paths:
-------------
    trunk/bbs2chreader/components/nsBbs2chContentHandler.js
    trunk/bbs2chreader/components/nsBbs2chProtocolHandler.js

Added: trunk/bbs2chreader/components/b2rProtocolHandler.js
===================================================================
--- trunk/bbs2chreader/components/b2rProtocolHandler.js	2007-08-07 14:56:11 UTC (rev 192)
+++ trunk/bbs2chreader/components/b2rProtocolHandler.js	2007-08-09 15:59:51 UTC (rev 193)
@@ -0,0 +1,320 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is bbs2chreader.
+ *
+ * The Initial Developer of the Original Code is
+ * flyson.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *    flyson <flyso****@users*****>
+ *
+ * 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
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+const B2R_PROTOCOL_HANDLER_CONTRACTID = "@mozilla.org/network/protocol;1?name=bbs2ch";
+const B2R_PROTOCOL_HANDLER_CID = Components.ID("{e40dcbe9-0d0a-44c2-b135-3b2a2afe8b97}");
+const B2R_PROTOCOL_HANDLER_CNAME = "b2rProtocolHandler js component";
+
+const B2R_CONTENT_HANDLER_CONTRACTID = "@mozilla.org/uriloader/content-handler;1?type=application/x-b2r-command";
+const B2R_CONTENTL_HANDLER_CID = Components.ID("{409FF8BB-32AB-49c7-AD66-8E2BA8530A49}");
+const B2R_CONTENT_HANDLER_CNAME = "b2rContentHandler content handler js component";
+
+
+
+
+function b2rProtocolHandler(){
+	this._ioService = Components.classes["@mozilla.org/network/io-service;1"]
+			.getService(Components.interfaces.nsIIOService);
+}
+
+b2rProtocolHandler.prototype = {
+
+	// ********** メソッド **********
+
+	_redirectChannel: function(aURISpec){
+		var channelURI = this._ioService.newURI(aURISpec, null, null);
+		return this._ioService.newChannelFromURI(channelURI);
+	},
+
+
+	_createStreamChannel: function(aURI, aContentType, aContentCharset){
+		var content = "";
+		var stream = Components.classes["@mozilla.org/io/string-input-stream;1"]
+				.createInstance(Components.interfaces.nsIStringInputStream);
+		stream.setData(content, content.length);
+		var channel = Components.classes["@mozilla.org/network/input-stream-channel;1"]
+				.createInstance(Components.interfaces.nsIInputStreamChannel)
+				.QueryInterface(Components.interfaces.nsIChannel);
+		channel.setURI(aURI);
+		channel.contentStream = stream;
+		channel.contentType = aContentType || "text/plain";
+		channel.contentCharset = aContentCharset || "UTF-8";
+		return channel;
+	},
+
+
+	// ********** implements nsIProtocolHandler **********
+
+	get scheme(){
+		return "bbs2ch";
+	},
+
+
+	get defaultPort(){
+		return -1;
+	},
+
+
+	get protocolFlags(){
+		return Components.interfaces.nsIProtocolHandler.URI_NOAUTH;
+	},
+
+
+	allowPort: function(aPort, aScheme){
+		return false;
+	},
+
+
+	newURI: function(aSpec, aCharset, aBaseURI){
+		var simpleURI = Components.classes["@mozilla.org/network/simple-uri;1"]
+								.createInstance(Components.interfaces.nsIURI);
+
+		if(aBaseURI && aSpec.charAt(0)=="#"){ // アンカー付 URL
+			var baseURISprc = aBaseURI.spec.replace(/#[^\/]+/, "");
+			try{
+				simpleURI.spec = baseURISprc + aSpec;
+			}catch(ex){
+				dump("ERROR: b2rProtocolHandler.newURI : " + aSpec + "\n");
+				return null;
+			}
+		}else{ // 通常 URL
+			try{
+				simpleURI.spec = aSpec;
+			}catch(ex){
+				dump("ERROR: b2rProtocolHandler.newURI : " + aSpec + "\n");
+				return null;
+			}
+		}
+		return simpleURI;
+	},
+
+
+	newChannel: function(aURI){
+		var mode = "";
+		if(aURI.spec.match(/bbs2ch:([\w-]+:?)/)) mode = RegExp.$1;
+
+		var tmpChannel;
+		switch(mode){
+			case "bbsmenu":
+				tmpChannel = this._redirectChannel("chrome://bbs2chreader/content/bbsmenu/page.xul");
+				break;
+			case "subscribe":
+				tmpChannel = this._redirectChannel("chrome://bbs2chreader/content/board/subscribe.xul");
+				break;
+			case "board:":
+				tmpChannel = this._redirectChannel("chrome://bbs2chreader/content/board/page.xul");
+				break;
+			default:
+				tmpChannel = this._createStreamChannel(aURI, "application/x-b2r-command");
+				break;
+		}
+
+		return tmpChannel;
+	},
+
+
+	// ********** ********* implements nsISupports ********** **********
+
+	QueryInterface: function(aIID){
+		if(aIID.equals(Components.interfaces.nsIProtocolHandler)) return this;
+		if(aIID.equals(Components.interfaces.nsISupports)) return this;
+
+		throw Components.results.NS_ERROR_NO_INTERFACE;
+	}
+
+};
+
+
+
+function b2rContentHandler(){
+}
+
+b2rContentHandler.prototype = {
+
+	// ********** implements nsIContentHandler **********
+
+	handleContent: function(aContentType, aWindowContext, aRequest){
+		var channel = aRequest.QueryInterface(Components.interfaces.nsIChannel);
+		var uriSpec = channel.URI.spec;
+		var mode = uriSpec.match(/bbs2ch:(\w+:?)/) ? RegExp.$1 : "";
+		var targetURLSpec = uriSpec.match(/bbs2ch:[^:]+:(.+)/) ? RegExp.$1 : "";
+		if(targetURLSpec && !this._checkOpenURL(targetURLSpec)){
+			return;
+		}
+
+		switch(mode){
+			case "post:": // 書き込みウィザード
+				this._openPostWizaed(targetURLSpec);
+				break;
+			case "void": // 何もしない
+				break;
+			default:
+				break;
+		}
+	},
+
+
+	_openPostWizaed: function(aURLSpec){
+		var argString = Components.classes["@mozilla.org/supports-string;1"]
+				.createInstance(Components.interfaces.nsISupportsString);
+		argString.data = aURLSpec;
+		var winWatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
+				.getService(Components.interfaces.nsIWindowWatcher);
+		winWatcher.openWindow(null, "chrome://bbs2chreader/content/post-wizard.xul",
+				"_blank", "chrome, resizable, dialog", argString);
+	},
+
+
+	_checkOpenURL: function(aURLSpec){
+		var datID = (aURLSpec.match(/\/(\d{9,10})/)) ? RegExp.$1 : null;
+		if(!datID){
+			return false;
+		}
+			// ブラウザウィンドウを列挙
+		var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+								.getService(Components.interfaces.nsIWindowMediator);
+		var browserWinEnu = windowMediator.getEnumerator("navigator:browser");
+		while(browserWinEnu.hasMoreElements()){
+			var browserWin = browserWinEnu.getNext();
+			if(!("gBrowser" in browserWin)) continue;
+			var browserTabLength = browserWin.gBrowser.mTabContainer.childNodes.length;
+			for(let i=0; i<browserTabLength; i++){
+				var currentURLSpec = browserWin.gBrowser.getBrowserAtIndex(i).currentURI.spec;
+				if(currentURLSpec.indexOf(datID) != -1){
+					return true;
+				}
+			}
+		}
+		return false;
+	},
+
+
+	// ********** ********* implements nsISupports ********** **********
+
+	QueryInterface: function(aIID){
+		if(aIID.equals(Components.interfaces.nsIContentHandler)) return this;
+		if(aIID.equals(Components.interfaces.nsISupports)) return this;
+
+		throw Components.results.NS_ERROR_NO_INTERFACE;
+	}
+
+};
+
+
+
+// ********** ********* Component Registration ********** **********
+
+var b2rProtocolHandlerFactory = {
+
+	createInstance: function (aOuter, aIID){
+		if(aOuter != null)
+			throw Components.results.NS_ERROR_NO_AGGREGATION;
+
+		if(aIID.equals(Components.interfaces.nsIProtocolHandler))
+			return new b2rProtocolHandler().QueryInterface(aIID);
+		if(aIID.equals(Components.interfaces.nsISupports))
+			return new b2rProtocolHandler().QueryInterface(aIID);
+
+		throw Components.results.NS_ERROR_INVALID_ARG;
+	}
+
+};
+
+
+var b2rContentHandlerFactory = {
+
+	createInstance: function (aOuter, aIID){
+		if(aOuter != null)
+			throw Components.results.NS_ERROR_NO_AGGREGATION;
+
+		if(aIID.equals(Components.interfaces.nsIContentHandler))
+			return new b2rContentHandler().QueryInterface(aIID);
+		if(aIID.equals(Components.interfaces.nsISupports))
+			return new b2rContentHandler().QueryInterface(aIID);
+
+		throw Components.results.NS_ERROR_INVALID_ARG;
+	}
+
+};
+
+
+var Module = {
+
+	registerSelf: function(aCompMgr, aFileSpec, aLocation, aType){
+		aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+
+		aCompMgr.registerFactoryLocation(
+						B2R_PROTOCOL_HANDLER_CID,
+						B2R_PROTOCOL_HANDLER_CNAME,
+						B2R_PROTOCOL_HANDLER_CONTRACTID,
+						aFileSpec, aLocation, aType);
+
+		aCompMgr.registerFactoryLocation(
+						B2R_CONTENTL_HANDLER_CID,
+						B2R_CONTENT_HANDLER_CNAME,
+						B2R_CONTENT_HANDLER_CONTRACTID,
+						aFileSpec, aLocation, aType);
+	},
+
+
+	unregisterSelf: function(aCompMgr, aFileSpec, aLocation){
+		aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+	},
+
+
+	getClassObject: function(aCompMgr, aCID, aIID){
+		if(aCID.equals(B2R_PROTOCOL_HANDLER_CID)) return b2rProtocolHandlerFactory;
+		if(aCID.equals(B2R_CONTENTL_HANDLER_CID)) return b2rContentHandlerFactory;
+
+		if(!aIID.equals(Components.interfaces.nsIFactory))
+			throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+
+		throw Components.results.NS_ERROR_NO_INTERFACE;
+	},
+
+
+	canUnload: function(aCompMgr){
+		return true;
+	}
+
+};
+
+
+function NSGetModule(aCompMgr, aFileSpec){
+	return Module;
+}
\ No newline at end of file

Deleted: trunk/bbs2chreader/components/nsBbs2chContentHandler.js
===================================================================
--- trunk/bbs2chreader/components/nsBbs2chContentHandler.js	2007-08-07 14:56:11 UTC (rev 192)
+++ trunk/bbs2chreader/components/nsBbs2chContentHandler.js	2007-08-09 15:59:51 UTC (rev 193)
@@ -1,170 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is bbs2chreader.
- *
- * The Initial Developer of the Original Code is
- * flyson.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *    flyson <flyso****@users*****>
- *
- * 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
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-function nsBbs2chContentHandler(){
-}
-
-nsBbs2chContentHandler.prototype = {
-	QueryInterface: function(aIID){
-		if(!aIID.equals(Components.interfaces.nsIContentHandler))
-			throw Components.results.NS_ERROR_NO_INTERFACE;
-		return this;
-	},
-
-
-	// ********** implements nsIContentHandler **********
-
-
-	handleContent: function(aContentType, aWindowContext, aRequest){
-		var channel = aRequest.QueryInterface(Components.interfaces.nsIChannel);
-		var uriSpec = channel.URI.spec;
-		var mode = uriSpec.match(/bbs2ch:(\w+:?)/) ? RegExp.$1 : "";
-		var targetURLSpec = uriSpec.match(/bbs2ch:[^:]+:(.+)/) ? RegExp.$1 : "";
-		if(targetURLSpec && !this._checkOpenURL(targetURLSpec)){
-			return;
-		}
-
-
-		switch(mode){
-			case "post:": // 書き込みウィザード
-				this._openPostWizaed(targetURLSpec);
-				break;
-			case "void": // 何もしない
-				break;
-			default:
-				break;
-		}
-	},
-
-
-	_openPostWizaed: function(aURLSpec){
-		var argString = Components.classes["@mozilla.org/supports-string;1"]
-				.createInstance(Components.interfaces.nsISupportsString);
-		argString.data = aURLSpec;
-		var winWatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
-				.getService(Components.interfaces.nsIWindowWatcher);
-		winWatcher.openWindow(null, "chrome://bbs2chreader/content/post-wizard.xul",
-				"_blank", "chrome, resizable, dialog", argString);
-	},
-
-
-	_checkOpenURL: function(aURLSpec){
-		var datID = (aURLSpec.match(/\/(\d{9,10})/)) ? RegExp.$1 : null;
-		if(!datID){
-			return false;
-		}
-			// ブラウザウィンドウを列挙
-		var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-								.getService(Components.interfaces.nsIWindowMediator);
-		var browserWinEnu = windowMediator.getEnumerator("navigator:browser");
-		while(browserWinEnu.hasMoreElements()){
-			var browserWin = browserWinEnu.getNext();
-			if(!("gBrowser" in browserWin)) continue;
-			var browserTabLength = browserWin.gBrowser.mTabContainer.childNodes.length;
-			for(let i=0; i<browserTabLength; i++){
-				var currentURLSpec = browserWin.gBrowser.getBrowserAtIndex(i).currentURI.spec;
-				if(currentURLSpec.indexOf(datID) != -1){
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-
-}
-
-
-// ********** ********* Component Registration ********** **********
-
-
-var Factory = {
-
-	createInstance: function (aOuter, aIID){
-		if(aOuter != null)
-			throw Components.results.NS_ERROR_NO_AGGREGATION;
-
-		if(aIID.equals(Components.interfaces.nsIContentHandler))
-			return new nsBbs2chContentHandler();
-		if(aIID.equals(Components.interfaces.nsISupports))
-			return new nsBbs2chContentHandler();
-
-		throw Components.results.NS_ERROR_INVALID_ARG;
-	}
-
-}
-
-var Module = {
-
-	CONTRACTID: "@mozilla.org/uriloader/content-handler;1?type=application/x-bbs2ch",
-	CID: Components.ID("{409FF8BB-32AB-49c7-AD66-8E2BA8530A49}"),
-	CNAME: "application/x-bbs2ch content handler",
-
-
-	registerSelf: function(aCompMgr, aFileSpec, aLocation, aType){
-		aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-		aCompMgr.registerFactoryLocation(this.CID, this.CNAME, this.CONTRACTID,
-											aFileSpec, aLocation, aType);
-	},
-
-
-	unregisterSelf: function(aCompMgr, aFileSpec, aLocation){
-		aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-	},
-
-
-	getClassObject: function(aCompMgr, aCID, aIID){
-		if(aCID.equals(this.CID))
-			return Factory;
-
-		if(!aIID.equals(Components.interfaces.nsIFactory))
-			throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
-		throw Components.results.NS_ERROR_NO_INTERFACE;
-	},
-
-
-	canUnload: function(aCompMgr){
-		return true;
-	}
-
-}
-
-
-function NSGetModule(aCompMgr, aFileSpec){
-	return Module;
-}
\ No newline at end of file

Deleted: trunk/bbs2chreader/components/nsBbs2chProtocolHandler.js
===================================================================
--- trunk/bbs2chreader/components/nsBbs2chProtocolHandler.js	2007-08-07 14:56:11 UTC (rev 192)
+++ trunk/bbs2chreader/components/nsBbs2chProtocolHandler.js	2007-08-09 15:59:51 UTC (rev 193)
@@ -1,244 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is bbs2chreader.
- *
- * The Initial Developer of the Original Code is
- * flyson.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *    flyson <flyso****@users*****>
- *
- * 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
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-function nsBbs2chProtocolHandler(){
-	this._ioService = Components.classes["@mozilla.org/network/io-service;1"]
-				.getService(Components.interfaces.nsIIOService);
-	this._subScrLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-				.getService(Components.interfaces.mozIJSSubScriptLoader);
-
-	this._init();
-}
-
-nsBbs2chProtocolHandler.prototype = {
-
-
-	// ********** implements nsIProtocolHandler **********
-
-	scheme: "bbs2ch",
-	defaultPort: -1,
-	protocolFlags: Components.interfaces.nsIProtocolHandler.URI_NOAUTH,
-
-
-	allowPort: function(aPort, aScheme){
-		return false;
-	},
-
-
-	newURI: function(aSpec, aCharset, aBaseURI){
-		var simpleURI = Components.classes["@mozilla.org/network/simple-uri;1"]
-								.createInstance(Components.interfaces.nsIURI);
-
-		if(aBaseURI && aSpec.charAt(0)=="#"){ // アンカー付 URL
-			var baseURISprc = aBaseURI.spec.replace(/#[^\/]+/, "");
-			simpleURI.spec = baseURISprc + aSpec;
-		}else{ // 通常 URL
-			try{
-				simpleURI.spec = aSpec;
-			}catch(ex){
-				dump("ERROR: Bbs2chProtocolHandler.newURI : " + aSpec + "\n");
-			}
-		}
-		return simpleURI;
-	},
-
-
-	newChannel: function(aURI){
-		var mode = "";
-		if(aURI.spec.match(/bbs2ch:([\w-]+:?)/)) mode = RegExp.$1;
-
-		var tmpChannel;
-		switch(mode){
-			case "bbsmenu" :
-				tmpChannel = this._redirectChannel(
-						"chrome://bbs2chreader/content/bbsmenu/page.xul");
-				break;
-			case "subscribe" :
-				tmpChannel = this._redirectChannel(
-						"chrome://bbs2chreader/content/board/subscribe.xul");
-				break;
-			case "board:" :
-				tmpChannel = this._redirectChannel(
-						"chrome://bbs2chreader/content/board/page.xul");
-				break;
-			case "thread:" :
-				tmpChannel = Components.classes["@mozilla.org/bbs2ch-channel;1"]
-									.createInstance(Components.interfaces.nsIBbs2chChannel);
-				tmpChannel.init(aURI, "text/html", "UTF-8", new Bbs2chThread());
-				break;
-			case "board-rss:" :
-				tmpChannel = Components.classes["@mozilla.org/bbs2ch-channel;1"]
-									.createInstance(Components.interfaces.nsIBbs2chChannel);
-				tmpChannel.init(aURI, "text/xml", "UTF-8", new Bbs2chBoardRss());
-				break;
-			default:
-				tmpChannel = new BogusChannel(aURI, "application/x-bbs2ch");
-				break;
-		}
-
-		return tmpChannel;
-	},
-
-
-	// ********** メソッド **********
-
-
-	_init: function(){
-		this._subScrLoader.loadSubScript("chrome://bbs2chreader/content/thread.js");
-		this._subScrLoader.loadSubScript("chrome://bbs2chreader/content/board-rss.js");
-	},
-
-
-	_redirectChannel: function(aURISpec){
-		var channelURI = this._ioService.newURI(aURISpec, null, null);
-		return this._ioService.newChannelFromURI(channelURI);
-	}
-};
-
-
-function BogusChannel(aURI, aContentType){
-	this.URI = aURI;
-	this.originalURI = aURI;
-	this.contentType = aContentType;
-}
-
-BogusChannel.prototype = {
-	QueryInterface: function(aIID){
-		if(aIID.equals(Components.interfaces.nsIChannel))  return this;
-		if(aIID.equals(Components.interfaces.nsIRequest))  return this;
-		if(aIID.equals(Components.interfaces.nsISupports)) return this;
-
-		throw Components.results.NS_ERROR_NO_INTERFACE;
-	},
-
-	loadAttributes: null,
-	contentLength: 0,
-	owner: null,
-	loadGroup: null,
-	notificationCallbacks: null,
-	securityInfo: null,
-	status: Components.results.NS_OK,
-
-	resume: function(){
-		throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-	},
-
-	suspend: function(){
-		throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-	},
-
-	open: function(){
-		throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-	},
-	asyncOpen: function(aObserver, aContext){
-
-		aObserver.onStartRequest(this, aContext);
-	},
-
-	asyncRead: function(aListener, aContext){
-		aListener.onStartRequest(this, aContext);
-	},
-
-	isPending: function(){
-		return true;
-	},
-
-	cancel: function(aStatus){
-		this.status = aStatus;
-	}
-};
-
-
-// ********** ********* Component Registration ********** **********
-
-
-var Factory = {
-
-	createInstance: function (aOuter, aIID){
-		if(aOuter != null)
-			throw Components.results.NS_ERROR_NO_AGGREGATION;
-
-		if(aIID.equals(Components.interfaces.nsIProtocolHandler))
-			return new nsBbs2chProtocolHandler();
-		if(aIID.equals(Components.interfaces.nsISupports))
-			return new nsBbs2chProtocolHandler();
-
-		throw Components.results.NS_ERROR_INVALID_ARG;
-	}
-
-};
-
-var Module = {
-
-	CONTRACTID: "@mozilla.org/network/protocol;1?name=bbs2ch",
-	CID: Components.ID("{e40dcbe9-0d0a-44c2-b135-3b2a2afe8b97}"),
-	CNAME: "bbs2ch protocol handler js component",
-
-	registerSelf: function(aCompMgr, aFileSpec, aLocation, aType){
-		aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-		aCompMgr.registerFactoryLocation(this.CID, this.CNAME, this.CONTRACTID,
-											aFileSpec, aLocation, aType);
-	},
-
-
-	unregisterSelf: function(aCompMgr, aFileSpec, aLocation){
-		aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-	},
-
-
-	getClassObject: function(aCompMgr, aCID, aIID){
-		if(aCID.equals(this.CID))
-			return Factory;
-
-		if(!aIID.equals(Components.interfaces.nsIFactory))
-			throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
-		throw Components.results.NS_ERROR_NO_INTERFACE;
-	},
-
-
-	canUnload: function(aCompMgr){
-		return true;
-	}
-
-};
-
-
-function NSGetModule(aCompMgr, aFileSpec){
-	return Module;
-}
\ No newline at end of file




bbs2ch-cvs メーリングリストの案内
Back to archive index