1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 } = require("resource://devtools/client/fronts/string.js");
11 * Fetches the full text of a LongString.
13 * @param {DevToolsClient} client
14 * @param {object|string} stringGrip: A long string grip. If the param is a simple string,
15 * it will be returned as is.
16 * @return {Promise<String>} The full string content.
18 async function getLongStringFullText(client, stringGrip) {
19 if (typeof stringGrip !== "object" || stringGrip.type !== "longString") {
23 const { initial, length } = stringGrip;
24 const longStringFront = new LongStringFront(
26 // this.commands.targetCommand.targetFront
28 longStringFront.form(stringGrip);
29 // The front has to be managed to be able to call the actor method.
30 longStringFront.manage(longStringFront);
32 const response = await longStringFront.substring(initial.length, length);
33 const payload = initial + response;
35 longStringFront.destroy();
40 exports.getLongStringFullText = getLongStringFullText;