From 718284625b1353de7fe96f8fb3b9f84137244368 Mon Sep 17 00:00:00 2001 From: piro Date: Sat, 3 Jul 2010 01:43:40 +0000 Subject: [PATCH] =?UTF-8?q?Minefield=204.0b2pre=E3=81=A7treestyletab-group?= =?UTF-8?q?=E3=82=92=E4=BD=BF=E3=81=88=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6831 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- chrome.manifest | 4 ++ components/AboutGroup.js | 85 +++++----------------------------------- 2 files changed, 13 insertions(+), 76 deletions(-) diff --git a/chrome.manifest b/chrome.manifest index d7d7628e..507a2297 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -41,3 +41,7 @@ override chrome://treestyletab/skin/sidebar/inactive.css chrome://treestyletab/s override chrome://treestyletab/skin/config.css chrome://treestyletab/skin/config-3.7.png appversion>=3.7a1pre resource treestyletab-modules modules/ + +component {305122d0-5bdc-11de-8a39-0800200c9a66} components/AboutGroup.js +contract @mozilla.org/network/protocol/about;1?what=treestyletab-group {305122d0-5bdc-11de-8a39-0800200c9a66} +category profile-after-change about:treestyletab-group handler,@mozilla.org/network/protocol/about;1?what=treestyletab-group diff --git a/components/AboutGroup.js b/components/AboutGroup.js index 35bd8cf9..00dea7ca 100644 --- a/components/AboutGroup.js +++ b/components/AboutGroup.js @@ -36,6 +36,8 @@ const IOService = Components.classes['@mozilla.org/network/io-service;1'] .getService(Components.interfaces.nsIIOService); +Components.utils.import('resource://gre/modules/XPCOMUtils.jsm'); + function AboutGroup() { } @@ -51,14 +53,6 @@ AboutGroup.prototype = { return Components.ID('{305122d0-5bdc-11de-8a39-0800200c9a66}'); }, - QueryInterface : function(aIID) - { - if (!aIID.equals(Components.interfaces.nsIAboutModule) && - !aIID.equals(Components.interfaces.nsISupports)) - throw Components.results.NS_ERROR_NO_INTERFACE; - return this; - }, - newChannel : function(aURI) { return IOService.newChannel('chrome://treestyletab/content/group.xul', null, null); @@ -67,73 +61,12 @@ AboutGroup.prototype = { getURIFlags : function(aURI) { return 0; - } + }, + + QueryInterface : XPCOMUtils.generateQI([Components.interfaces.nsIAboutModule]) }; - -var gModule = { - _firstTime: true, - - registerSelf : function (aComponentManager, aFileSpec, aLocation, aType) - { - if (this._firstTime) { - this._firstTime = false; - throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN; - } - aComponentManager = aComponentManager.QueryInterface(Components.interfaces.nsIComponentRegistrar); - for (var key in this._objects) { - var obj = this._objects[key]; - aComponentManager.registerFactoryLocation(obj.CID, obj.className, obj.contractID, aFileSpec, aLocation, aType); - } - }, - - unregisterSelf : function (aComponentManager, aFileSpec, aLocation) - { - aComponentManager = aComponentManager.QueryInterface(Components.interfaces.nsIComponentRegistrar); - for (var key in this._objects) { - var obj = this._objects[key]; - aComponentManager.unregisterFactoryLocation(obj.CID, aFileSpec); - - categoryManager.deleteCategoryEntry('content-policy', obj.contractID, true); - } - }, - - getClassObject : function (aComponentManager, aCID, aIID) - { - if (!aIID.equals(Components.interfaces.nsIFactory)) - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - - for (var key in this._objects) { - if (aCID.equals(this._objects[key].CID)) - return this._objects[key].factory; - } - - throw Components.results.NS_ERROR_NO_INTERFACE; - }, - - _objects : { - manager : { - CID : AboutGroup.prototype.classID, - contractID : AboutGroup.prototype.contractID, - className : AboutGroup.prototype.classDescription, - factory : { - createInstance : function (aOuter, aIID) - { - if (aOuter != null) - throw Components.results.NS_ERROR_NO_AGGREGATION; - return (new AboutGroup()).QueryInterface(aIID); - } - } - } - }, - - canUnload : function (aComponentManager) - { - return true; - } -}; - -function NSGetModule(compMgr, fileSpec) -{ - return gModule; -} +if (XPCOMUtils.generateNSGetFactory) + var NSGetFactory = XPCOMUtils.generateNSGetFactory([AboutGroup]); +else + var NSGetModule = XPCOMUtils.generateNSGetModule([AboutGroup]);