Skip to content

Commit 050b93b

Browse files
author
Chris K
committed
DFL-3467 Pretty-print and mixed file (improve algorithm to detect minified scripts)
1 parent 9f87680 commit 050b93b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/ecma-debugger/stop_at.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,17 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
4646

4747
var reformat_condition =
4848
[
49-
"var MAX_SLICE = 5000;",
50-
"var LIMIT = 11;",
51-
"var re = /\\s+/g;",
52-
"var ws = 0;",
49+
"var MAX_LINE_LENGTH = 160;",
50+
"var re = /(?:\\n|$)/g;",
51+
"var last = 0;",
5352
"var m = null;",
54-
"var src = scriptData.slice(0, MAX_SLICE);",
55-
"while (m = re.exec(src))",
56-
" ws += m[0].length;",
57-
"",
58-
"return (100 * ws / src.length) < LIMIT;",
53+
"while (m = re.exec(scriptData))",
54+
"{",
55+
" if (m.index - last > MAX_LINE_LENGTH)",
56+
" return true;",
57+
" last = m.index;",
58+
"}",
59+
"return false;"
5960
].join("");
6061

6162
var self = this;

0 commit comments

Comments
 (0)