mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 815145 - Remove the JS REPL from shell.js [r=vingtetun]
This commit is contained in:
parent
8692e03c9f
commit
c1e2fc7192
@ -414,10 +414,6 @@ pref("dom.mozTCPSocket.enabled", true);
|
||||
// by bug 710563.
|
||||
pref("layout.frame_rate.precise", true);
|
||||
|
||||
// Temporary remote js console hack
|
||||
pref("b2g.remote-js.enabled", true);
|
||||
pref("b2g.remote-js.port", 9999);
|
||||
|
||||
// Handle hardware buttons in the b2g chrome package
|
||||
pref("b2g.keys.menu.enabled", true);
|
||||
|
||||
|
@ -561,57 +561,6 @@ Services.obs.addObserver(function onBluetoothVolumeChange(subject, topic, data)
|
||||
});
|
||||
}, 'bluetooth-volume-change', false);
|
||||
|
||||
(function Repl() {
|
||||
if (!Services.prefs.getBoolPref('b2g.remote-js.enabled')) {
|
||||
return;
|
||||
}
|
||||
const prompt = 'JS> ';
|
||||
let output;
|
||||
let reader = {
|
||||
onInputStreamReady : function repl_readInput(input) {
|
||||
let sin = Cc['@mozilla.org/scriptableinputstream;1']
|
||||
.createInstance(Ci.nsIScriptableInputStream);
|
||||
sin.init(input);
|
||||
try {
|
||||
let val = eval(sin.read(sin.available()));
|
||||
let ret = (typeof val === 'undefined') ? 'undefined\n' : val + '\n';
|
||||
output.write(ret, ret.length);
|
||||
// TODO: check if socket has been closed
|
||||
} catch (e) {
|
||||
if (e.result === Cr.NS_BASE_STREAM_CLOSED ||
|
||||
(typeof e === 'object' && e.result === Cr.NS_BASE_STREAM_CLOSED)) {
|
||||
return;
|
||||
}
|
||||
let message = (typeof e === 'object') ? e.message + '\n' : e + '\n';
|
||||
output.write(message, message.length);
|
||||
}
|
||||
output.write(prompt, prompt.length);
|
||||
input.asyncWait(reader, 0, 0, Services.tm.mainThread);
|
||||
}
|
||||
}
|
||||
let listener = {
|
||||
onSocketAccepted: function repl_acceptConnection(serverSocket, clientSocket) {
|
||||
dump('Accepted connection on ' + clientSocket.host + '\n');
|
||||
let input = clientSocket.openInputStream(Ci.nsITransport.OPEN_BLOCKING, 0, 0)
|
||||
.QueryInterface(Ci.nsIAsyncInputStream);
|
||||
output = clientSocket.openOutputStream(Ci.nsITransport.OPEN_BLOCKING, 0, 0);
|
||||
output.write(prompt, prompt.length);
|
||||
input.asyncWait(reader, 0, 0, Services.tm.mainThread);
|
||||
},
|
||||
onStopListening: function repl_onStopListening() {
|
||||
if (output) {
|
||||
output.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
let serverPort = Services.prefs.getIntPref('b2g.remote-js.port');
|
||||
let serverSocket = Cc['@mozilla.org/network/server-socket;1']
|
||||
.createInstance(Ci.nsIServerSocket);
|
||||
serverSocket.init(serverPort, true, -1);
|
||||
dump('Opened socket on ' + serverSocket.port + '\n');
|
||||
serverSocket.asyncListen(listener);
|
||||
})();
|
||||
|
||||
var CustomEventManager = {
|
||||
init: function custevt_init() {
|
||||
window.addEventListener("ContentStart", (function(evt) {
|
||||
|
Loading…
Reference in New Issue
Block a user