Commit Graph
946 Commits
Author SHA1 Message Date
Muffin 658ef8aba7 Add test for sb3 creation being deterministic over time 2024-07-18 12:44:49 -05:00
Muffin 30a614dfc4 Expose compatibility layer stack frame on thread
For https://github.com/TurboWarp/scratch-vm/issues/212
2024-06-14 14:32:35 -05:00
Muffin 16415ba5cd Use procedure variant in snapshots instead of just procedure code 2024-05-23 14:22:43 -05:00
Muffin 6ce931b60a Add test for behavior of self-restarting scripts
The behavior is non-trivial as it will keep running the old thread
unti it yields.

I briefly tested putting `thread.status = 4` at the start of _restartThread
and all the old execution tests still passed, so let's just add a bit more
coverage. This was nearly regressed by f548d1b33c.
2024-05-23 14:16:57 -05:00
Muffin d39a30fb23 Replace wrapAssetRequest promise argument with a callback
The flexibility may be useful later
2024-05-22 20:36:25 -05:00
Muffin d69256aa2d Replace jszip with @turbowarp/jszip 2024-05-19 21:58:36 -05:00
Muffin f548d1b33c Fix stopping a thread from inside of its blocks
Works in command or reporter after yielding or not.
These snippets are covered by the tests:
thread.status = Thread.STATUS_DONE;
thread.status = 4; (indirectly)
sequencer.retireThread(thread);
2024-05-15 14:46:23 -05:00
KyleKartandMuffin ce04eafec0 Add boolean argument support to ScratchX compatibility layer (#208)
Co-authored-by: Muffin <muffin@muffin.ink>
2024-05-09 00:46:18 -05:00
Muffin 0593628e24 Fix rejected promise behavior in interpreter and compiler
Before this command:
- Interpreter would popStack() and continue. Inside a loop this was like JS continue, outside it was like return
- Compiler would return literal undefined and keep going.

After this commit:
Both return the error as a string and then continue as normal.
This has several benefits:
- Users can actually see the error messages
- Logical execution flow
- Consistent behavior
- Blocks aren't even supposed to return rejected promises anyways
- No vanilla blocks return rejected promises so no compatibility concerns

Supersedes https://github.com/TurboWarp/scratch-vm/pull/207
2024-05-09 00:18:18 -05:00
JeremyGamer13andMuffin 31c9eba1aa Add platform info (#205)
- Platform info is now stored in project.json.
- Available to extensions on vm.runtime.platform.
- When loading a project with a different platform, emit an event and wait for callbacks before continuing.

Co-authored-by: Muffin <muffin@muffin.ink>
2024-05-08 23:01:26 -05:00
Muffin 11eec6604d Allow scratch-gui (and others) to extend unsandboxed extension APIs 2024-04-06 16:01:31 -05:00
GarboMuffin 20f25f252c interpreter: Do not re-evaluate procedure arguments after stop this script or return (#202)
"stop this script" and "return" would previously cause all the procedure
arguments to be re-evaluated and then discarded. In vanilla Scratch the
worst case is a performance penalty, but with our custom reporters it
can cause infinite loops.

Fixes https://github.com/TurboWarp/scratch-vm/issues/201
2024-03-30 17:53:13 -05:00
Muffin 9657efb1d4 Shorten Base64Util test cases
1000000 items is very slow; the tests take about 4 seconds on my machine.
2024-02-10 01:42:16 -06:00
tpsntandMuffin 845c374f72 Fix WeDo2.send sends empty message (#192)
* Fix WeDo2.send sends empty message

WeDo2.send invokes Base64Util.uint8ArrayToBase64(message). However message.arrayLength === undefined. This causes Base64Util.uint8ArrayToBase64 always returning empty string ''.

* Move the fix to base64-util instead

---------

Co-authored-by: Muffin <muffin@mailbox.org>
2024-02-10 01:40:36 -06:00
Muffin 96225163c1 Fix tests in Node 21 and later 2024-02-02 21:25:58 -06:00
Muffin a15c069ac6 Improve promise-like extension block test
notably, fail on compiler errors, and run the test block several times
2024-01-26 20:39:05 -06:00
Muffin b3e621c61b Add test for promise-like blocks 2024-01-21 13:44:54 -06:00
Muffin cd9782a64c Replace minilog with nanolog 2024-01-14 01:48:32 -06:00
Muffin 9511cc4000 Remove note/drum concurrency limit when misc limits are removed 2024-01-13 21:58:18 -06:00
Muffin c857903321 Replace use of deprecated vm.stop() in branch tests 2024-01-13 21:23:09 -06:00
Muffin ce0b7d73ff Add test for starting a substack beyond branchCount 2024-01-13 21:09:57 -06:00
Muffin b7e9016c56 Apply new TurboWarp/scratch-blocks extensions 2024-01-11 02:41:28 -06:00
Muffin 088b0c1780 Experiment with staticFetch to improve reliability of large data: URLs 2024-01-09 03:45:27 -06:00
Muffin e4e461ac84 Reset runtime's extension storage when loading a new project 2024-01-03 03:35:39 -06:00
GarboMuffin 8297dd4cc9 Add native loading progress tracking (#180) 2024-01-03 00:56:54 -06:00
GarboMuffin dd848dbbf6 Extension storage (#179) 2024-01-02 23:19:51 -06:00
LilyMakesThingsandMuffin 7f9c8f759c Add per-block extensions and colors (#177)
Co-authored-by: Muffin <muffin@mailbox.org>
2023-12-31 02:24:31 -06:00
CubesterandMuffin b27142a012 Allow removing loop icon using branchIconURI (#176)
Co-authored-by: Muffin <muffin@mailbox.org>
2023-12-31 01:32:22 -06:00
Muffin 7e9dab88f4 Allow serializing and deserializing infinite length comments
Goes along with https://github.com/TurboWarp/scratch-blocks/commit/78177be01aab589a6cbd9844d530df02258d09c2
2023-12-31 01:09:00 -06:00
Muffin c309c42894 Use media:// for default loop icon (requires scratch-blocks change)
They have always been subtly broken, but the high contrast changes finally the old path for good.
https://github.com/TurboWarp/scratch-blocks/commit/7413542d3731b58381e05fddf6913fbc494f9cd9
2023-12-31 00:24:20 -06:00
Muffin 66cbf13a7b Replace scratch-svg-renderer with @turbowarp/scratch-svg-renderer 2023-12-30 00:13:22 -06:00
Muffin 051c310ff3 merge-upstream: Fix broken test 2023-12-25 14:54:21 -06:00
Muffin 9f26069ad6 merge-upstream: Fix ESLint errors 2023-12-22 17:56:40 -06:00
Muffin 5d52268ace merge-upstream: Fix test errors 2023-12-22 17:49:05 -06:00
Muffin 81a0382e0f merge-upstream: initial merge of upstream/develop
installs & compiles but has test errors

aside from expected merge conflicts, notable changes from upstream:
 - removed husky, commitlint, etc.
 - removed semantic-release etc.
2023-12-22 17:25:21 -06:00
CubesterandMuffin bd0cf91d85 Add branchIconURI (#174)
Co-authored-by: Muffin <muffin@mailbox.org>
2023-12-22 16:47:48 -06:00
Muffin 24b6036825 Add Scratch.translate.language extension API
Requested by https://github.com/TurboWarp/extensions/pull/1172
2023-12-21 00:20:36 -06:00
Muffin c9f93b9de7 Resolve relative Scratch.canEmbed() URLs before sending to security manager 2023-12-03 18:03:53 -06:00
GarboMuffin b90d1bc7ef Optimize counter blocks in compiler (#170) 2023-10-08 14:13:49 -05:00
Muffin d386082d5b Allow BOOLEAN blocks to be monitors
This will cause issues if the booleans have side-effects.

Closes https://github.com/TurboWarp/extensions/issues/201
2023-08-28 14:13:49 -05:00
Muffin ec25b30c4a Fix compiler regression when last block in loop returns a Promise 2023-08-26 21:45:53 -05:00
Muffin 56a1b141e1 Allow Scratch.fetch() to follow redirects 2023-08-25 16:30:03 -05:00
Muffin 621ccefcb0 Add SecurityManager.canEmbed() 2023-08-24 15:40:27 -05:00
Muffin 6f335eccb4 Add SecurityManager.rewriteExtensionURL() 2023-08-24 15:40:20 -05:00
Muffin 7a832da9b7 Update snapshots
due to 810692824a
2023-08-24 15:40:20 -05:00
Muffin 4845bf89a1 Update loop and conditional tests 2023-08-23 15:59:31 -05:00
Muffin 8b43eae4de Make addBuiltinExtension per-VM, not global 2023-08-23 13:37:04 -05:00
Muffin 7fd9495703 Update snapshots 2023-08-22 16:54:21 -05:00
Muffin e9f0a3686c Implement LOOP blocks in interpreter 2023-08-22 16:34:47 -05:00
Muffin 87119eadb7 Implement CONDITIONAL blocks in interpreter 2023-08-22 16:34:47 -05:00