Bug 1677546 - [devtools] Rename network actors to parent and content actors r=ochameau,devtools-backward-compat-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D97239
This commit is contained in:
Hubert Boma Manilla 2020-11-17 23:21:26 +00:00
Родитель 5a09a3c8ce
Коммит 6e19a79a32
15 изменённых файлов: 54 добавлений и 51 удалений

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

@ -30,7 +30,8 @@ DevToolsModules(
"manifest.js",
"media-rule.js",
"memory.js",
"network.js",
"network-content.js",
"network-parent.js",
"node.js",
"object.js",
"page-style.js",
@ -44,7 +45,6 @@ DevToolsModules(
"root.js",
"screenshot.js",
"source.js",
"stacktraces.js",
"storage.js",
"string.js",
"style-rule.js",

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

@ -8,15 +8,15 @@ const {
FrontClassWithSpec,
registerFront,
} = require("devtools/shared/protocol");
const { stackTracesSpec } = require("devtools/shared/specs/stacktraces");
const { networkContentSpec } = require("devtools/shared/specs/network-content");
class StackTracesFront extends FrontClassWithSpec(stackTracesSpec) {
class NetworkContentFront extends FrontClassWithSpec(networkContentSpec) {
constructor(client, targetFront, parentFront) {
super(client, targetFront, parentFront);
// Attribute name from which to retrieve the actorID out of the target actor's form
this.formAttributeName = "stacktracesActor";
this.formAttributeName = "networkContentActor";
}
}
exports.StackTracesFront = StackTracesFront;
registerFront(StackTracesFront);
exports.NetworkContentFront = NetworkContentFront;
registerFront(NetworkContentFront);

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

@ -8,18 +8,18 @@ const {
FrontClassWithSpec,
registerFront,
} = require("devtools/shared/protocol");
const { networkSpec } = require("devtools/shared/specs/network");
const { networkParentSpec } = require("devtools/shared/specs/network-parent");
/**
* Client side for the network actor, used for managing network requests.
*/
class NetworkFront extends FrontClassWithSpec(networkSpec) {
class NetworkParentFront extends FrontClassWithSpec(networkParentSpec) {
constructor(client, targetFront, parentFront) {
super(client, targetFront, parentFront);
// Attribute name from which to retrieve the actorID out of the target actor's form
this.formAttributeName = "networkActor";
this.formAttributeName = "networkParentActor";
}
}
registerFront(NetworkFront);
registerFront(NetworkParentFront);

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

@ -414,7 +414,7 @@ class FirefoxConnector {
*/
async getBlockedUrls() {
if (this.hasResourceWatcherSupport && this.currentWatcherFront) {
const network = await this.currentWatcherFront.getNetworkActor();
const network = await this.currentWatcherFront.getNetworkParentActor();
return network.getBlockedUrls();
}
if (!this.webConsoleFront.traits.blockedUrls) {
@ -430,7 +430,7 @@ class FirefoxConnector {
*/
async setBlockedUrls(urls) {
if (this.hasResourceWatcherSupport && this.currentWatcherFront) {
const network = await this.currentWatcherFront.getNetworkActor();
const network = await this.currentWatcherFront.getNetworkParentActor();
return network.setBlockedUrls(urls);
}
return this.webConsoleFront.setBlockedUrls(urls);

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

@ -303,8 +303,10 @@ class FirefoxDataProvider {
* @return {object}
*/
async _getStackTraceFromWatcher(actor) {
const stacktracesFront = await actor.targetFront.getFront("stacktraces");
const stacktrace = await stacktracesFront.getStackTrace(
const networkContentFront = await actor.targetFront.getFront(
"networkContent"
);
const stacktrace = await networkContentFront.getStackTrace(
actor.stacktraceResourceId
);
return { stacktrace };

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

@ -11,13 +11,13 @@ DIRS += [
DevToolsModules(
"channel-event-sink.js",
"eventsource-actor.js",
"network-content.js",
"network-event-actor.js",
"network-event.js",
"network-monitor.js",
"network-observer.js",
"network-parent.js",
"network-response-listener.js",
"network.js",
"stack-trace-collector.js",
"stack-traces-actor.js",
"websocket-actor.js",
)

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

@ -5,7 +5,7 @@
"use strict";
const { ActorClassWithSpec, Actor } = require("devtools/shared/protocol");
const { stackTracesSpec } = require("devtools/shared/specs/stacktraces");
const { networkContentSpec } = require("devtools/shared/specs/network-content");
loader.lazyRequireGetter(
this,
@ -20,12 +20,13 @@ const {
} = require("devtools/server/actors/resources/index");
/**
* Manages the stacktraces of the network
* This actor manages all network functionality runnning
* in the content process.
*
* @constructor
*
*/
const StackTracesActor = ActorClassWithSpec(stackTracesSpec, {
const NetworkContentActor = ActorClassWithSpec(networkContentSpec, {
initialize(conn, targetActor) {
Actor.prototype.initialize.call(this, conn);
this.targetActor = targetActor;
@ -56,4 +57,4 @@ const StackTracesActor = ActorClassWithSpec(stackTracesSpec, {
},
});
exports.StackTracesActor = StackTracesActor;
exports.NetworkContentActor = NetworkContentActor;

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

@ -5,7 +5,7 @@
"use strict";
const { ActorClassWithSpec, Actor } = require("devtools/shared/protocol");
const { networkSpec } = require("devtools/shared/specs/network");
const { networkParentSpec } = require("devtools/shared/specs/network-parent");
const {
TYPES: { NETWORK_EVENT },
@ -13,13 +13,13 @@ const {
} = require("devtools/server/actors/resources/index");
/**
* This actor implements capabilities for handling and supporting
* Network requests.
* This actor manages all network functionality running
* in the parent process.
*
* @constructor
*
*/
const NetworkActor = ActorClassWithSpec(networkSpec, {
const NetworkParentActor = ActorClassWithSpec(networkParentSpec, {
initialize(watcherActor) {
this.watcherActor = watcherActor;
Actor.prototype.initialize.call(this, this.watcherActor.conn);
@ -58,4 +58,4 @@ const NetworkActor = ActorClassWithSpec(networkSpec, {
},
});
exports.NetworkActor = NetworkActor;
exports.NetworkParentActor = NetworkParentActor;

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

@ -276,10 +276,10 @@ const ActorRegistry = {
type: { target: true },
});
this.registerModule(
"devtools/server/actors/network-monitor/stack-traces-actor",
"devtools/server/actors/network-monitor/network-content",
{
prefix: "stacktraces",
constructor: "StackTracesActor",
prefix: "networkContent",
constructor: "NetworkContentActor",
type: { target: true },
}
);

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

@ -35,8 +35,8 @@ loader.lazyRequireGetter(
loader.lazyRequireGetter(
this,
"NetworkActor",
"devtools/server/actors/network-monitor/network",
"NetworkParentActor",
"devtools/server/actors/network-monitor/network-parent",
true
);
@ -425,7 +425,7 @@ exports.WatcherActor = protocol.ActorClassWithSpec(watcherSpec, {
* @return {Object} actor
* The network actor.
*/
getNetworkActor() {
return new NetworkActor(this);
getNetworkParentActor() {
return new NetworkParentActor(this);
},
});

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

@ -144,15 +144,20 @@ const Types = (exports.__TypesForTests = [
front: "devtools/client/fronts/memory",
},
{
types: ["network"],
spec: "devtools/shared/specs/network",
front: "devtools/client/fronts/network",
types: ["networkContent"],
spec: "devtools/shared/specs/network-content",
front: "devtools/client/fronts/network-content",
},
{
types: ["netEvent"],
spec: "devtools/shared/specs/network-event",
front: null,
},
{
types: ["networkParent"],
spec: "devtools/shared/specs/network-parent",
front: "devtools/client/fronts/network-parent",
},
/* imageData isn't an actor but just a DictType */
{
types: ["imageData", "disconnectedNode", "disconnectedNodeArray"],
@ -224,11 +229,6 @@ const Types = (exports.__TypesForTests = [
spec: "devtools/shared/specs/source",
front: "devtools/client/fronts/source",
},
{
types: ["stacktraces"],
spec: "devtools/shared/specs/stacktraces",
front: "devtools/client/fronts/stacktraces",
},
{
types: [
"cookies",

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

@ -33,9 +33,10 @@ DevToolsModules(
"manifest.js",
"media-rule.js",
"memory.js",
"network-content.js",
"network-event.js",
"network-monitor.js",
"network.js",
"network-parent.js",
"node.js",
"object.js",
"page-style.js",
@ -49,7 +50,6 @@ DevToolsModules(
"root.js",
"screenshot.js",
"source.js",
"stacktraces.js",
"storage.js",
"string.js",
"style-rule.js",

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

@ -6,8 +6,8 @@
const { generateActorSpec, RetVal, Arg } = require("devtools/shared/protocol");
const stackTracesSpec = generateActorSpec({
typeName: "stacktraces",
const networkContentSpec = generateActorSpec({
typeName: "networkContent",
methods: {
getStackTrace: {
request: { resourceId: Arg(0) },
@ -17,4 +17,4 @@ const stackTracesSpec = generateActorSpec({
},
});
exports.stackTracesSpec = stackTracesSpec;
exports.networkContentSpec = networkContentSpec;

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

@ -6,8 +6,8 @@
const { generateActorSpec, Arg, RetVal } = require("devtools/shared/protocol");
const networkSpec = generateActorSpec({
typeName: "network",
const networkParentSpec = generateActorSpec({
typeName: "networkParent",
methods: {
setBlockedUrls: {
@ -24,4 +24,4 @@ const networkSpec = generateActorSpec({
},
});
exports.networkSpec = networkSpec;
exports.networkParentSpec = networkParentSpec;

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

@ -46,10 +46,10 @@ const watcherSpecPrototype = {
oneway: true,
},
getNetworkActor: {
getNetworkParentActor: {
request: {},
response: {
network: RetVal("network"),
network: RetVal("networkParent"),
},
},
},