kopia lustrzana https://github.com/backface/turtlestitch
reinstated JS-function control, disabled JS-functions by default
rodzic
d350ad552c
commit
8fe8d38bec
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
## in development:
|
## in development:
|
||||||
|
|
||||||
|
* **Notable Changes:**
|
||||||
|
* JS-functions are now disabled by default until switched on in the settings menu per session
|
||||||
* **Notable Fixes:**
|
* **Notable Fixes:**
|
||||||
* register unsaved changes when the user edits a comment
|
* register unsaved changes when the user edits a comment
|
||||||
* fixed bignums library and and made colors library faster, thanks, Brian!
|
* fixed bignums library and and made colors library faster, thanks, Brian!
|
||||||
|
@ -17,6 +19,7 @@
|
||||||
* new Hindi translation, thanks, Barthdry!
|
* new Hindi translation, thanks, Barthdry!
|
||||||
* fixed bignums library and and made colors library faster, thanks, Brian!
|
* fixed bignums library and and made colors library faster, thanks, Brian!
|
||||||
* fixed setting the IDE language via a url parameter, thanks, Joan!
|
* fixed setting the IDE language via a url parameter, thanks, Joan!
|
||||||
|
* reinstated JS-function control, disabled JS-functions by default
|
||||||
|
|
||||||
## 6.8.1
|
## 6.8.1
|
||||||
* **Notable Fixes:**
|
* **Notable Fixes:**
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
<script src="src/symbols.js?version=2021-03-03"></script>
|
<script src="src/symbols.js?version=2021-03-03"></script>
|
||||||
<script src="src/widgets.js?version=2021-01-05"></script>
|
<script src="src/widgets.js?version=2021-01-05"></script>
|
||||||
<script src="src/blocks.js?version=2021-06-09"></script>
|
<script src="src/blocks.js?version=2021-06-09"></script>
|
||||||
<script src="src/threads.js?version=2021-04-17"></script>
|
<script src="src/threads.js?version=2021-06-09"></script>
|
||||||
<script src="src/objects.js?version=2021-04-23"></script>
|
<script src="src/objects.js?version=2021-06-09"></script>
|
||||||
<script src="src/gui.js?version=2021-06-09"></script>
|
<script src="src/gui.js?version=2021-06-09"></script>
|
||||||
<script src="src/paint.js?version=2020-05-17"></script>
|
<script src="src/paint.js?version=2020-05-17"></script>
|
||||||
<script src="src/lists.js?version=2021-03-15"></script>
|
<script src="src/lists.js?version=2021-03-15"></script>
|
||||||
<script src="src/byob.js?version=2021-04-20"></script>
|
<script src="src/byob.js?version=2021-06-09"></script>
|
||||||
<script src="src/tables.js?version=2021-03-05"></script>
|
<script src="src/tables.js?version=2021-03-05"></script>
|
||||||
<script src="src/sketch.js?version=2020-07-13"></script>
|
<script src="src/sketch.js?version=2020-07-13"></script>
|
||||||
<script src="src/video.js?version=2019-06-27"></script>
|
<script src="src/video.js?version=2019-06-27"></script>
|
||||||
<script src="src/maps.js?version=2020-03-25"></script>
|
<script src="src/maps.js?version=2020-03-25"></script>
|
||||||
<script src="src/xml.js?version=2020-04-27"></script>
|
<script src="src/xml.js?version=2020-04-27"></script>
|
||||||
<script src="src/store.js?version=2021-03-09"></script>
|
<script src="src/store.js?version=2021-06-09"></script>
|
||||||
<script src="src/locale.js?version=2021-06-09"></script>
|
<script src="src/locale.js?version=2021-06-09"></script>
|
||||||
<script src="src/cloud.js?version=2021-02-04"></script>
|
<script src="src/cloud.js?version=2021-02-04"></script>
|
||||||
<script src="src/api.js?version=2021-01-25"></script>
|
<script src="src/api.js?version=2021-01-25"></script>
|
||||||
|
|
|
@ -106,7 +106,7 @@ WatcherMorph, XML_Serializer, SnapTranslator*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.byob = '2021-May-04';
|
modules.byob = '2021-June-09';
|
||||||
|
|
||||||
// Declarations
|
// Declarations
|
||||||
|
|
||||||
|
@ -347,9 +347,9 @@ CustomBlockDefinition.prototype.parseChoices = function (string) {
|
||||||
if (string.match(/^function\s*\(.*\)\s*{.*\n/)) {
|
if (string.match(/^function\s*\(.*\)\s*{.*\n/)) {
|
||||||
// It's a JS function definition.
|
// It's a JS function definition.
|
||||||
// Let's extract its params and body, and return a Function out of them.
|
// Let's extract its params and body, and return a Function out of them.
|
||||||
// if (!this.enableJS) {
|
if (!Process.prototype.enableJS) {
|
||||||
// throw new Error('JavaScript is not enabled');
|
throw new Error('JavaScript is not enabled');
|
||||||
// }
|
}
|
||||||
params = string.match(/^function\s*\((.*)\)/)[1].split(',');
|
params = string.match(/^function\s*\((.*)\)/)[1].split(',');
|
||||||
body = string.split('\n').slice(1,-1).join('\n');
|
body = string.split('\n').slice(1,-1).join('\n');
|
||||||
return Function.apply(null, params.concat([body]));
|
return Function.apply(null, params.concat([body]));
|
||||||
|
|
|
@ -3494,7 +3494,6 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
'microphoneMenu'
|
'microphoneMenu'
|
||||||
);
|
);
|
||||||
menu.addLine();
|
menu.addLine();
|
||||||
/*
|
|
||||||
addPreference(
|
addPreference(
|
||||||
'JavaScript',
|
'JavaScript',
|
||||||
() => {
|
() => {
|
||||||
|
@ -3507,7 +3506,6 @@ IDE_Morph.prototype.settingsMenu = function () {
|
||||||
'uncheck to disable support for\nnative JavaScript functions',
|
'uncheck to disable support for\nnative JavaScript functions',
|
||||||
'check to support\nnative JavaScript functions'
|
'check to support\nnative JavaScript functions'
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
if (isRetinaSupported()) {
|
if (isRetinaSupported()) {
|
||||||
addPreference(
|
addPreference(
|
||||||
'Retina display support',
|
'Retina display support',
|
||||||
|
|
|
@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
|
||||||
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
||||||
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
||||||
|
|
||||||
modules.objects = '2021-April-23';
|
modules.objects = '2021-June-09';
|
||||||
|
|
||||||
var SpriteMorph;
|
var SpriteMorph;
|
||||||
var StageMorph;
|
var StageMorph;
|
||||||
|
@ -2671,7 +2671,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
|
||||||
blocks.push(block('reportIsA'));
|
blocks.push(block('reportIsA'));
|
||||||
blocks.push(block('reportIsIdentical'));
|
blocks.push(block('reportIsIdentical'));
|
||||||
|
|
||||||
if (true) { // (Process.prototype.enableJS) {
|
if (Process.prototype.enableJS) {
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('reportJSFunction'));
|
blocks.push(block('reportJSFunction'));
|
||||||
if (Process.prototype.enableCompiling) {
|
if (Process.prototype.enableCompiling) {
|
||||||
|
@ -8854,7 +8854,7 @@ StageMorph.prototype.blockTemplates = function (category) {
|
||||||
blocks.push(block('reportIsA'));
|
blocks.push(block('reportIsA'));
|
||||||
blocks.push(block('reportIsIdentical'));
|
blocks.push(block('reportIsIdentical'));
|
||||||
|
|
||||||
if (true) { // (Process.prototype.enableJS) {
|
if (Process.prototype.enableJS) {
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('reportJSFunction'));
|
blocks.push(block('reportJSFunction'));
|
||||||
if (Process.prototype.enableCompiling) {
|
if (Process.prototype.enableCompiling) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ normalizeCanvas, contains*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.store = '2021-March-09';
|
modules.store = '2021-June-09';
|
||||||
|
|
||||||
|
|
||||||
// XML_Serializer ///////////////////////////////////////////////////////
|
// XML_Serializer ///////////////////////////////////////////////////////
|
||||||
|
@ -1165,7 +1165,7 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter, object) {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
// disable JavaScript functions, commented out for now
|
// disable loading JavaScript functions, commented out for now
|
||||||
if (model.attributes.s === 'reportJSFunction' &&
|
if (model.attributes.s === 'reportJSFunction' &&
|
||||||
!Process.prototype.enableJS) {
|
!Process.prototype.enableJS) {
|
||||||
if (window.confirm('enable JavaScript?')) {
|
if (window.confirm('enable JavaScript?')) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
|
||||||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
|
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
|
||||||
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
|
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
|
||||||
|
|
||||||
modules.threads = '2021-April-17';
|
modules.threads = '2021-June-09';
|
||||||
|
|
||||||
var ThreadManager;
|
var ThreadManager;
|
||||||
var Process;
|
var Process;
|
||||||
|
@ -562,7 +562,7 @@ Process.prototype.enableLiveCoding = false; // experimental
|
||||||
Process.prototype.enableSingleStepping = false; // experimental
|
Process.prototype.enableSingleStepping = false; // experimental
|
||||||
Process.prototype.enableCompiling = false; // experimental
|
Process.prototype.enableCompiling = false; // experimental
|
||||||
Process.prototype.flashTime = 0; // experimental
|
Process.prototype.flashTime = 0; // experimental
|
||||||
// Process.prototype.enableJS = false;
|
Process.prototype.enableJS = false;
|
||||||
|
|
||||||
function Process(topBlock, receiver, onComplete, yieldFirst) {
|
function Process(topBlock, receiver, onComplete, yieldFirst) {
|
||||||
this.topBlock = topBlock || null;
|
this.topBlock = topBlock || null;
|
||||||
|
@ -1185,6 +1185,9 @@ Process.prototype.reifyPredicate = function (topBlock, parameterNames) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.reportJSFunction = function (parmNames, body) {
|
Process.prototype.reportJSFunction = function (parmNames, body) {
|
||||||
|
if (!this.enableJS) {
|
||||||
|
throw new Error('JavaScript is not enabled');
|
||||||
|
}
|
||||||
return Function.apply(
|
return Function.apply(
|
||||||
null,
|
null,
|
||||||
parmNames.itemsArray().concat([body])
|
parmNames.itemsArray().concat([body])
|
||||||
|
@ -1204,9 +1207,9 @@ Process.prototype.evaluate = function (
|
||||||
return this.returnValueToParentContext(null);
|
return this.returnValueToParentContext(null);
|
||||||
}
|
}
|
||||||
if (context instanceof Function) {
|
if (context instanceof Function) {
|
||||||
// if (!this.enableJS) {
|
if (!this.enableJS) {
|
||||||
// throw new Error('JavaScript is not enabled');
|
throw new Error('JavaScript is not enabled');
|
||||||
// }
|
}
|
||||||
return context.apply(
|
return context.apply(
|
||||||
this.blockReceiver(),
|
this.blockReceiver(),
|
||||||
args.itemsArray().concat([this])
|
args.itemsArray().concat([this])
|
||||||
|
|
Ładowanie…
Reference in New Issue