Bug 1513565 - Convert the last manually instantiated fronts to target.getFront. r=yulia

Depends on D14279

Differential Revision: https://phabricator.services.mozilla.com/D14280

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2018-12-18 23:35:59 +00:00
Родитель ac13c87f42
Коммит 21e7072949
8 изменённых файлов: 12 добавлений и 11 удалений

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

@ -30,7 +30,7 @@ CanvasDebuggerPanel.prototype = {
open: async function() {
this.panelWin.gToolbox = this._toolbox;
this.panelWin.gTarget = this.target;
this.panelWin.gFront = new CanvasFront(this.target.client, this.target.form);
this.panelWin.gFront = await this.target.getFront("canvas");
await this.panelWin.startupCanvasDebugger();

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

@ -18,3 +18,4 @@ class CallWatcherFront extends protocol.FrontClassWithSpec(callWatcherSpec) {
}
}
exports.CallWatcherFront = CallWatcherFront;
protocol.registerFront(CallWatcherFront);

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

@ -22,7 +22,6 @@ var { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUID
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
var { DebuggerServer } = require("devtools/server/main");
var { METHOD_FUNCTION } = require("devtools/shared/fronts/function-call");
var { CallWatcherFront } = require("chrome://mochitests/content/browser/devtools/client/canvasdebugger/test/call-watcher-front");
var { CanvasFront } = require("devtools/shared/fronts/canvas");
var { Toolbox } = require("devtools/client/framework/toolbox");
var { isWebGLSupported } = require("devtools/client/shared/webgl-utils");
@ -137,7 +136,10 @@ function initCallWatcherBackend(aUrl) {
const target = await TargetFactory.forTab(tab);
await target.attach();
const front = new CallWatcherFront(target.client, target.form);
// Load the Front module in order to register it and have getFront to find it.
require("chrome://mochitests/content/browser/devtools/client/canvasdebugger/test/call-watcher-front.js");
const front = await target.getFront("call-watcher");
return { target, front };
})();
}

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

@ -6,9 +6,6 @@
// Test support methods on Target, such as `hasActor`, `getActorDescription`,
// `actorHasMethod` and `getTrait`.
var { WebAudioFront } =
require("devtools/shared/fronts/webaudio");
async function testTarget(client, target) {
await target.attach();
@ -16,7 +13,7 @@ async function testTarget(client, target) {
is(target.hasActor("webaudio"), true, "target.hasActor() true when actor exists.");
is(target.hasActor("notreal"), false, "target.hasActor() false when actor does not exist.");
// Create a front to ensure the actor is loaded
new WebAudioFront(target.client, target.form);
await target.getFront("webaudio");
let desc = await target.getActorDescription("webaudio");
is(desc.typeName, "webaudio",

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

@ -24,7 +24,7 @@ WebAudioEditorPanel.prototype = {
this.panelWin.gToolbox = this._toolbox;
this.panelWin.gTarget = this.target;
this.panelWin.gFront = new WebAudioFront(this.target.client, this.target.form);
this.panelWin.gFront = await this.target.getFront("webaudio");
await this.panelWin.startupWebAudioEditor();

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

@ -68,7 +68,7 @@ function initBackend(aUrl) {
await target.attach();
const front = new WebAudioFront(target.client, target.form);
const front = await target.getFront("webaudio");
return { target, front };
})();
}

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

@ -10,7 +10,7 @@ const { FrontClassWithSpec, registerFront } = require("devtools/shared/protocol"
/**
* Usage example of the reflow front:
*
* let front = new ReflowFront(toolbox.target.client, toolbox.target.form);
* let front = await target.getFront("reflow");
* front.on("reflows", this._onReflows);
* front.start();
* // now wait for events to come

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

@ -25,6 +25,7 @@ class DampTestFront extends FrontClassWithSpec(dampTestSpec) {
this.manage(this);
}
}
protocol.registerFront(DampTestFront);
module.exports = async function() {
let tab = await testSetup(SIMPLE_URL);
@ -64,7 +65,7 @@ module.exports = async function() {
// Instanciate a front for this test actor
let { target } = toolbox;
let front = new DampTestFront(target.client, target.form);
let front = await target.getFront("dampTest");
// Execute the core of this test, call one method multiple times
// and listen for an event sent by this method