Merge pull request #363 from saneyuki/io

Call Services.io directly.
This commit is contained in:
YUKI "Piro" Hiroshi 2012-09-17 09:20:01 -07:00
commit b6ec11c81e
3 changed files with 7 additions and 18 deletions

View File

@ -33,10 +33,8 @@
* *
* ***** END LICENSE BLOCK ******/ * ***** END LICENSE BLOCK ******/
const IOService = Components.classes['@mozilla.org/network/io-service;1']
.getService(Components.interfaces.nsIIOService);
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm'); Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
Components.utils.import('resource://gre/modules/Services.jsm');
function AboutGroup() function AboutGroup()
{ {
@ -49,7 +47,7 @@ AboutGroup.prototype = {
newChannel : function(aURI) newChannel : function(aURI)
{ {
return IOService.newChannel('chrome://treestyletab/content/group.xul', null, null); return Services.io.newChannel('chrome://treestyletab/content/group.xul', null, null);
}, },
getURIFlags : function(aURI) getURIFlags : function(aURI)

View File

@ -48,7 +48,6 @@ const SSS = Cc['@mozilla.org/content/style-sheet-service;1']
.getService(Ci.nsIStyleSheetService); .getService(Ci.nsIStyleSheetService);
const SecMan = Cc['@mozilla.org/scriptsecuritymanager;1'] const SecMan = Cc['@mozilla.org/scriptsecuritymanager;1']
.getService(Ci.nsIScriptSecurityManager); .getService(Ci.nsIScriptSecurityManager);
const IOService = Services.io;
function TabbarDNDObserver(aTabBrowser) function TabbarDNDObserver(aTabBrowser)
{ {
@ -1151,7 +1150,7 @@ catch(e) {
.split('\n')[0]]; .split('\n')[0]];
case 'application/x-moz-file': case 'application/x-moz-file':
let fileHandler = IOService.getProtocolHandler('file') let fileHandler = Services.io.getProtocolHandler('file')
.QueryInterface(Ci.nsIFileProtocolHandler); .QueryInterface(Ci.nsIFileProtocolHandler);
return [fileHandler.getURLSpecFromFile(aData)]; return [fileHandler.getURLSpecFromFile(aData)];
} }

View File

@ -276,14 +276,6 @@ var TreeStyleTabUtils = {
}, },
_SessionStore : null, _SessionStore : null,
get IOService() {
if (!this._IOService) {
this._IOService = Services.io;
}
return this._IOService;
},
_IOService : null,
get WindowMediator() { get WindowMediator() {
if (!this._WindowMediator) { if (!this._WindowMediator) {
this._WindowMediator = Services.wm; this._WindowMediator = Services.wm;
@ -1141,13 +1133,13 @@ var TreeStyleTabUtils = {
var newURI; var newURI;
aURI = aURI || ''; aURI = aURI || '';
if (aURI && String(aURI).indexOf('file:') == 0) { if (aURI && String(aURI).indexOf('file:') == 0) {
var fileHandler = this.IOService.getProtocolHandler('file').QueryInterface(Ci.nsIFileProtocolHandler); var fileHandler = Services.io.getProtocolHandler('file').QueryInterface(Ci.nsIFileProtocolHandler);
var tempLocalFile = fileHandler.getFileFromURLSpec(aURI); var tempLocalFile = fileHandler.getFileFromURLSpec(aURI);
newURI = this.IOService.newFileURI(tempLocalFile); newURI = Services.io.newFileURI(tempLocalFile);
} }
else { else {
if (!/^\w+\:/.test(aURI)) aURI = 'http://'+aURI; if (!/^\w+\:/.test(aURI)) aURI = 'http://'+aURI;
newURI = this.IOService.newURI(aURI, null, null); newURI = Services.io.newURI(aURI, null, null);
} }
return newURI; return newURI;
}, },