Bug 1701790 - Mass replace resourceWatcher with resourceCommand. r=nchevobbe

$ sed -i 's/resourceWatcher/resourceCommand/g' $(egrep -rl 'resourceWatcher' devtools/)

Differential Revision: https://phabricator.services.mozilla.com/D113933
This commit is contained in:
Alexandre Poirot
2021-05-03 18:07:31 +00:00
parent 3bb9a13462
commit 8479ca9cbb
62 changed files with 412 additions and 420 deletions

View File

@@ -75,8 +75,8 @@ class ChangesView {
return this._contextMenu;
}
get resourceWatcher() {
return this.inspector.toolbox.resourceWatcher;
get resourceCommand() {
return this.inspector.toolbox.resourceCommand;
}
init() {
@@ -101,27 +101,27 @@ class ChangesView {
}
async watchResources() {
await this.resourceWatcher.watchResources(
[this.resourceWatcher.TYPES.DOCUMENT_EVENT],
await this.resourceCommand.watchResources(
[this.resourceCommand.TYPES.DOCUMENT_EVENT],
{
onAvailable: this.onResourceAvailable,
// Ignore any DOCUMENT_EVENT resources that have occured in the past
// and are cached by the resource watcher, otherwise the Changes panel will
// and are cached by the resource command, otherwise the Changes panel will
// react to them erroneously and interpret that the document is reloading *now*
// which leads to clearing all stored changes.
ignoreExistingResources: true,
}
);
await this.resourceWatcher.watchResources(
[this.resourceWatcher.TYPES.CSS_CHANGE],
await this.resourceCommand.watchResources(
[this.resourceCommand.TYPES.CSS_CHANGE],
{ onAvailable: this.onResourceAvailable }
);
}
onResourceAvailable(resources) {
for (const resource of resources) {
if (resource.resourceType === this.resourceWatcher.TYPES.CSS_CHANGE) {
if (resource.resourceType === this.resourceCommand.TYPES.CSS_CHANGE) {
this.onAddChange(resource);
continue;
}
@@ -256,10 +256,10 @@ class ChangesView {
* Destruction function called when the inspector is destroyed.
*/
destroy() {
this.resourceWatcher.unwatchResources(
this.resourceCommand.unwatchResources(
[
this.resourceWatcher.TYPES.CSS_CHANGE,
this.resourceWatcher.TYPES.DOCUMENT_EVENT,
this.resourceCommand.TYPES.CSS_CHANGE,
this.resourceCommand.TYPES.DOCUMENT_EVENT,
],
{ onAvailable: this.onResourceAvailable }
);