diff --git a/HISTORY.md b/HISTORY.md index f17c4bf5..eb51e16f 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -8,6 +8,12 @@ * **Documentation Updates:** * **Translation Updates:** +## 7.2.3: +* **Notable Fix:** + * escape JIT-compiled inputs + +### 2022-02-25 + * threads: escape JIT-compiled inputs ## 7.2.2: * **Notable Changes:** diff --git a/snap.html b/snap.html index f2da4cc6..6ec0460c 100755 --- a/snap.html +++ b/snap.html @@ -1,7 +1,7 @@ - Snap! 7.2.2 - Build Your Own Blocks + Snap! 7.2.3 - Build Your Own Blocks @@ -17,10 +17,10 @@ - + - + diff --git a/src/gui.js b/src/gui.js index 54503a70..550c196f 100644 --- a/src/gui.js +++ b/src/gui.js @@ -86,7 +86,7 @@ BlockVisibilityDialogMorph, ThreadManager*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2022-February-22'; +modules.gui = '2022-February-25'; // Declarations @@ -4775,7 +4775,7 @@ IDE_Morph.prototype.aboutSnap = function () { module, btn1, btn2, btn3, btn4, licenseBtn, translatorsBtn, world = this.world(); - aboutTxt = 'Snap! 7.2.2\nBuild Your Own Blocks\n\n' + aboutTxt = 'Snap! 7.2.3\nBuild Your Own Blocks\n\n' + 'Copyright \u24B8 2008-2022 Jens M\u00F6nig and ' + 'Brian Harvey\n' + 'jens@moenig.org, bh@cs.berkeley.edu\n\n' diff --git a/src/threads.js b/src/threads.js index a50d4b72..0ee41254 100644 --- a/src/threads.js +++ b/src/threads.js @@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud, HatBlockMorph*/ /*jshint esversion: 6*/ -modules.threads = '2022-February-22'; +modules.threads = '2022-February-25'; var ThreadManager; var Process; @@ -7683,8 +7683,8 @@ JSCompiler.prototype.compileInput = function (inp) { case 'Boolean': return '' + value; case 'text': - // enclose in double quotes - return '"' + value + '"'; + // escape and enclose in double quotes + return '"' + this.escape(value) + '"'; case 'list': return 'new List([' + this.compileInputs(value) + '])'; default: @@ -7717,3 +7717,47 @@ JSCompiler.prototype.compileInput = function (inp) { ); } }; + +JSCompiler.prototype.escape = function (string) { + var len = string.length, + result = '', + char, + esc, + i; + for (i = 0; i < len; i += 1) { + char = string[i]; + switch (char) { + case '\\': + esc = '\\\\'; + break; + case '\"': + esc = '\\"'; + break; + case "\'": + esc = "\\'"; + break; + case '\b': + esc = '\\b'; + break; + case '\n': + esc = '\\n'; + break; + case '\f': + esc = '\\f'; + break; + case '\r': + esc = '\\r'; + break; + case '\t': + esc = '\\t'; + break; + case '\v': + esc = '\\v'; + break; + default: + esc = char; + } + result += esc; + } + return result; +}; diff --git a/sw.js b/sw.js index 25116564..68546984 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -var snapVersion = '7.2.2', +var snapVersion = '7.2.3', cacheName = 'snap-pwa', filesToCache = [ 'snap.html',