mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
67326f6d79
MozReview-Commit-ID: 88NkFh8arI6 --HG-- extra : rebase_source : 1cb19f8f09919fb602782a27d5dd34cacf1e508b
44 lines
1023 B
JavaScript
44 lines
1023 B
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
const {DebuggerClient} = require("devtools/shared/client/debugger-client");
|
|
|
|
function AddonClient(client, actor) {
|
|
this._client = client;
|
|
this._actor = actor;
|
|
this.request = this._client.request;
|
|
this.events = [];
|
|
}
|
|
|
|
AddonClient.prototype = {
|
|
get actor() {
|
|
return this._actor;
|
|
},
|
|
get _transport() {
|
|
return this._client._transport;
|
|
},
|
|
|
|
/**
|
|
* Detach the client from the addon actor.
|
|
*
|
|
* @param function onResponse
|
|
* Called with the response packet.
|
|
*/
|
|
detach: DebuggerClient.requester({
|
|
type: "detach"
|
|
}, {
|
|
after: function (response) {
|
|
if (this._client.activeAddon === this) {
|
|
this._client.activeAddon = null;
|
|
}
|
|
this._client.unregisterClient(this);
|
|
return response;
|
|
},
|
|
})
|
|
};
|
|
|
|
module.exports = AddonClient;
|