зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1663941 - Do not call onAvailable if cached server resources are empty r=ochameau
Depends on D89609 Differential Revision: https://phabricator.services.mozilla.com/D89611
This commit is contained in:
Родитель
4512e67b05
Коммит
a66edac6cb
|
@ -357,8 +357,9 @@ const browsingContextTargetPrototype = {
|
|||
* Wrapper around emit for resource forms to bail early after destroy.
|
||||
*/
|
||||
_emitResourcesForm(name, resources) {
|
||||
if (this.isDestroyed()) {
|
||||
// Don't try to emit if the actor was destroyed.
|
||||
if (resources.length === 0 || this.isDestroyed()) {
|
||||
// Don't try to emit if the resources array is empty or the actor was
|
||||
// destroyed.
|
||||
return;
|
||||
}
|
||||
this.emit(name, resources);
|
||||
|
|
|
@ -213,15 +213,26 @@ exports.WatcherActor = protocol.ActorClassWithSpec(watcherSpec, {
|
|||
* It may contain actor IDs, actor forms, to be manually marshalled by the client.
|
||||
*/
|
||||
notifyResourceAvailable(resources) {
|
||||
this.emit("resource-available-form", resources);
|
||||
this._emitResourcesForm("resource-available-form", resources);
|
||||
},
|
||||
|
||||
notifyResourceDestroyed(resources) {
|
||||
this.emit("resource-destroyed-form", resources);
|
||||
this._emitResourcesForm("resource-destroyed-form", resources);
|
||||
},
|
||||
|
||||
notifyResourceUpdated(resources) {
|
||||
this.emit("resource-updated-form", resources);
|
||||
this._emitResourcesForm("resource-updated-form", resources);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper around emit for resource forms.
|
||||
*/
|
||||
_emitResourcesForm(name, resources) {
|
||||
if (resources.length === 0) {
|
||||
// Don't try to emit if the resources array is empty.
|
||||
return;
|
||||
}
|
||||
this.emit(name, resources);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче