summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/editor/source-documents.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/src/utils/editor/source-documents.js')
-rw-r--r--devtools/client/debugger/src/utils/editor/source-documents.js55
1 files changed, 1 insertions, 54 deletions
diff --git a/devtools/client/debugger/src/utils/editor/source-documents.js b/devtools/client/debugger/src/utils/editor/source-documents.js
index 2ddb0b1965..53ee4f2f35 100644
--- a/devtools/client/debugger/src/utils/editor/source-documents.js
+++ b/devtools/client/debugger/src/utils/editor/source-documents.js
@@ -35,7 +35,7 @@ export function clearDocumentsForSources(sources) {
}
}
-function resetLineNumberFormat(editor) {
+export function resetLineNumberFormat(editor) {
const cm = editor.codeMirror;
cm.setOption("lineNumberFormatter", number => number);
resizeBreakpointGutter(cm);
@@ -54,59 +54,6 @@ function updateLineNumberFormat(editor, sourceId) {
resizeToggleButton(cm);
}
-export function updateDocument(editor, source) {
- if (!source) {
- return;
- }
-
- const sourceId = source.id;
- const doc = getDocument(sourceId) || editor.createDocument();
- editor.replaceDocument(doc);
-
- updateLineNumberFormat(editor, sourceId);
-}
-
-/* used to apply the context menu wrap line option change to all the docs */
-export function updateDocuments(updater) {
- for (const doc of sourceDocs.values()) {
- if (doc.cm == null) {
- continue;
- } else {
- updater(doc);
- }
- }
-}
-
-export function clearEditor(editor) {
- const doc = editor.createDocument("", { name: "text" });
- editor.replaceDocument(doc);
- resetLineNumberFormat(editor);
-}
-
-export function showLoading(editor) {
- // Create the "loading message" document only once
- let doc = getDocument("loading");
- if (!doc) {
- doc = editor.createDocument(L10N.getStr("loadingText"), { name: "text" });
- setDocument("loading", doc);
- }
- // `createDocument` won't be used right away in the editor, we still need to
- // explicitely update it
- editor.replaceDocument(doc);
-}
-
-export function showErrorMessage(editor, msg) {
- let error;
- if (msg.includes("WebAssembly binary source is not available")) {
- error = L10N.getStr("wasmIsNotAvailable");
- } else {
- error = L10N.getFormatStr("errorLoadingText3", msg);
- }
- const doc = editor.createDocument(error, { name: "text" });
- editor.replaceDocument(doc);
- resetLineNumberFormat(editor);
-}
-
const contentTypeModeMap = new Map([
["text/javascript", { name: "javascript" }],
["text/typescript", { name: "javascript", typescript: true }],