Bug 1203159 - Remove DevTools support from webapprt. r=myk

To enable resource://devtools, all DevTools files are consolidated at the app
level.  This means they are no longer available for sharing between multiple XUL
apps, such as browser and webapprt.  We'll need to devise a new method to bring
this support back to webapprt if desired.
This commit is contained in:
J. Ryan Stinnett 2015-10-13 17:23:49 -05:00
parent 74183b63fa
commit a3ba11bca1
9 changed files with 0 additions and 235 deletions

View File

@ -896,7 +896,6 @@ bin/libfreebl_32int64_3.so
@RESPATH@/webapprt/modules/Startup.jsm
@RESPATH@/webapprt/modules/WebappRT.jsm
@RESPATH@/webapprt/modules/WebappManager.jsm
@RESPATH@/webapprt/modules/RemoteDebugger.jsm
@RESPATH@/webapprt/modules/WebRTCHandler.jsm
#endif

View File

@ -21,12 +21,6 @@ CommandLineHandler.prototype = {
createInstance(Ci.nsIWritablePropertyBag);
let inTestMode = this._handleTestMode(cmdLine, args);
let debugPort = this._handleDebugMode(cmdLine);
if (!isNaN(debugPort)) {
Cu.import("resource://webapprt/modules/RemoteDebugger.jsm");
RemoteDebugger.init(debugPort);
}
if (inTestMode) {
// Open the mochitest shim window, which configures the runtime for tests.
Services.ww.openWindow(null,
@ -50,34 +44,6 @@ CommandLineHandler.prototype = {
}
},
/**
* Handle debug command line option.
*
* @param cmdLine A nsICommandLine object.
*
* @returns the port number if it's specified, the default port number if
* the debug option is specified, NaN if the debug option isn't
* specified or the port number isn't valid.
*/
_handleDebugMode: function(cmdLine) {
// -debug [port]
let idx = cmdLine.findFlag("debug", true);
if (idx < 0) {
return NaN;
}
let port;
let portIdx = idx + 1;
if (portIdx < cmdLine.length) {
port = parseInt(cmdLine.getArgument(portIdx));
if (port != NaN) {
return port;
}
}
return Services.prefs.getIntPref('devtools.debugger.remote-port');
},
_handleTestMode: function _handleTestMode(cmdLine, args) {
// -test-mode [url]
let idx = cmdLine.findFlag("test-mode", true);

View File

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = ["RemoteDebugger"];
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var { require } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
var { DebuggerServer } = require("devtools/server/main");
this.RemoteDebugger = {
init: function(port) {
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors("webapprt:webapp");
DebuggerServer.addActors("chrome://webapprt/content/dbg-webapp-actors.js");
}
let listener = DebuggerServer.createListener();
listener.portOrPath = port;
listener.open();
}
}

View File

@ -1,130 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
const { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
const { devtools } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
const { BrowserTabActor, BrowserTabList, allAppShellDOMWindows,
sendShutdownEvent } = devtools.require("devtools/server/actors/webbrowser");
const { RootActor } = devtools.require("devtools/server/actors/root");
/**
* WebappRT-specific actors.
*/
/**
* Construct a root actor appropriate for use in a server running in the webapp
* runtime. The returned root actor:
* - respects the factories registered with DebuggerServer.addGlobalActor,
* - uses a WebappTabList to supply tab actors,
* - sends all webapprt:webapp window documents a Debugger:Shutdown event
* when it exits.
*
* * @param connection DebuggerServerConnection
* The conection to the client.
*/
function createRootActor(connection)
{
let parameters = {
tabList: new WebappTabList(connection),
globalActorFactories: DebuggerServer.globalActorFactories,
onShutdown: sendShutdownEvent
};
return new RootActor(connection, parameters);
}
/**
* A live list of BrowserTabActors representing the current webapp windows,
* to be provided to the root actor to answer 'listTabs' requests. In the
* webapp runtime, only a single tab per window is ever present.
*
* @param connection DebuggerServerConnection
* The connection in which this list's tab actors may participate.
*
* @see BrowserTabList for more a extensive description of how tab list objects
* work.
*/
function WebappTabList(connection)
{
BrowserTabList.call(this, connection);
}
WebappTabList.prototype = Object.create(BrowserTabList.prototype);
WebappTabList.prototype.constructor = WebappTabList;
WebappTabList.prototype.getList = function() {
let topXULWindow = Services.wm.getMostRecentWindow(this._windowType);
// As a sanity check, make sure all the actors presently in our map get
// picked up when we iterate over all windows.
let initialMapSize = this._actorByBrowser.size;
let foundCount = 0;
// To avoid mysterious behavior if windows are closed or opened mid-iteration,
// we update the map first, and then make a second pass over it to yield
// the actors. Thus, the sequence yielded is always a snapshot of the
// actors that were live when we began the iteration.
// Iterate over all webapprt:webapp XUL windows.
for (let win of allAppShellDOMWindows(this._windowType)) {
let browser = win.document.getElementById("content");
if (!browser) {
continue;
}
// Do we have an existing actor for this browser? If not, create one.
let actor = this._actorByBrowser.get(browser);
if (actor) {
foundCount++;
} else {
actor = new WebappTabActor(this._connection, browser);
this._actorByBrowser.set(browser, actor);
}
actor.selected = (win == topXULWindow);
}
if (this._testing && initialMapSize !== foundCount) {
throw Error("_actorByBrowser map contained actors for dead tabs");
}
this._mustNotify = true;
this._checkListening();
return Promise.resolve([actor for ([_, actor] of this._actorByBrowser)]);
};
/**
* Creates a tab actor for handling requests to the single tab, like
* attaching and detaching. WebappTabActor respects the actor factories
* registered with DebuggerServer.addTabActor.
*
* We override the title of the XUL window in content/webapp.js so here
* we need to override the title property to avoid confusion to the user.
* We won't return the title of the contained browser, but the title of
* the webapp window.
*
* @param connection DebuggerServerConnection
* The conection to the client.
* @param browser browser
* The browser instance that contains this tab.
*/
function WebappTabActor(connection, browser)
{
BrowserTabActor.call(this, connection, browser);
}
WebappTabActor.prototype.constructor = WebappTabActor;
WebappTabActor.prototype = Object.create(BrowserTabActor.prototype);
Object.defineProperty(WebappTabActor.prototype, "title", {
get: function() {
return this.browser.ownerDocument.defaultView.document.title;
},
enumerable: true,
configurable: false
});

View File

@ -11,7 +11,6 @@ webapprt.jar:
content/mochitest-shared.js (content/mochitest-shared.js)
content/mochitest.js (content/mochitest.js)
content/mochitest.xul (content/mochitest.xul)
content/dbg-webapp-actors.js (content/dbg-webapp-actors.js)
* content/downloads/downloads.xul (content/downloads/downloads.xul)
content/downloads/downloads.js (content/downloads/downloads.js)
content/downloads/downloads.css (content/downloads/downloads.css)

View File

@ -29,7 +29,6 @@ EXTRA_COMPONENTS += [
EXTRA_JS_MODULES += [
'DownloadView.jsm',
'RemoteDebugger.jsm',
'Startup.jsm',
'WebappManager.jsm',
'WebappRT.jsm',
@ -54,4 +53,3 @@ JAR_MANIFESTS += ['jar.mn']
JS_PREFERENCE_FILES += [
'prefs.js',
]

View File

@ -82,9 +82,6 @@ pref("plugin.allowed_types", " ");
// Suppress the check for outdated plugins from opening a window.
pref("extensions.blocklist.suppressUI", true);
pref("devtools.debugger.remote-enabled", true);
pref("devtools.debugger.force-local", true);
// The default for this pref reflects whether the build is capable of IPC.
// (Turning it on in a no-IPC build will have no effect.)
#ifdef XP_MACOSX

View File

@ -1,34 +0,0 @@
Cu.import("resource://gre/modules/Services.jsm");
var { require } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
var { DebuggerServer } = require("devtools/server/main");
var { DebuggerClient } = require("devtools/shared/client/main");
var { RemoteDebugger } = Cu.import("resource://webapprt/modules/RemoteDebugger.jsm", {});
function test() {
waitForExplicitFinish();
loadWebapp("debugger.webapp", undefined, () => {
RemoteDebugger.init(Services.prefs.getIntPref('devtools.debugger.remote-port'));
let client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(() => {
client.listTabs((aResponse) => {
is(aResponse.tabs[0].title, "Debugger Test Webapp", "Title correct");
is(aResponse.tabs[0].url, "http://test/webapprtChrome/webapprt/test/chrome/debugger.html", "URL correct");
ok(aResponse.tabs[0].consoleActor, "consoleActor set");
ok(aResponse.tabs[0].gcliActor, "gcliActor set");
ok(aResponse.tabs[0].styleEditorActor, "styleEditorActor set");
ok(aResponse.tabs[0].inspectorActor, "inspectorActor set");
ok(aResponse.deviceActor, "deviceActor set");
client.close(() => {
finish();
});
});
});
});
registerCleanupFunction(function() {
DebuggerServer.destroy();
});
}

View File

@ -53,7 +53,6 @@ support-files =
TestApp.app/Contents/MacOS/webapp.ini
[browser_alarm.js]
[browser_debugger.js]
[browser_download.js]
[browser_geolocation-prompt-noperm.js]
[browser_geolocation-prompt-perm.js]