Bug 1388552 - Export the HUDService object directly instead of individual methods and properties;r=nchevobbe

MozReview-Commit-ID: 9AYCuqqv1U7

--HG--
extra : rebase_source : 83612fd2c4edfde5c86cfc11a70682cc74ebfa12
This commit is contained in:
Brian Grinstead 2017-08-11 09:07:04 -07:00
Родитель 9130bd250b
Коммит 0262e6e6ac
15 изменённых файлов: 18 добавлений и 32 удалений

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

@ -8367,7 +8367,7 @@ var TabContextMenu = {
Object.defineProperty(this, "HUDService", {
get: function HUDService_getter() {
let devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools;
return devtools.require("devtools/client/webconsole/hudservice");
return devtools.require("devtools/client/webconsole/hudservice").HUDService;
},
configurable: true,
enumerable: true

2
devtools/bootstrap.js поставляемый
Просмотреть файл

@ -304,7 +304,7 @@ function reload(event) {
// HUDService is going to close it on unload.
// Instead we have to manually toggle it.
if (reopenBrowserConsole) {
let HUDService = devtools.require("devtools/client/webconsole/hudservice");
let {HUDService} = devtools.require("devtools/client/webconsole/hudservice");
HUDService.toggleBrowserConsole();
}

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

@ -4,7 +4,7 @@
// Test various GCLI commands
const TEST_URI = "data:text/html;charset=utf-8,gcli-commands";
const HUDService = require("devtools/client/webconsole/hudservice");
const {HUDService} = require("devtools/client/webconsole/hudservice");
// Use the old webconsole since pprint isn't working on new one (Bug 1304794)
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", false);

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

@ -312,7 +312,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
BrowserToolboxProcess.init();
break;
case "browserConsole":
let HUDService = require("devtools/client/webconsole/hudservice");
let {HUDService} = require("devtools/client/webconsole/hudservice");
HUDService.openBrowserConsoleOrFocus();
break;
case "responsiveDesignMode":

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

@ -63,7 +63,7 @@ loader.lazyRequireGetter(this, "ToolboxButtons",
loader.lazyRequireGetter(this, "SourceMapURLService",
"devtools/client/framework/source-map-url-service", true);
loader.lazyRequireGetter(this, "HUDService",
"devtools/client/webconsole/hudservice");
"devtools/client/webconsole/hudservice", true);
loader.lazyRequireGetter(this, "viewSource",
"devtools/client/shared/view-source");

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

@ -92,7 +92,7 @@ exports.menuitems = [
{ id: "menu_browserConsole",
l10nKey: "browserConsoleCmd",
oncommand() {
let HUDService = require("devtools/client/webconsole/hudservice");
let {HUDService} = require("devtools/client/webconsole/hudservice");
HUDService.openBrowserConsoleOrFocus();
},
keyId: "browserConsole",

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

@ -82,7 +82,7 @@ loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/main", true);
loader.lazyRequireGetter(this, "EnvironmentClient", "devtools/shared/client/main", true);
loader.lazyRequireGetter(this, "ObjectClient", "devtools/shared/client/main", true);
loader.lazyRequireGetter(this, "HUDService", "devtools/client/webconsole/hudservice");
loader.lazyRequireGetter(this, "HUDService", "devtools/client/webconsole/hudservice", true);
XPCOMUtils.defineLazyGetter(this, "REMOTE_TIMEOUT", () =>
Services.prefs.getIntPref("devtools.debugger.remote-timeout"));

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

@ -2,7 +2,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const HUDService = require("devtools/client/webconsole/hudservice");
const {HUDService} = require("devtools/client/webconsole/hudservice");
function test()
{

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

@ -693,16 +693,4 @@ BrowserConsole.prototype = extend(WebConsole.prototype, {
});
const HUDService = new HUD_SERVICE();
(() => {
let methods = ["openWebConsole", "openBrowserConsole",
"toggleBrowserConsole", "getOpenWebConsole",
"getBrowserConsole", "getHudByWindow",
"openBrowserConsoleOrFocus", "getHudReferenceById"];
for (let method of methods) {
exports[method] = HUDService[method].bind(HUDService);
}
exports.consoles = HUDService.consoles;
exports.lastFinishedRequest = HUDService.lastFinishedRequest;
})();
exports.HUDService = HUDService;

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

@ -9,7 +9,7 @@
const promise = require("promise");
const defer = require("devtools/shared/defer");
loader.lazyGetter(this, "HUDService", () => require("devtools/client/webconsole/hudservice"));
loader.lazyRequireGetter(this, "HUDService", "devtools/client/webconsole/hudservice", true);
loader.lazyGetter(this, "EventEmitter", () => require("devtools/shared/event-emitter"));
/**

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

@ -12,7 +12,7 @@ Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtool
var {Utils: WebConsoleUtils} = require("devtools/client/webconsole/utils");
var {Messages} = require("devtools/client/webconsole/console-output");
const asyncStorage = require("devtools/shared/async-storage");
const HUDService = require("devtools/client/webconsole/hudservice");
const {HUDService} = require("devtools/client/webconsole/hudservice");
// Services.prefs.setBoolPref("devtools.debugger.log", true);

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

@ -413,9 +413,9 @@ DevToolsStartup.prototype = {
this.initDevTools("CommandLine");
let { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
let hudservice = require("devtools/client/webconsole/hudservice");
let { HUDService } = require("devtools/client/webconsole/hudservice");
let { console } = Cu.import("resource://gre/modules/Console.jsm", {});
hudservice.toggleBrowserConsole().catch(console.error);
HUDService.toggleBrowserConsole().catch(console.error);
} else {
// the Browser Console was already open
window.focus();

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

@ -11,8 +11,6 @@ const {TargetFactory} = require("devtools/client/framework/target");
const {Utils: WebConsoleUtils} =
require("devtools/client/webconsole/utils");
let { gDevTools } = require("devtools/client/framework/devtools");
loader.lazyGetter(this, "HUDService", () => require("devtools/client/webconsole/webconsole"));
loader.lazyGetter(this, "HUDService", () => require("devtools/client/webconsole/hudservice"));
let promise = require("promise");
/**

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

@ -18,8 +18,8 @@ global.initializeBackgroundPage = (contentWindow) => {
if (!alertDisplayedWarning) {
require("devtools/client/framework/devtools-browser");
let hudservice = require("devtools/client/webconsole/hudservice");
hudservice.openBrowserConsoleOrFocus();
let {HUDService} = require("devtools/client/webconsole/hudservice");
HUDService.openBrowserConsoleOrFocus();
contentWindow.console.warn("alert() is not supported in background windows; please use console.log instead.");

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

@ -66,14 +66,14 @@ add_task(async function testAlertNotShownInBackgroundWindow() {
let {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
require("devtools/client/framework/devtools-browser");
let hudservice = require("devtools/client/webconsole/hudservice");
let {HUDService} = require("devtools/client/webconsole/hudservice");
// And then double check that we have an actual browser console.
let haveConsole = !!hudservice.getBrowserConsole();
let haveConsole = !!HUDService.getBrowserConsole();
ok(haveConsole, "Expected browser console to be open");
if (haveConsole) {
await hudservice.toggleBrowserConsole();
await HUDService.toggleBrowserConsole();
}
await extension.unload();