gecko-dev/devtools/shared/client/long-string-client.js
Victor Porof b8157dfaaf Bug 1561435 - Format remaining devtools/, a=automatic-formatting, CLOSED TREE
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35894

--HG--
extra : source : 4722b924e08478f5337ab509718bd66906bf472f
extra : amend_source : a5baa1aab21639fdba44537e3a10b179b0073cb4
2019-07-05 11:29:32 +02:00

60 lines
1.4 KiB
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 {
arg,
DebuggerClient,
} = require("devtools/shared/client/debugger-client");
/**
* A LongStringClient provides a way to access "very long" strings from the
* debugger server.
*
* @param client DebuggerClient
* The debugger client parent.
* @param grip Object
* A pause-lifetime long string grip returned by the protocol.
*/
function LongStringClient(client, grip) {
this._grip = grip;
this._client = client;
this.request = this._client.request;
}
LongStringClient.prototype = {
get actor() {
return this._grip.actor;
},
get length() {
return this._grip.length;
},
get initial() {
return this._grip.initial;
},
get _transport() {
return this._client._transport;
},
valid: true,
/**
* Get the substring of this LongString from start to end.
*
* @param start Number
* The starting index.
* @param end Number
* The ending index.
* @param callback Function
* The function called when we receive the substring.
*/
substring: DebuggerClient.requester({
type: "substring",
start: arg(0),
end: arg(1),
}),
};
module.exports = LongStringClient;