Commit Graph
249 Commits
Author SHA1 Message Date
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
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 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
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 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 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 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
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 9f26069ad6 merge-upstream: Fix ESLint errors 2023-12-22 17:56:40 -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
Muffin c9f93b9de7 Resolve relative Scratch.canEmbed() URLs before sending to security manager 2023-12-03 18:03:53 -06:00
Muffin ec25b30c4a Fix compiler regression when last block in loop returns a Promise 2023-08-26 21:45:53 -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 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
Muffin db0776711f Implement CONDITIONAL blocks in compiler 2023-08-22 16:34:47 -05:00
Muffin 6399562b90 Revert running unsandboxed extensions with fetch() and new AsyncFunction instead of <script>
It causes other issues:
 - It *will* break projects
 - Stack traces from errors in extensions are unusable
 - We do not even get some of the originally intended benefits like parallel loading
2023-08-22 11:24:20 -05:00
GarboMuffin 9caca1c510 Merge pull request #157 from TurboWarp/modernize-loading
Use fetch() and AsyncFunction instead of `<script>` for unsandboxed extensions
2023-08-22 10:48:54 -05:00
Muffin 683620994f Fix tests 2023-08-22 10:43:04 -05:00
Muffin 55cda8242c Run unsandboxed extensions with fetch() and new AsyncFunction instead of <script>
Benefits:
 - IIFE no longer needed
 - Extensions can await
 - Better error messages
Downsides:
 - CORS now required to load extensions
2023-08-22 10:00:36 -05:00
Muffin b9e84b7db2 Implement custom font manager 2023-08-16 10:34:06 -05:00
Muffin efa7e9d639 Refactor asset serialization 2023-08-14 11:27:32 -05:00
Muffin 186ad43b5b Add extensive event and hat test 2023-08-13 16:53:25 -05:00
Muffin afb04f83d8 Run existing hat tests in both interpreter and compiler 2023-08-13 16:53:25 -05:00
Muffin 391c3dc979 Do not ignore compilation errors related to edge-activated hats
They can now be compiled, so this code is dead.
2023-08-13 16:53:25 -05:00
Muffin 843b4c3839 Add API to add a new "builtin" extension at runtime
This will be used by tests
2023-08-13 16:53:25 -05:00
Muffin c549569651 Comment out test entirely to clean up logs 2023-08-08 22:56:17 -05:00
GarboMuffin 461ef267da Merge pull request #144 from TurboWarp/xml-blocktype
BlockType.XML
2023-08-06 22:08:30 -05:00
Muffin c32c66679f Add test 2023-08-06 21:48:18 -05:00
Muffin a1d2cd108a Modify saveProjectSb3DontZip asset order to match saveProjectSb3 2023-07-31 22:37:16 -05:00
Muffin 791189b7b9 Fix incorrect command in snapshot test error 2023-07-29 10:50:37 -05:00
GarboMuffin fbc62badf6 Merge pull request #150 from TurboWarp/return
Allow custom blocks to return values - VM part
2023-07-29 09:56:57 -05:00
Muffin 2158aef763 Refactor default extension URL handling 2023-07-28 23:27:14 -05:00
Muffin 67afd7e8e3 Add API to export blocks with extension metadata
Will be used to make backpack work properly with custom extensions
2023-07-28 22:59:06 -05:00
Muffin 8453a47848 Update addon block tests 2023-07-26 20:39:34 -05:00
Muffin 6681b22349 Include extension list in exported .sprite3 files
closes https://github.com/TurboWarp/extensions/issues/767
2023-07-25 23:53:31 -05:00
Muffin 88b49da0d9 Serialize costumes before sounds
If file saving breaks and we write a truncated file, this order matters.
Sounds tend to be large (so few will be recoverable) and generally
aren't even original, so recovery is often meaningless. Costumes
are much more likely to be original, and they're much smaller
so more will be recovered.
2023-07-25 23:53:31 -05:00
GarboMuffin 40e053daf4 Export internal block being executed on StackFrame 2023-07-14 18:43:07 -05:00