Closed
Bug 1237184
Opened 9 years ago
Closed 7 years ago
Opening a TCP connection does not work in Firefox 43
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: ilian.st.iliev, Unassigned)
References
Details
(Keywords: regression)
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Steps to reproduce:
I am developing a firefox addon based on https://developer.mozilla.org/en-US/Add-ons/SDK. In the add on I am opening a tcp connection, using:
var tcpSocket = Cc["@mozilla.org/tcp-socket;1"].createInstance(Ci.nsIDOMTCPSocket);, where Cc is var {Cc, Ci, Cu} = require("chrome");
This approach was working and I was sending and receiving messaging, using Firefox 40. On 5 January 2016 I have updated my Firefox version to 43 and it stoped working.
Cc["@mozilla.org/tcp-socket;1"] is undefined and there is no such property (@mozilla.org/tcp-socket;1) in Cc.
Actual results:
Property @mozilla.org/tcp-socket;1 does not exist anymore in Cc (Components.classes) and I am not able to open tcp connection
Comment 1•9 years ago
|
||
Comment 2•9 years ago
|
||
You can just use the global TCPSocket constructor, no?
Flags: needinfo?(ilian.st.iliev)
Reporter | ||
Comment 3•9 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #2)
> You can just use the global TCPSocket constructor, no?
I can't find this TCPSocket. Where is it? I want to open pure TCP Connection in an addon.
Flags: needinfo?(ilian.st.iliev)
Updated•9 years ago
|
Component: Untriaged → DOM: Device Interfaces
Product: Firefox → Core
Comment 4•9 years ago
|
||
Bug 1207090 exposed the TCPSocket constructor to the global scope of code running with chrome privileges. Alexandre, do you know what's required to obtain this constructor from Addon SDK code?
Flags: needinfo?(poirot.alex)
Reporter | ||
Comment 5•9 years ago
|
||
I still can't can this working in the add on.
I am trying to import:
Components.utils.import("chrome://mochitests/content/chrome/dom/network/tests/tcpsocket_test.jsm");,
but it throws an exception:
Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXPCComponents_Utils.import]
I found this in Bug 1207090: https://bugzilla.mozilla.org/show_bug.cgi?id=1207090, which Josh Matthews mentioned.
Thank you for the help.
Comment 6•9 years ago
|
||
Look at this changeset, this is how we fixed TCPSocket support for 43:
https://github.com/ochameau/adbhelper/commit/ebd3ce6562006b9ade8722d19e24a89faff41bd5
See the createWebSocket() helper function.
Once you get a working TCPSocket constructor, note that there is also slight modification in the API.
See `USE_PACKET_BUFFER` variable. Some packet object now have a `buffer` attribute that ack like what you used to receive as packet object, before 43.
Flags: needinfo?(poirot.alex)
Reporter | ||
Comment 7•9 years ago
|
||
Thank you, it works perfect.
Comment 8•8 years ago
|
||
Hi,
is there any description how should this function be used today after the changes? Does it still work in some form in current versions? I checked the solution by Alexandre Poirot but its somehow not self explanatory what should be changed to get it working. Fyi, this was the code i tried to use:
http://stackoverflow.com/questions/40591716/open-tcp-connection-if-ff-49
Comment 9•8 years ago
|
||
The answer in that SO question contains the suggested way of using the TCPSocket API.
Comment 10•8 years ago
|
||
Wouldnt it be possible just to give a working code example? The suggested github repo is too much, im only beginning with addon development. It would be nice to have this documented in a reproducable way.
Comment 11•7 years ago
|
||
Addon SDK has been removed, so this API is no longer accessible via addons. Marking incomplete.
Feel free to reopen if this is still a problem in chrome code (as this API is now basically ChromeOnly), though I'm only seeing it used in tests and one place in Mortar.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•