Bug 1646854 - Rename onResourceAvailable to notifyResourceAvailable. r=nchevobbe

This is to align with notifyTargetAvailable and notifyTargetDestroyed.

Differential Revision: https://phabricator.services.mozilla.com/D80900
This commit is contained in:
Alexandre Poirot 2020-07-07 13:39:58 +00:00
Родитель b89d332bae
Коммит e1c1588e32
3 изменённых файлов: 7 добавлений и 8 удалений

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

@ -42,7 +42,7 @@ for (const resource of Object.values(Resources)) {
* @param TargetActor targetActor
* The related target actor, it:
* - defines what context to observe (browsing context, process, worker, ...)
* - exposes `onResourceAvailable` method to be notified about the available resources
* - exposes `notifyResourceAvailable` method to be notified about the available resources
* @param Array<String> resourceTypes
* List of all type of resource to listen to.
*/
@ -60,7 +60,7 @@ function watchTargetResources(targetActor, resourceTypes) {
}
const watcher = new WatcherClass(targetActor, {
onAvailable: targetActor.onResourceAvailable,
onAvailable: targetActor.notifyResourceAvailable,
});
watchers.set(targetActor, watcher);
}

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

@ -310,14 +310,14 @@ const browsingContextTargetPrototype = {
this._onWorkerTargetActorListChanged = this._onWorkerTargetActorListChanged.bind(
this
);
this.onResourceAvailable = this.onResourceAvailable.bind(this);
this.notifyResourceAvailable = this.notifyResourceAvailable.bind(this);
TargetActorRegistry.registerTargetActor(this);
},
/**
* These two methods will create and destroy resource watchers
* for each resource type. This will end up calling `onResourceAvailable`
* for each resource type. This will end up calling `notifyResourceAvailable`
* whenever new resources are observed.
*
* We have these shortcut methods in this module, because this is called from DevToolsFrameChild
@ -338,12 +338,11 @@ const browsingContextTargetPrototype = {
* List of all available resources. A resource is a JSON object piped over to the client.
* It may contain actor IDs, actor forms, to be manually marshalled by the client.
*/
onResourceAvailable(resources) {
notifyResourceAvailable(resources) {
if (!this.actorID) {
// Don't try to emit if the actor was destroyed.
return;
}
this.emit("resource-available-form", resources);
},

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

@ -173,7 +173,7 @@ const TestTargetActor = protocol.ActorClassWithSpec(browsingContextTargetSpec, {
},
});
this.dbg = this.makeDebugger();
this.onResourceAvailable = this.onResourceAvailable.bind(this);
this.notifyResourceAvailable = this.notifyResourceAvailable.bind(this);
},
get window() {
@ -243,7 +243,7 @@ const TestTargetActor = protocol.ActorClassWithSpec(browsingContextTargetSpec, {
delete this._extraActors[name];
},
onResourceAvailable(resources) {
notifyResourceAvailable(resources) {
this.emit("resource-available-form", resources);
},
});