Commit Graph
6970 Commits
Author SHA1 Message Date
Thomas Weber 2c9d301da2 ir: Fix variable cache collision when variable or list field has null ID
Fixes https://github.com/TurboWarp/scratch-vm/issues/239
2025-01-18 00:09:09 -06:00
Miyo Sho 36c02f3fec Expose Variable on the VM exports (#237) 2024-12-27 16:45:09 -06:00
熊谷 凌 56825e3744 Allow refreshBlocks() to specify extension (#228) 2024-12-25 22:56:30 -06:00
Thomas Weber b900a375fa Update workflows based on zizmor audit 2024-12-24 19:58:46 -06:00
Thomas Weber c3b60f6fb6 Add Scratch.download API 2024-12-22 17:46:17 -06:00
Thomas Weber fdd954c012 Add URL argument to Scratch.canDownload
This lets us filter out javascript: URLs
2024-12-22 17:46:09 -06:00
Thomas Weber 1a578aa44e Add canDownload API
https://github.com/TurboWarp/scratch-gui/issues/969
2024-12-22 11:51:26 -06:00
Muffin 9e6993de27 Add restricted fonts and case insensitivity to font manager (#231) 2024-11-02 21:39:44 -05:00
凌 fed099c4cc Fix isRecursiveCall failing on flyout blocks (#227) 2024-09-30 22:47:02 -05:00
Muffin 179030ad49 Don't eagerly cast boolean arguments to boolean (#223)
Fixes https://github.com/TurboWarp/scratch-vm/issues/222
2024-09-08 11:56:47 -05:00
Muffin 99ff662f7f Don't emit STAGE_SIZE_CHANGED if stage size didn't change
and also fix the other STAGE_SIZE_CHANGED event test to
actually test that it is being fired when there is a change
2024-07-31 15:16:44 -05:00
Muffin 658ef8aba7 Add test for sb3 creation being deterministic over time 2024-07-18 12:44:49 -05:00
Muffin 4c366e0110 Use a fixed modification date when zipping 2024-07-17 14:27:33 -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 dff3c2f6ba Optimize _keyArgToScratchKey
The special key name list is now a set instead of an array.
In the most common case of a simple letter, a search is skipped entirely.
Test coverage already exists.
2024-05-31 17:11:20 -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 976309704f Update TurboWarp/scratch-parser 2024-05-19 21:58:16 -05:00
Muffin 847088ca00 Remove unused thread.isKilled check
This check only makes sense if isKilled === true implies that it was already
removed from threads, however that is not the case in the VM itself and
especially in some extensions.
2024-05-15 15:00:42 -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
Muffin 73d71c0720 Fix benchmark playground
- added project token support
- option checkbox to enable compiler
2024-05-13 14:30:42 -05:00
Muffin 216b5b65d2 Add execute.js to unsupported exports 2024-05-09 18:55:20 -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
AshimeeAltandMuffin 6d94ef1672 Add JSGenerator.unstable_exports (#209)
Co-authored-by: Muffin <muffin@muffin.ink>
2024-05-09 00:23:30 -05:00
Muffin 5d30745cf8 Remove redundant sandboxed extension block error handling
Interpreter/compiler do this by default since
0593628e24
2024-05-09 00:21:24 -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
Muffin 60f974057b Update scratch-parser 2024-03-30 18:10:23 -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 064155fe0d Update TurboWarp/scratch-parser 2024-03-17 00:47:18 -05:00
Muffin bb4bc02ee4 Bump GitHub Actions 2024-03-15 22:11:14 -05:00
Muffin 63267aecec Deploy the correct folder, whoops! 2024-03-15 21:58:27 -05:00
Muffin 79250a7a27 Enable npm cache in GitHub Actions 2024-03-15 21:55:14 -05:00
Muffin 50700010ab Ignore errors building jsdoc 2024-03-15 21:54:28 -05:00
Muffin e5097da366 Deploy playground to GitHub Pages 2024-03-15 21:51:17 -05:00
Muffin e7332fc846 Mozilla Public License 2.0
The GPL family of licenses are not perfect. Notably they are incompatible with
the SIL OFL 1.1 used by the fonts in scratch-render-fonts. In the packager we
'statically link' all of this those fonts into one HTML file. Is that legal?
Seems like you can make an argument that it's not. Who knows. I'm not a lawyer.

MPL 2.0 is a good alternative: It's still copyleft, used by real projects,
backed by a real organization, and GPL compatible.

Before 9a4afe2864 all changes were either by me
or under BSD3c. The only third-party LGPL commit is b6c42081b0
which is trivial if any copyright dispute should arise. Thus we can make this
switch.

Related: https://github.com/TurboWarp/scratch-gui/pull/909
2024-03-15 21:25:37 -05:00
tpsnt b6c42081b0 fix: wedo2 stop motor when power set to 0 (#198) 2024-02-28 19:21:10 -06:00
Muffin 9a4afe2864 Open source should stay open source. 2024-02-23 13:42:01 -06:00
Muffin f220d941a5 Update @turbowarp/nanolog 2024-02-17 12:46:52 -06:00
Muffin fe5fad5e5c Simplify 845c374f72 without array copy
Classic 1:40 AM merge moment
2024-02-12 11:47:19 -06: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
GarboMuffin f201364407 Merge pull request #189 from CST1229/tw-pen-clarity
Pen: "Stage selected: less pen blocks" label on the stage
2024-02-10 01:40:14 -06:00
Muffin 96225163c1 Fix tests in Node 21 and later 2024-02-02 21:25:58 -06:00
CST1229 58dbb21221 "Stage selected: less pen blocks" label on the stage
The motion category already does this, so this is for parity
2024-01-29 19:31:55 +01:00
GarboMuffin ec1f7dea0c Add vm.exports.i_will_not_ask_for_help_when_these_break() (#181) 2024-01-28 16:30:48 -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