Bug 1286281 - Part 7: Add WebSocket transport option to chrome debugger server r=jryans

MozReview-Commit-ID: 3gkcU2Zl8Pq
This commit is contained in:
Jarda Snajdr 2016-08-01 08:00:00 -07:00
Родитель 2fb63ed807
Коммит 3d501e4ccf
3 изменённых файлов: 26 добавлений и 20 удалений

Просмотреть файл

@ -141,8 +141,11 @@ BrowserToolboxProcess.prototype = {
let chromeDebuggingPort =
Services.prefs.getIntPref("devtools.debugger.chrome-debugging-port");
let chromeDebuggingWebSocket =
Services.prefs.getBoolPref("devtools.debugger.chrome-debugging-websocket");
let listener = this.debuggerServer.createListener();
listener.portOrPath = chromeDebuggingPort;
listener.webSocket = chromeDebuggingWebSocket;
listener.open();
dumpn("Finished initializing the chrome toolbox server.");

Просмотреть файл

@ -25,7 +25,8 @@ var { Task } = require("devtools/shared/task");
*/
var Prefs = new PrefsHelper("devtools.debugger", {
chromeDebuggingHost: ["Char", "chrome-debugging-host"],
chromeDebuggingPort: ["Int", "chrome-debugging-port"]
chromeDebuggingPort: ["Int", "chrome-debugging-port"],
chromeDebuggingWebSocket: ["Bool", "chrome-debugging-websocket"],
});
var gToolbox, gClient;
@ -35,27 +36,28 @@ var connect = Task.async(function*() {
// Initiate the connection
let transport = yield DebuggerClient.socketConnect({
host: Prefs.chromeDebuggingHost,
port: Prefs.chromeDebuggingPort
port: Prefs.chromeDebuggingPort,
webSocket: Prefs.chromeDebuggingWebSocket,
});
gClient = new DebuggerClient(transport);
gClient.connect().then(() => {
let addonID = getParameterByName("addonID");
yield gClient.connect();
let addonID = getParameterByName("addonID");
if (addonID) {
gClient.listAddons(({addons}) => {
let addonActor = addons.filter(addon => addon.id === addonID).pop();
openToolbox({
form: addonActor,
chrome: true,
isTabActor: addonActor.isWebExtension ? true : false
});
});
} else {
gClient.getProcess().then(aResponse => {
openToolbox({ form: aResponse.form, chrome: true });
});
}
});
if (addonID) {
let { addons } = yield gClient.listAddons();
let addonActor = addons.filter(addon => addon.id === addonID).pop();
openToolbox({
form: addonActor,
chrome: true,
isTabActor: addonActor.isWebExtension ? true : false
});
} else {
let response = yield gClient.getProcess();
openToolbox({
form: response.form,
chrome: true
});
}
});
// Certain options should be toggled since we can assume chrome debugging here
@ -77,7 +79,7 @@ window.addEventListener("load", function() {
connect().catch(e => {
let errorMessageContainer = document.getElementById("error-message-container");
let errorMessage = document.getElementById("error-message");
errorMessage.value = e;
errorMessage.value = e.message || e;
errorMessageContainer.hidden = false;
console.error(e);
});

Просмотреть файл

@ -81,6 +81,7 @@ pref("devtools.responsiveUI.no-reload-notification", false);
pref("devtools.debugger.enabled", true);
pref("devtools.debugger.chrome-debugging-host", "localhost");
pref("devtools.debugger.chrome-debugging-port", 6080);
pref("devtools.debugger.chrome-debugging-websocket", false);
pref("devtools.debugger.remote-host", "localhost");
pref("devtools.debugger.remote-timeout", 20000);
pref("devtools.debugger.pause-on-exceptions", false);