mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-10-09 09:05:56 +01:00
Fix a race condition with debuglogs viewing.
This commit is contained in:
1 parent
9f7a78bf3c
commit
3995608fd8
4 files changed
+67
-33
No files matched your search
@@ -0,0 +1,21 @@
|
||||
refrigerator euro-pop digital math- sign saturation point weathered tanto nano- disposable tanto pistol neon tube engine boy.
|
||||
computer rebar singularity boat San Francisco city spook shanty town cartel shoes car franchise tank-traps city nodality boy.
|
||||
tiger-team boy corrupted engine franchise tiger-team realism uplink realism sub-orbital motion systema voodoo god hacker urban Kowloon.
|
||||
rain knife cartel digital augmented reality office pre- beef noodles savant woman nano- garage numinous sunglasses augmented reality monofilament.
|
||||
|
||||
semiotics semiotics gang long-chain hydrocarbons post- tanto pen modem BASE jump sprawl marketing motion -ware convenience store
|
||||
crypto- chrome. denim fluidity woman sensory refrigerator drone realism long-chain hydrocarbons cyber- convenience store knife
|
||||
decay drone cartel katana carbon. pre- girl spook soul-delay chrome towards pistol singularity plastic decay market bicycle
|
||||
advert tank-traps geodesic grenade. RAF artisanal pre- savant neural order-flow pre- weathered Tokyo digital neural advert artisanal
|
||||
denim fluidity marketing.
|
||||
|
||||
Legba RAF assault RAF into rebar vinyl cardboard paranoid rifle euro-pop boy katana neon meta- neon. Legba papier-mache kanji faded
|
||||
bicycle A.I. sign nodal point semiotics modem urban DIY 8-bit cardboard sentient meta-. kanji assault rifle warehouse post- franchise
|
||||
skyscraper footage cardboard bomb drone drugs silent corrupted boat fetishism. towards rebar sentient face forwards meta- neon BASE
|
||||
jump papier-mache faded vinyl engine sunglasses claymore mine gang pen uplink.
|
||||
|
||||
Shibuya media BASE jump geodesic car sub-orbital j-pop semiotics boat rebar weathered claymore mine systemic skyscraper fluidity uplink.
|
||||
network pre- skyscraper market assassin footage tiger-team cyber- carbon claymore mine camera kanji shanty town A.I. katana long-chain
|
||||
hydrocarbons. savant stimulate physical katana 8-bit -ware paranoid systema neon market tiger-team San Francisco systemic engine numinous
|
||||
hacker. disposable weathered plastic warehouse papier-mache San Francisco range-rover woman katana San Francisco shanty town semiotics
|
||||
towards tower -ware denim.
|
||||
@@ -0,0 +1,9 @@
|
||||
!function(){var e=function(){return this}();e||"undefined"==typeof window||(e=window);var t=function(e,i,n){"string"==typeof e?(2==arguments.length&&(n=i),t.modules[e]||(t.payloads[e]=n,t.modules[e]=null)):t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace())};t.modules={},t.payloads={};var i,n,o=function(e,t,i){if("string"==typeof t){var n=a(e,t);if(null!=n)return i&&i(),n}else if("[object Array]"===Object.prototype.toString.call(t)){for(var o=[],s=0,l=t.length;s<l;++s){var c=a(e,t[s]);if(null==c&&r.original)return;o.push(c)}return i&&i.apply(null,o)||!0}},r=function(e,t){var i=o("",e,t);return null==i&&r.original?r.original.apply(this,arguments):i},s=function(e,t){if(-1!==t.indexOf("!")){var i=t.split("!");return s(e,i[0])+"!"+s(e,i[1])}if("."==t.charAt(0))for(t=e.split("/").slice(0,-1).join("/")+"/"+t;-1!==t.indexOf(".")&&n!=t;){var n=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return t},a=function(e,i){i=s(e,i);var n=t.modules[i];if(!n){if("function"==typeof(n=t.payloads[i])){var r={},a={id:i,uri:"",exports:r,packaged:!0};r=n((function(e,t){return o(i,e,t)}),r,a)||a.exports,t.modules[i]=r,delete t.payloads[i]}n=t.modules[i]=r||n}return n};n=e,(i="ace")&&(e[i]||(e[i]={}),n=e[i]),n.define&&n.define.packaged||(t.original=n.define,n.define=t,n.define.packaged=!0),n.require&&n.require.packaged||(r.original=n.require,n.require=r,n.require.packaged=!0)}(),ace.define("ace/lib/es6-shim",["require","exports","module"],(function(e,t,i){function n(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||n(String.prototype,"startsWith",(function(e,t){return t=t||0,this.lastIndexOf(e,t)===t})),String.prototype.endsWith||n(String.prototype,"endsWith",(function(e,t){var i=this;(void 0===t||t>i.length)&&(t=i.length),t-=e.length;var n=i.indexOf(e,t);return-1!==n&&n===t})),String.prototype.repeat||n(String.prototype,"repeat",(function(e){for(var t="",i=this;e>0;)1&e&&(t+=i),(e>>=1)&&(i+=i);return t})),String.prototype.includes||n(String.prototype,"includes",(function(e,t){return-1!=this.indexOf(e,t)})),Object.assign||(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];null!=n&&Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t}),Object.values||(Object.values=function(e){return Object.keys(e).map((function(t){return e[t]}))}),Array.prototype.find||n(Array.prototype,"find",(function(e){for(var t=this.length,i=arguments[1],n=0;n<t;n++){var o=this[n];if(e.call(i,o,n,this))return o}})),Array.prototype.findIndex||n(Array.prototype,"findIndex",(function(e){for(var t=this.length,i=arguments[1],n=0;n<t;n++){var o=this[n];if(e.call(i,o,n,this))return n}})),Array.prototype.includes||n(Array.prototype,"includes",(function(e,t){return-1!=this.indexOf(e,t)})),Array.prototype.fill||n(Array.prototype,"fill",(function(e){for(var t=this,i=t.length>>>0,n=arguments[1]>>0,o=n<0?Math.max(i+n,0):Math.min(n,i),r=arguments[2],s=void 0===r?i:r>>0,a=s<0?Math.max(i+s,0):Math.min(s,i);o<a;)t[o]=e,o++;return t})),Array.of||n(Array,"of",(function(){return Array.prototype.slice.call(arguments)}))})),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],(function(e,t,i){"use strict";e("./es6-shim")})),ace.define("ace/lib/deep_copy",["require","exports","module"],(function(e,t,i){t.deepCopy=function e(t){if("object"!=typeof t||!t)return t;var i;if(Array.isArray(t)){i=[];for(var n=0;n<t.length;n++)i[n]=e(t[n]);return i}if("[object Object]"!==Object.prototype.toString.call(t))return t;for(var n in i={},t)i[n]=e(t[n]);return i}})),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],(function(e,t,i){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var i="";t>0;)1&t&&(i+=e),(t>>=1)&&(e+=e);return i};var n=/^\s\s*/,o=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(n,"")},t.stringTrimRight=function(e){return e.replace(o,"")},t.copyObject=function(e){var t={};for(var i in e)t[i]=e[i];return t},t.copyArray=function(e){for(var t=[],i=0,n=e.length;i<n;i++)e[i]&&"object"==typeof e[i]?t[i]=this.copyObject(e[i]):t[i]=e[i];return t},t.deepCopy=e("./deep_copy").deepCopy,t.arrayToMap=function(e){for(var t={},i=0;i<e.length;i++)t[e[i]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var i in e)t[i]=e[i];return t},t.arrayRemove=function(e,t){for(var i=0;i<=e.length;i++)t===e[i]&&e.splice(i,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},t.getMatchOffsets=function(e,t){var i=[];return e.replace(t,(function(e){i.push({offset:arguments[arguments.length-2],length:e.lengLine truncated
|
||||
/*
|
||||
* based on code from:
|
||||
*
|
||||
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
"use strict";var n=e("./dom");t.get=function(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.onreadystatechange=function(){4===i.readyState&&t(i.responseText)},i.send(null)},t.loadScript=function(e,t){var i=n.getDocumentHead(),o=document.createElement("script");o.src=e,i.appendChild(o),o.onload=o.onreadystatechange=function(e,i){!i&&o.readyState&&"loaded"!=o.readyState&&"complete"!=o.readyState||(o=o.onload=o.onreadystatechange=null,i||t())}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}})),ace.define("ace/lib/oop",["require","exports","module"],(function(e,t,i){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var i in t)e[i]=t[i];return e},t.implement=function(e,i){t.mixin(e,i)}})),ace.define("ace/lib/event_emitter",["require","exports","module"],(function(e,t,i){"use strict";var n={},o=function(){this.propagationStopped=!0},r=function(){this.defaultPrevented=!0};n._emit=n._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var i=this._eventRegistry[e]||[],n=this._defaultHandlers[e];if(i.length||n){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=o),t.preventDefault||(t.preventDefault=r),i=i.slice();for(var s=0;s<i.length&&(i[s](t,this),!t.propagationStopped);s++);return n&&!t.defaultPrevented?n(t,this):void 0}},n._signal=function(e,t){var i=(this._eventRegistry||{})[e];if(i){i=i.slice();for(var n=0;n<i.length;n++)i[n](t,this)}},n.once=function(e,t){var i=this;if(this.on(e,(function n(){i.off(e,n),t.apply(null,arguments)})),!t)return new Promise((function(e){t=e}))},n.setDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i||(i=this._defaultHandlers={_disabled_:{}}),i[e]){var n=i[e],o=i._disabled_[e];o||(i._disabled_[e]=o=[]),o.push(n);var r=o.indexOf(t);-1!=r&&o.splice(r,1)}i[e]=t},n.removeDefaultHandler=function(e,t){var i=this._defaultHandlers;if(i){var n=i._disabled_[e];if(i[e]==t)n&&this.setDefaultHandler(e,n.pop());else if(n){var o=n.indexOf(t);-1!=o&&n.splice(o,1)}}},n.on=n.addEventListener=function(e,t,i){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];return n||(n=this._eventRegistry[e]=[]),-1==n.indexOf(t)&&n[i?"unshift":"push"](t),t},n.off=n.removeListener=n.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var i=this._eventRegistry[e];if(i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}},n.removeAllListeners=function(e){e||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[e]=void 0),this._defaultHandlers&&(this._defaultHandlers[e]=void 0)},t.EventEmitter=n})),ace.define("ace/lib/report_error",["require","exports","module"],(function(e,t,i){t.reportError=function(e,t){var i=new Error(e);i.data=t,"object"==typeof console&&console.error&&console.error(i),setTimeout((function(){throw i}))}})),ace.define("ace/lib/default_english_messages",["require","exports","module"],(function(e,t,i){t.defaultEnglishMessages={"autocomplete.popup.aria-roledescription":"Autocomplete suggestions","autocomplete.popup.aria-label":"Autocomplete suggestions","autocomplete.popup.item.aria-roledescription":"item","autocomplete.loading":"Loading...","editor.scroller.aria-roledescription":"editor","editor.scroller.aria-label":"Editor content, press Enter to start editing, press Escape to exit","editor.gutter.aria-roledescription":"editor gutter","editor.gutter.aria-label":"Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit","error-marker.good-state":"Looks good!","prompt.recently-used":"Recently used","prompt.other-commands":"Other commands","prompt.no-matching-commands":"No matching commands","search-box.find.placeholder":"Search for","search-box.find-all.text":"All","search-box.replace.placeholder":"Replace with","search-box.replace-next.text":"Replace","search-box.replace-all.text":"All","search-box.toggle-replace.title":"Toggle Replace mode","search-box.toggle-regexp.title":"RegExp Search","search-box.toggle-case.title":"CaseSensitive Search","search-box.toggle-whole-word.title":"Whole Word Search","search-box.toggle-in-selection.title":"Search In Selection","search-box.search-counter":"$0 of $1","text-input.aria-roledescription":"editor","text-input.aria-label":"Cursor at row $0","gutter.code-folding.range.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.closed.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.open.aria-label":"Toggle code folding, row $0","gutter.code-folding.closed.title":"Unfold code","gutter.code-folding.open.title":"Fold code","gutter.annotation.aria-label.error":"Error, read annotations row $0","gutter.annotation.aria-label.warning":"Warning, read annotations row $0","gutter.annotation.aria-label.info":"Info, read annotations row $Line truncated
|
||||
@@ -37,7 +37,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<script src="https://www.unpkg.com/ace-builds@latest/src-noconflict/ace.js"></script>
|
||||
<script src="ace.min.js"></script>
|
||||
<script src="debuglogs-viewer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,40 @@
|
||||
let editor;
|
||||
let timeout;
|
||||
let session;
|
||||
|
||||
let logLines = ""; // Original logLines
|
||||
let input = ""; // Search query input
|
||||
let selectedLevels = []; // Log levels that are selected in checkboxes
|
||||
let markers = []; // IDs of highlighted search markers
|
||||
let matchRanges = []; // Ranges of all search matches
|
||||
let matchCount = 0; // Total number of matches
|
||||
let isFiltered = false;
|
||||
let isCaseSensitive = false;
|
||||
|
||||
// Create custom text mode to color different levels of debug log lines
|
||||
const TextMode = ace.require("ace/mode/text").Mode;
|
||||
const TextHighlightRules = ace.require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
const Range = ace.require("ace/range").Range;
|
||||
|
||||
function main() {
|
||||
// Create Ace Editor using the custom mode
|
||||
editor = ace.edit("container", {
|
||||
mode: new CustomMode(),
|
||||
theme: "ace/theme/textmate",
|
||||
wrap: false, // Allow for horizontal scrolling
|
||||
readOnly: true,
|
||||
showGutter: false,
|
||||
highlightActiveLine: false,
|
||||
highlightSelectedWord: false, // Prevent Ace Editor from automatically highlighting all instances of a selected word (really laggy!)
|
||||
showPrintMargin: false,
|
||||
});
|
||||
|
||||
editor.session.on("changeScrollTop", showScrollBar);
|
||||
editor.session.on("changeScrollLeft", showScrollBar);
|
||||
|
||||
// Generate highlight markers for all search matches
|
||||
session = editor.getSession();
|
||||
}
|
||||
|
||||
function CustomHighlightRules() {
|
||||
this.$rules = {
|
||||
@@ -14,53 +48,22 @@ function CustomHighlightRules() {
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
CustomHighlightRules.prototype = new TextHighlightRules();
|
||||
|
||||
function CustomMode() {
|
||||
TextMode.call(this);
|
||||
this.HighlightRules = CustomHighlightRules;
|
||||
}
|
||||
|
||||
CustomMode.prototype = Object.create(TextMode.prototype);
|
||||
CustomMode.prototype.constructor = CustomMode;
|
||||
|
||||
// Create Ace Editor using the custom mode
|
||||
let editor = ace.edit("container", {
|
||||
mode: new CustomMode(),
|
||||
theme: "ace/theme/textmate",
|
||||
wrap: false, // Allow for horizontal scrolling
|
||||
readOnly: true,
|
||||
showGutter: false,
|
||||
highlightActiveLine: false,
|
||||
highlightSelectedWord: false, // Prevent Ace Editor from automatically highlighting all instances of a selected word (really laggy!)
|
||||
showPrintMargin: false,
|
||||
});
|
||||
|
||||
// Show scrollbar that fades after a second since last scroll
|
||||
let timeout;
|
||||
function showScrollBar() {
|
||||
editor.container.classList.add("show-scrollbar");
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => editor.container.classList.remove("show-scrollbar"), 1000);
|
||||
}
|
||||
|
||||
editor.session.on("changeScrollTop", showScrollBar);
|
||||
editor.session.on("changeScrollLeft", showScrollBar);
|
||||
|
||||
// Generate highlight markers for all search matches
|
||||
const Range = ace.require("ace/range").Range;
|
||||
const session = editor.getSession();
|
||||
|
||||
let logLines = ""; // Original logLines
|
||||
let input = ""; // Search query input
|
||||
let selectedLevels = []; // Log levels that are selected in checkboxes
|
||||
let markers = []; // IDs of highlighted search markers
|
||||
let matchRanges = []; // Ranges of all search matches
|
||||
let matchCount = 0; // Total number of matches
|
||||
let isFiltered = false;
|
||||
let isCaseSensitive = false;
|
||||
|
||||
// Clear all search markers and match info
|
||||
function clearMarkers() {
|
||||
markers.forEach((id) => session.removeMarker(id));
|
||||
@@ -180,7 +183,6 @@ function onFilterClose() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onFilterLevel(sLevels) {
|
||||
selectedLevels = sLevels;
|
||||
|
||||
@@ -217,3 +219,5 @@ function applyFilter() {
|
||||
|
||||
editor.setValue(filtered, -1);
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in new issue
Block a user