tweaks to the JS-extension handling

pull/95/head
jmoenig 2021-06-10 16:18:42 +02:00
rodzic e3331c370a
commit 419b59f945
4 zmienionych plików z 28 dodań i 19 usunięć

Wyświetl plik

@ -3,7 +3,8 @@
## in development:
* **Notable Changes:**
* JS-functions are now disabled by default until switched on in the settings menu per session, or if the user accepts the when loading a project
* JS-functions are now disabled by default until switched on in the settings menu per session
* error messages in presentation mode are now shown as pop-up messages onstage
* **Notable Fixes:**
* register unsaved changes when the user edits a comment
* fixed bignums library and and made colors library faster, thanks, Brian!
@ -12,6 +13,10 @@
* Polish, thanks, Witek!
* new Hindi translation, thanks, Barthdry!
### 2021-06-10
* threads: error messages in presentation mode are now shown as pop-up messages onstage
* store: commented out modal prompt to enable JS when loading a project that uses it
### 2021-06-09
* new dev version
* Polish translation update, thanks, Witek!

Wyświetl plik

@ -9,7 +9,7 @@
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-01-05"></script>
<script src="src/blocks.js?version=2021-06-09"></script>
<script src="src/threads.js?version=2021-06-09"></script>
<script src="src/threads.js?version=2021-06-10"></script>
<script src="src/objects.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>
@ -20,7 +20,7 @@
<script src="src/video.js?version=2019-06-27"></script>
<script src="src/maps.js?version=2020-03-25"></script>
<script src="src/xml.js?version=2020-04-27"></script>
<script src="src/store.js?version=2021-06-09"></script>
<script src="src/store.js?version=2021-06-10"></script>
<script src="src/locale.js?version=2021-06-09"></script>
<script src="src/cloud.js?version=2021-02-04"></script>
<script src="src/api.js?version=2021-01-25"></script>

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2021-June-09';
modules.store = '2021-June-10';
// XML_Serializer ///////////////////////////////////////////////////////
@ -1165,6 +1165,7 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter, object) {
);
} else {
// disable loading JavaScript functions
/*
if (model.attributes.s === 'reportJSFunction' &&
!Process.prototype.enableJS) {
if (window.confirm('enable JavaScript?')) {
@ -1173,6 +1174,7 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter, object) {
throw new Error('JavaScript is not enabled');
}
}
*/
block = SpriteMorph.prototype.blockForSelector(model.attributes.s);
migration = SpriteMorph.prototype.blockMigrations[
model.attributes.s

Wyświetl plik

@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
modules.threads = '2021-June-09';
modules.threads = '2021-June-10';
var ThreadManager;
var Process;
@ -1106,19 +1106,24 @@ Process.prototype.expectReport = function () {
// Process Exception Handling
Process.prototype.handleError = function (error, element) {
var m = element;
var m = element,
ide = this.homeContext.receiver.parentThatIsA(IDE_Morph);
this.stop();
this.errorFlag = true;
this.topBlock.addErrorHighlight();
if (isNil(m) || isNil(m.world())) {m = this.topBlock; }
m.showBubble(
(m === element ? '' : 'Inside: ')
+ error.name
+ '\n'
+ error.message,
this.exportResult,
this.receiver
);
if (ide.isAppMode) {
ide.showMessage(error.name + '\n' + error.message);
} else {
if (isNil(m) || isNil(m.world())) {m = this.topBlock; }
m.showBubble(
(m === element ? '' : 'Inside: ')
+ error.name
+ '\n'
+ error.message,
this.exportResult,
this.receiver
);
}
};
Process.prototype.errorObsolete = function () {
@ -1185,9 +1190,6 @@ Process.prototype.reifyPredicate = function (topBlock, parameterNames) {
};
Process.prototype.reportJSFunction = function (parmNames, body) {
if (!this.enableJS) {
throw new Error('JavaScript is not enabled');
}
return Function.apply(
null,
parmNames.itemsArray().concat([body])
@ -1208,7 +1210,7 @@ Process.prototype.evaluate = function (
}
if (context instanceof Function) {
if (!this.enableJS) {
throw new Error('JavaScript is not enabled');
throw new Error('JavaScript extensions for Snap!\nare turned off');
}
return context.apply(
this.blockReceiver(),