Commit Graph
4 Commits
Author SHA1 Message Date
Julian Descottes 2dd87a18f4 Bug 1676980 - [devtools] Remove unused protocol/utils describeTemplate() helper r=ochameau
Depends on D96935

Differential Revision: https://phabricator.services.mozilla.com/D96939
2020-11-13 10:21:36 +00:00
Julian Descottes d41ff00be9 Bug 1676974 - [devtools] Remove unused protocol/utils.js method() helper r=ochameau
Current implementation
```lang=javascript
exports.method = function(fn, spec = {}) {
  fn._methodSpec = Object.freeze(spec);
  if (spec.request) {
    Object.freeze(spec.request);
  }
  if (spec.response) {
    Object.freeze(spec.response);
  }
  return fn;
};
```
https://searchfox.org/mozilla-central/rev/5a1a34953a26117f3be1a00db20c8bbdc03273d6/devtools/shared/protocol/utils.js#70-79

The helper method() in protocol/utils.js is only called from two methods:
- actorBridge (never used in the codebase)
- actorBridgeWithSpec (used by a few actors)

actorBridgeWithSpec doesn't pass the second argument, so in practice, this method could be reduced to:
```lang=javascript
exports.method = function(fn) {
  fn._methodSpec = Object.freeze({});
  return fn;
};
```

`_methodSpec` is only mentioned in one other spot: https://searchfox.org/mozilla-central/rev/5a1a34953a26117f3be1a00db20c8bbdc03273d6/devtools/shared/protocol/Actor/generateActorSpec.js#27-40

But based on our coverage tooling, we never actually have a `_methodSpec` when we run this code: https://coverage.moz.tools/#view=file&revision=latest&path=devtools/shared/protocol/Actor/generateActorSpec.js

To hit it, we would have to call `generateActorSpec` directly with an actor where we used `actorBridgeWithSpec`. But we never do that, we only use it with plain JS objects in the devtools/shared/specs folder.

Consequently, this helper can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D96935
2020-11-13 09:49:53 +00:00
Julian Descottes 9f30cc17b0 Bug 1562583 - Add license headers in devtools/shared/protocol files r=jlast
Differential Revision: https://phabricator.services.mozilla.com/D36480
2019-07-03 18:00:30 +00:00
Jason Laster 698c6ed151 Bug 1560445 - Extract classes from protocol.js. r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D35502
2019-06-26 15:53:20 +00:00