Remove unused protocol/utils method() helper
Categories
(DevTools :: Framework, task, P3)
Tracking
(firefox84 fixed)
| Tracking | Status | |
|---|---|---|
| firefox84 | --- | fixed |
People
(Reporter: jdescottes, Assigned: jdescottes)
Details
Attachments
(1 file)
Current implementation
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;
};
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:
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.
We should be able to remove all of that.
| Assignee | ||
Comment 1•5 years ago
|
||
Comment 3•5 years ago
|
||
| bugherder | ||
Description
•