Bug 952214 - Re-enable webapps actor mochitest on b2g desktop and cover shell.js debugger server initialization. r=paul

This commit is contained in:
Alexandre Poirot 2014-01-13 08:44:47 -05:00
Родитель 423ecdb421
Коммит 07aa4e33c8
6 изменённых файлов: 44 добавлений и 19 удалений

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

@ -1102,6 +1102,9 @@ let RemoteDebugger = {
"/data/local/debugger-socket"; "/data/local/debugger-socket";
try { try {
DebuggerServer.openListener(path); DebuggerServer.openListener(path);
// Temporary event, until bug 942756 lands and offer a way to know
// when the server is up and running
Services.obs.notifyObservers(null, 'debugger-server-started', null);
this._running = true; this._running = true;
} catch (e) { } catch (e) {
dump('Unable to start debugger server: ' + e + '\n'); dump('Unable to start debugger server: ' + e + '\n');

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

@ -676,7 +676,6 @@
"layout/generic/test/test_plugin_clipping.xhtml": "Bug 931116, b2g desktop specific, initial triage", "layout/generic/test/test_plugin_clipping.xhtml": "Bug 931116, b2g desktop specific, initial triage",
"layout/generic/test/test_plugin_clipping2.xhtml": "Bug 931116, b2g desktop specific, initial triage", "layout/generic/test/test_plugin_clipping2.xhtml": "Bug 931116, b2g desktop specific, initial triage",
"layout/generic/test/test_plugin_clipping_table.xhtml": "Bug 931116, b2g desktop specific, initial triage", "layout/generic/test/test_plugin_clipping_table.xhtml": "Bug 931116, b2g desktop specific, initial triage",
"layout/generic/test/test_plugin_clipping_transformed.xhtml": "Bug 931116, b2g desktop specific, initial triage", "layout/generic/test/test_plugin_clipping_transformed.xhtml": "Bug 931116, b2g desktop specific, initial triage"
"toolkit/devtools/apps/tests/test_webapps_actor.html": "Bug 931116, b2g desktop specific, initial triage"
} }
} }

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

@ -14,20 +14,36 @@ const { Services } = Cu.import("resource://gre/modules/Services.jsm");
let gClient, gActor; let gClient, gActor;
function connect(onDone) { function connect(onDone) {
// Initialize a loopback remote protocol connection
DebuggerServer.init(function () { return true; });
// We need to register browser actors to have `listTabs` working
// and also have a root actor
if (Services.appinfo.name == "B2G") { if (Services.appinfo.name == "B2G") {
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webbrowser.js"); // On b2g, we try to exercice the code that launches the production debugger server
DebuggerServer.addActors('chrome://browser/content/dbg-browser-actors.js'); let settingsService = Cc["@mozilla.org/settingsService;1"].getService(Ci.nsISettingsService);
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webapps.js"); settingsService.createLock().set("devtools.debugger.remote-enabled", true, null);
} else { // We can't use `set` callback as it is fired before shell.js code listening for this setting
// is actually called. Same thing applies to mozsettings-changed obs notification.
// So listen to a custom event until bug 942756 lands
let observer = {
observe: function (subject, topic, data) {
Services.obs.removeObserver(observer, "debugger-server-started");
let transport = debuggerSocketConnect("127.0.0.1", 6000);
startClient(transport, onDone);
}
};
Services.obs.addObserver(observer, "debugger-server-started", false);
} else {
// Initialize a loopback remote protocol connection
DebuggerServer.init(function () { return true; });
// We need to register browser actors to have `listTabs` working
// and also have a root actor
DebuggerServer.addBrowserActors(); DebuggerServer.addBrowserActors();
} let transport = DebuggerServer.connectPipe();
startClient(transport, onDone);
}
}
function startClient(transport, onDone) {
// Setup client and actor used in all tests // Setup client and actor used in all tests
gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient = new DebuggerClient(transport);
gClient.connect(function onConnect() { gClient.connect(function onConnect() {
gClient.listTabs(function onListTabs(aResponse) { gClient.listTabs(function onListTabs(aResponse) {
gActor = aResponse.webappsActor; gActor = aResponse.webappsActor;

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

@ -75,7 +75,9 @@ var steps = [
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
set: [["dom.mozBrowserFramesEnabled", true], set: [["dom.mozBrowserFramesEnabled", true],
["security.apps.privileged.CSP.default", ["security.apps.privileged.CSP.default",
"default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'"] "default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'"],
["devtools.debugger.unix-domain-socket", 6000],
["devtools.debugger.prompt-connection", false]
] ]
}, next); }, next);
}, },

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

@ -5,10 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; "use strict";
const Ci = Components.interfaces; var Ci = Components.interfaces;
const Cc = Components.classes; var Cc = Components.classes;
const Cu = Components.utils; var Cu = Components.utils;
const Cr = Components.results; var Cr = Components.results;
// On B2G scope object misbehaves and we have to bind globals to `this`
// in order to ensure theses variable to be visible in transport.js
this.Ci = Ci;
this.Cc = Cc;
this.Cu = Cu;
this.Cr = Cr;
this.EXPORTED_SYMBOLS = ["DebuggerTransport", this.EXPORTED_SYMBOLS = ["DebuggerTransport",
"DebuggerClient", "DebuggerClient",

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

@ -35,7 +35,6 @@ Cu.import("resource://gre/modules/devtools/DevToolsUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let wantLogging = Services.prefs.getBoolPref("devtools.debugger.log"); let wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
const promptConnections = Services.prefs.getBoolPref("devtools.debugger.prompt-connection");
Cu.import("resource://gre/modules/jsdebugger.jsm"); Cu.import("resource://gre/modules/jsdebugger.jsm");
addDebuggerToGlobal(this); addDebuggerToGlobal(this);
@ -513,7 +512,7 @@ var DebuggerServer = {
onSocketAccepted: onSocketAccepted:
makeInfallible(function DS_onSocketAccepted(aSocket, aTransport) { makeInfallible(function DS_onSocketAccepted(aSocket, aTransport) {
if (promptConnections && !this._allowConnection()) { if (Services.prefs.getBoolPref("devtools.debugger.prompt-connection") && !this._allowConnection()) {
return; return;
} }
dumpn("New debugging connection on " + aTransport.host + ":" + aTransport.port); dumpn("New debugging connection on " + aTransport.host + ":" + aTransport.port);