Closed
Bug 365355
Opened 19 years ago
Closed 19 years ago
unable to get Components.classes['@mozilla.org/thread;1']
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: BijuMailList, Unassigned)
Details
(Please reclassify if this is not proper component)
unable to get Components.classes['@mozilla.org/thread;1'] on
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2pre) Gecko/20061227 Minefield/3.0a2pre
So at Tools > Error Consol FireFTP gives message
Error: Components.classes['@mozilla.org/thread;1'] has no properties
Source File: chrome://fireftp/content/js/connection/dataSocket.js
Line: 5
line is
this.threadService = Components.classes["@mozilla.org/thread;1"].getService (Components.interfaces.nsIThread);
in function ftpDataSocketMozilla(security, proxy, host, port) {}
links
* http://www.xulplanet.com/references/xpcomref/comps/c_thread1.html
Comment 1•19 years ago
|
||
I think this was changed when the threadmanager bug was fixed, see bug 326273.
And see: http://wiki.mozilla.org/XPCOM:nsIThreadManager#nsIThread
Probably the extension needs to be updated if it should work on trunk.
Component: Build Config → XPCOM
Product: Firefox → Core
QA Contact: build.config → xpcom
Comment 2•19 years ago
|
||
Yes, this is a FireFTP bug.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Components.classes["@mozilla.org/event-queue-service;1"] also changed to
Components.classes["@mozilla.org/thread-manager;1"].getService(Components.interfaces.nsIThreadManager);
I dont see any good documentation for changes
Note for extension developers, here how I fixed the issue
==== old code begin ====
function ftpDataSocketMozilla(security, proxy, host, port) {
this.transportService = Components
.classes["@mozilla.org/network/socket-transport-service;1"]
.getService(Components.interfaces.nsISocketTransportService);
this.proxyService = Components
.classes["@mozilla.org/network/protocol-proxy-service;1"]
.getService(Components.interfaces.nsIProtocolProxyService);
this.dnsService = Components
.classes["@mozilla.org/network/dns-service;1"]
.getService(Components.interfaces.nsIDNSService);
this.threadService = Components
.classes["@mozilla.org/thread;1"]
.getService(Components.interfaces.nsIThread);
this.eventQueueService = Components
.classes["@mozilla.org/event-queue-service;1"]
.getService(Components.interfaces.nsIEventQueueService);
this.eventQueue = this.eventQueueService.createFromIThread(this.threadService.currentThread, true);
this.security = security || false;
this.host = host || "";
this.port = port || -1;
this.proxyType = proxy ? proxy.proxyType : "";
this.proxyHost = proxy ? proxy.proxyHost : "";
this.proxyPort = proxy ? proxy.proxyPort : -1;
}
==== old code end ====
changed to
==== new code begin ====
function ftpDataSocketMozilla(security, proxy, host, port) {
var Cc = Components.classes;
var Ci = Components.interfaces;
this.transportService = Cc["@mozilla.org/network/socket-transport-service;1"]
.getService(Ci.nsISocketTransportService);
this.proxyService = Cc["@mozilla.org/network/protocol-proxy-service;1"]
.getService(Ci.nsIProtocolProxyService);
this.dnsService = Cc["@mozilla.org/network/dns-service;1"]
.getService(Ci.nsIDNSService);
// credits to chatzilla code
// at /irc/js/lib/dcc.js
// and /irc/js/lib/utils.js
if("nsIThreadManager" in Ci){
this.threadService = Cc["@mozilla.org/thread-manager;1"].getService();
this.eventQueueService = Cc["@mozilla.org/thread-manager;1"].getService();
this.eventQueue = Cc["@mozilla.org/thread-manager;1"].getService().currentThread;
}else{
this.threadService = Cc["@mozilla.org/thread;1"]
.getService(Ci.nsIThread);
this.eventQueueService = Cc["@mozilla.org/event-queue-service;1"]
.getService(Ci.nsIEventQueueService);
this.eventQueue = this.eventQueueService
.createFromIThread(this.threadService.currentThread, true);
}
this.security = security || false;
this.host = host || "";
this.port = port || -1;
this.proxyType = proxy ? proxy.proxyType : "";
this.proxyHost = proxy ? proxy.proxyHost : "";
this.proxyPort = proxy ? proxy.proxyPort : -1;
}
==== new code end ====
But dont know everything I modified is in right way, but this works.
Comment 4•19 years ago
|
||
It seems like it is on Sheppy's todo list to write some documentation on this:
http://developer.mozilla.org/en/docs/User:Sheppy:To-do_list#Article.28s.29_about_doing_threading_in_JavaScript
You need to log in
before you can comment on or make changes to this bug.
Description
•