??????????д??????????????????????selenium????????????????????tab?????????????????????????????????????????selenium?????????????????????????????????????????????????????100????80???????????????????????firefox addon?????socket???????java????????????????????firefox??tabs api????tab????????????????????????!
????????????????socket???????xpcom???
????nsiServerSocket ???????Socket????
????nsiServerSocketListener Socket?????????????????????????onSocketAccepted??onStopListening?????У?onSocketAccepted????????socket?????????onStopListening??????????????????????????????Щ????????????????
????nsiTransport ???????????Щ???????????socket?????е???????????????api???????????nsiServerSocketListener??onSocketAccepted?????ж??socket??????????????????socket?????????????д???????????
?????????????????????????д?????  firefox add-on???????java??????????socket???????????????й???Щ?????ο?????
????https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIServerSocket
????https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIServerSocketListener
????https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsITransport
????https://github.com/icsi-berkeley/fathom/blob/master/src/firefox/modules/ServerSocket.jsm  ?????????github???????fathom????????????????????nsiServerSocketListener??????????????????nsiServerSocket??????
????Cc["@mozilla.org/network/server-socket;1"]
????.createInstance(Ci.nsiServerSocketListener )  ????????????????????????????????????????nsiServerSocketListener?????????????????json?????????onSocketAccepted??onStopListening?????????
??????????????????add-on main.js????????????socket????
????const {Cu??Cc??Ci} = require("chrome");
????var serverSocket = Cc["@mozilla.org/network/server-socket;1"]
????.createInstance(Ci.nsIServerSocket);  //???????socket????<br>serverSocket.init(9638??false??-1);  //????9638???
????????????? cfx run???????????????????е???????9638????????firefox.exe???

??????????????socket????
const nsIServerSocket = Ci.nsIServerSocket;
const nsITransport = Ci.nsITransport;
const nsIScriptableInputStream = Ci.nsIScriptableInputStream;
//????socket??????
var listener = {
onSocketAccepted : function(socket?? transport) {
//?????????????
var input = transport.openInputStream(nsITransport.OPEN_BLOCKING??0??0);
var sin = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(nsIScriptableInputStream);
sin.init(input);
var resp = "";
do {
resp = sin.read(512);
} while (resp == "");
while (sin.available() > 0)
resp += sin.read(512);
console.log(resp);
}??
onStopListening : function(socket?? status){
}
}