From 8d869ec9271968397eb27cbbc0acb50ff09bcd3f Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 27 Jul 2021 18:34:33 -0400 Subject: [PATCH] Pad: Delete non-functional debug logging facility --- src/static/js/ace2_common.js | 5 ----- src/static/js/ace2_inner.js | 13 ------------- src/static/js/contentcollector.js | 1 - src/static/js/pad.js | 11 ----------- src/static/js/pad_editor.js | 3 --- src/static/js/skiplist.js | 1 - src/static/js/undomodule.js | 2 -- 7 files changed, 36 deletions(-) diff --git a/src/static/js/ace2_common.js b/src/static/js/ace2_common.js index d3f86f699..c1dab5cfd 100644 --- a/src/static/js/ace2_common.js +++ b/src/static/js/ace2_common.js @@ -22,8 +22,6 @@ * limitations under the License. */ -const Security = require('./security'); - const isNodeText = (node) => (node.nodeType === 3); const getAssoc = (obj, name) => obj[`_magicdom_${name}`]; @@ -60,8 +58,6 @@ const binarySearchInfinite = (expectedLength, func) => { return binarySearch(i, func); }; -const htmlPrettyEscape = (str) => Security.escapeHTML(str).replace(/\r?\n/g, '\\n'); - const noop = () => {}; exports.isNodeText = isNodeText; @@ -69,5 +65,4 @@ exports.getAssoc = getAssoc; exports.setAssoc = setAssoc; exports.binarySearch = binarySearch; exports.binarySearchInfinite = binarySearchInfinite; -exports.htmlPrettyEscape = htmlPrettyEscape; exports.noop = noop; diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 536f580e9..91266f2f2 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -26,7 +26,6 @@ const $ = require('./rjquery').$; const isNodeText = Ace2Common.isNodeText; const getAssoc = Ace2Common.getAssoc; const setAssoc = Ace2Common.setAssoc; -const htmlPrettyEscape = Ace2Common.htmlPrettyEscape; const noop = Ace2Common.noop; const hooks = require('./pluginfw/hooks'); @@ -146,20 +145,12 @@ function Ace2Inner(editorInfo, cssManagers) { for (let i = 0; i < names.length; ++i) console[names[i]] = noop; } - // "dmesg" is for displaying messages in the in-page output pane - // visible when "?djs=1" is appended to the pad URL. It generally - // remains a no-op unless djs is enabled, but we make a habit of - // only calling it in error cases or while debugging. - let dmesg = noop; - window.dmesg = noop; - const scheduler = parent; // hack for opera required const performDocumentReplaceRange = (start, end, newText) => { if (start === undefined) start = rep.selStart; if (end === undefined) end = rep.selEnd; - // dmesg(String([start.toSource(),end.toSource(),newText.toSource()])); // start[0]: <--- start[1] --->CCCCCCCCCCC\n // CCCCCCCCCCCCCCCCCCCC\n // CCCC\n @@ -374,7 +365,6 @@ function Ace2Inner(editorInfo, cssManagers) { error: e, time: +new Date(), }); - dmesg(e.toString()); throw e; } finally { const cs = currentCallStack; @@ -546,8 +536,6 @@ function Ace2Inner(editorInfo, cssManagers) { idleWorkTimer.atMost(100); if (rep.alltext !== atext.text) { - dmesg(htmlPrettyEscape(rep.alltext)); - dmesg(htmlPrettyEscape(atext.text)); throw new Error('mismatch error setting raw text in setDocAText'); } }; @@ -653,7 +641,6 @@ function Ace2Inner(editorInfo, cssManagers) { sideDiv.parentNode.classList.toggle('line-numbers-hidden', !hasLineNumbers); fixView(); }, - dmesg: () => { dmesg = window.dmesg = value; }, userauthor: (value) => { thisAuthor = String(value); documentAttributeManager.author = thisAuthor; diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index c02e73887..18643a944 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -117,7 +117,6 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author) textOfLine: (i) => textArray[i], appendText: (txt, attrString) => { textArray[textArray.length - 1] += txt; - // dmesg(txt+" / "+attrString); op.attribs = attrString; op.chars = txt.length; attribsBuilder.append(op); diff --git a/src/static/js/pad.js b/src/static/js/pad.js index a7e80ede1..0ea4ce227 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -390,7 +390,6 @@ const pad = { getPadId: () => clientVars.padId, getClientIp: () => clientVars.clientIp, getColorPalette: () => clientVars.colorPalette, - getIsDebugEnabled: () => clientVars.debugEnabled, getPrivilege: (name) => clientVars.accountPrivs[name], getUserId: () => pad.myUserInfo.userId, getUserName: () => pad.myUserInfo.name, @@ -610,16 +609,6 @@ const pad = { pad.handleOptionsChange(opts); } }, - dmesg: (m) => { - if (pad.getIsDebugEnabled()) { - const djs = $('#djs').get(0); - const wasAtBottom = (djs.scrollTop - (djs.scrollHeight - $(djs).height()) >= -20); - $('#djs').append(`

${m}

`); - if (wasAtBottom) { - djs.scrollTop = djs.scrollHeight; - } - } - }, handleChannelStateChange: (newState, message) => { const oldFullyConnected = !!padconnectionstatus.isFullyConnected(); const wasConnecting = (padconnectionstatus.getStatus().what === 'connecting'); diff --git a/src/static/js/pad_editor.js b/src/static/js/pad_editor.js index d8c3ae5ac..e39f73fee 100644 --- a/src/static/js/pad_editor.js +++ b/src/static/js/pad_editor.js @@ -49,9 +49,6 @@ const padeditor = (() => { }); exports.focusOnLine(self.ace); self.ace.setProperty('wraps', true); - if (pad.getIsDebugEnabled()) { - self.ace.setProperty('dmesg', pad.dmesg); - } self.initViewOptions(); self.setViewOptions(initialViewOptions); // view bar diff --git a/src/static/js/skiplist.js b/src/static/js/skiplist.js index aeb677336..f10a4e7a8 100644 --- a/src/static/js/skiplist.js +++ b/src/static/js/skiplist.js @@ -291,7 +291,6 @@ class SkipList { if (end < 0) end = 0; if (end > this._keyToNodeMap.size) end = this._keyToNodeMap.size; - window.dmesg(String([start, end, this._keyToNodeMap.size])); if (end <= start) return []; let n = this.atIndex(start); const array = [n]; diff --git a/src/static/js/undomodule.js b/src/static/js/undomodule.js index b8270b805..d0b83419d 100644 --- a/src/static/js/undomodule.js +++ b/src/static/js/undomodule.js @@ -55,7 +55,6 @@ const undoModule = (() => { e.elementType = UNDOABLE_EVENT; stackElements.push(e); numUndoableEvents++; - // dmesg("pushEvent backset: "+event.backset); }; const pushExternalChange = (cs) => { @@ -207,7 +206,6 @@ const undoModule = (() => { const merge = _mergeChangesets(event.backset, topEvent.backset); if (merge) { topEvent.backset = merge; - // dmesg("reportEvent merge: "+merge); applySelectionToTop(); merged = true; }