1043 Commits
Author SHA1 Message Date
Thomas Weber 0cb82afe62 Query security manager extension permissions concurrently (#400) 2026-10-31 15:32:29 -05:00
Thomas Weber cecd467dd2 Wait for custom fonts to load before continuing (#401) 2026-10-31 15:31:42 -05:00
Thomas Weber ce39f140de Improve extension error handling (#399)
* Improve extension error handling
* Allow loading the extension again if it fails
2026-10-31 14:15:08 -05:00
Thomas Weber c985ca5d10 Fix snapshot tests on Windows (#398)
* Fix snapshot comparisons being backwards
* Always check out snapshots with LF endings
2026-10-31 09:54:21 -05:00
Thomas Weber f26ff67e95 Fix some limited prototype pollution 2026-10-23 23:46:39 -05:00
Thomas Weber 984b4f4365 Always reject javascript: URLs in canEmbed 2026-10-23 22:39:44 -05:00
Thomas Weber e9c6e122bf Implement argument defaults in addAddonBlock 2026-10-18 17:08:11 -05:00
Thomas Weber be4e8c288e Add sampler API (#394) 2026-10-18 16:32:07 -05:00
Thomas Weber 8ce06bc6a8 Import most of the forkphorus test suite (#303)
forkphorus has its own test suite, most of which are regression tests for real bugs in a real compiler so it may be worth testing against.

forkphorus-befunge-eratosthenes and forkphorus-string-functions are probably the most meaningful new test cases; at the very least i wouldn't have needed a new test case in #300 to see changes in snapshots if they were merged

The tests also add coverage for specializations like "delete 1 of list" that somehow weren't in the suite before?
2026-10-18 14:49:20 -05:00
Thomas Weber 7387fa0883 Replace tap with node:test (#393) 2026-10-18 14:43:49 -05:00
Thomas Weber 0c8ce96233 Regenerate snapshots due to missing rebase before merge
3aca9363a3 was not rebased first so its new snapshots were missing changes from fd1cc6bb4f
2026-10-18 14:32:43 -05:00
Thomas Weber 3aca9363a3 Optimize jsexecute helpers (#389)
* replace Number.isNaN -> x !== x (see https://github.com/TurboWarp/scratch-vm/pull/367 for background on this though it matters less than expected)
 * optimize listGet for numbers
 * optimize listReplace for numbers
 * optimize listDelete for first and last items
 * optimize listContains / listIndexOf by hoisting work that would previously happened inside compareEqual many times
2026-10-18 13:29:37 -05:00
Thomas Weber ec5733a9e7 Remove yields from stop all and delete clone (#392) 2026-10-18 13:05:45 -05:00
Lu Yifei fd1cc6bb4f Compile non-yielding thread entry points as regular functions (#391) 2026-10-18 11:12:44 -05:00
Thomas Weber 55fd9b7c95 Fix compiler error when argument name is literal number (#387) 2026-10-11 19:29:56 -05:00
Thomas Weber cb8a394fca Actually delete assets when unloaded (#382) 2026-10-11 17:17:55 -05:00
Thomas Weber 7d0d67ad9f Fix missing optimization passes on procedures with multiple variants (#383) 2026-10-11 17:09:05 -05:00
Thomas Weber 87e13f8012 Fix target hidden class falling back to dictionary mode (#385)
Significant performance improvement in Chrome
2026-10-11 17:07:44 -05:00
Thomas Weber a2441e3830 Manually inline toNotNaN (#384)
Safari's JIT enjoys this one a lot more.
2026-10-11 14:02:40 -05:00
Thomas Weber 042235b193 Fix tangent (#381)
fix https://github.com/TurboWarp/scratch-vm/issues/380
2026-10-05 20:50:07 -05:00
Thomas Weber 1fd83b48dd Use new hidden class per variable (#378) 2026-10-03 20:03:38 -05:00
Thomas Weber 32b5428fab Fix casting constant boolean interpretable string to number (#371)
They both should convert to 0
Fixes https://github.com/TurboWarp/scratch-vm/issues/359
2026-10-03 02:46:40 -05:00
Thomas Weber 8c62a150e1 Fix isNotActuallyZero on very small numbers (#373)
Fixes https://github.com/TurboWarp/scratch-vm/issues/361
2026-10-03 02:33:43 -05:00
Thomas Weber 984e05f83e Fix type analysis of casts with partially matching input types (#369)
Fixes https://github.com/TurboWarp/scratch-vm/issues/356
2026-10-03 01:45:28 -05:00
Thomas Weber c5bf9c3266 Fix custom reporter exit state analysis (#368)
Fixes https://github.com/TurboWarp/scratch-vm/issues/358
2026-10-03 01:39:14 -05:00
Thomas Weber c4823421cb Fix toggleScript confusion when block ID is reused across targets (#347) 2026-07-11 23:29:37 -05:00
Thomas Weber 925f113400 Don't start monitors if there are no targets
Fixes https://github.com/TurboWarp/sb3fix/issues/125 in the safest way that
hopefully has no unforseen breakages on weird behaviors
2026-05-16 01:42:59 -05:00
Thomas Weber 52f4369e63 Fix spork compatibility issue with mutation-less control_stop
Our editor relies on the mutation for control_stop to know if there is a connection below.
Spork does not export that mutation anymore.
Instead, we will just generate the mutation to fix errors on loading.
2026-05-03 10:27:39 -05:00
7b521ff000 Force shadow property for procedure blocks during deserialization (#335)
Co-authored-by: Cubester <78769806+CubesterYT@users.noreply.github.com>
Co-authored-by: Thomas Weber <muffin@muffin.ink>
2026-04-18 22:18:21 -05:00
Thomas Weber 9f2106a290 Remove variable value safe stringification
I thought this may have been part of fixing a sb2 -> sb3 corruption issue.
But from commit log, it seems this was added to prevent extensions from making mistakes.
With the scratch-parser change, those mistakes are now considered features.
Seems safe to just do remove these checks all the time.
Closes https://github.com/TurboWarp/scratch-vm/pull/332
2026-03-02 22:43:29 -06:00
Thomas Weber 1ea395fe97 Don't allow reading video motion when external communication is possible (#331) 2026-02-08 11:22:19 -06:00
Thomas Weber d825b5017f add sensing_online 2026-01-24 14:01:42 -06:00
Thomas Weber 464a9c68dd Support JS Map in externalDeltaToJS for extension compatibility
Nothing in Scratch uses this
2026-01-13 19:09:49 -06:00
Thomas Weber 6abc33d787 Remove immutable.js (#329)
Why:
* We use immutable.js 3.8.2 which is ancient and not getting updates
* immutable.js adds 55KB to the bundle, of which we use almost nothing
* immutable.js's treatment of 0 and -0 is nonsensical and would require weird workarounds like https://github.com/TurboWarp/scratch-vm/pull/320
* We don't benefit from the whole immutability thing

What we're doing instead:
* We have our own MonitorState and MonitorRecord classes
* We track dirty-ness at modification time instead of equality checking every tick
* scratch-gui and packager can continue to think we use immutable.js without causing issues in either direction
  * our objects have enough stubs that immutable.js-expecting consumers are ok
  * when receiving an object, we check if it looks like an immutable.js one and ask for the plain JS version so that works okay too
2026-01-09 22:30:18 -06:00
Thomas Weber 553a2a434d Use safe stringify from -gui for visual reports
Fixes stringifying -0, objects, arrays
2026-01-09 22:23:46 -06:00
Thomas Weber 7fefa6f666 Check for either input never being numbers first in OP_EQUALS
Fixes https://github.com/TurboWarp/scratch-vm/issues/311
2025-12-29 20:06:36 -06:00
Thomas Weber 0e5043d4dc Fix missing boolean cast in control_repeat_until
Fixes https://github.com/TurboWarp/scratch-vm/issues/317
2025-12-29 19:50:15 -06:00
Thomas Weber 7aa8930802 Fix incorrect types for sensing_of
They can return 0 if the sprite does not exist
Fixes https://github.com/TurboWarp/scratch-vm/issues/262
Closes https://github.com/TurboWarp/scratch-vm/pull/325
(this one uses a different fix and has tests)

There are broader issues about compiled sensing_of not handling dynamic
sprite create/delete. We should tackle that later. The other PR wouldn't
really fix this either.
2025-12-29 18:58:44 -06:00
8to16 36bf998aee Fix evalAndReturn with comments at the bottom of a script (#322)
This is because beepbox's script:
https://cdn.jsdelivr.net/npm/beepbox@4.2.0/global/beepbox_synth.min.js
has a sourceMappingURL comment at the bottom for whatever
reason, causing it to become
//# sourceMappingURL=beepbox_synth.min.js.map;return beepbox;
This is obviously going to break and might also be the case with
other libraries too, hot just beepbox.

Ported from AmpMod:
https://codeberg.org/ampmod/ampmod/commit/0daf1021bdc8e67a1f0d08b91ce500605fcaa711
2025-12-15 18:51:13 -06:00
Thomas Weber 9624ea5456 Compile looks_say and looks_think without compatibility layer 2025-12-04 21:38:16 -06:00
Thomas Weber 6f6845ba3c Fix all remaining negative zero bugs 2025-12-04 21:32:19 -06:00
Thomas Weber fd1b85589e Merge pull request #301 from TurboWarp/more-unnecessary-casts
Remove more unnecessary casts
2025-12-04 21:29:22 -06:00
Thomas Weber d8c26ad156 Merge pull request #307 from TurboWarp/optimize-repeat-better
Improve repeat block analysis
2025-12-04 21:28:50 -06:00
Thomas Weber 4187f550a0 Record which keys the project has used
Related to https://github.com/TurboWarp/scratch-gui/issues/1106
2025-11-15 19:00:15 -06:00
Thomas Weber 92adc762d9 Merge pull request #313 from TurboWarp/update-languages
Update scratch-translate-extension-languages to 1.0.7
2025-11-01 20:36:39 -05:00
Thomas Weber 475ffd0cb4 Update scratch-translate-extension-languages to 1.0.7 2025-11-01 19:18:12 -05:00
Thomas Weber 55674f82ee Implement Scratch.external - VM part (#308) 2025-10-18 23:43:22 -05:00
Thomas Weber 8860e2d602 Fix repeat block iteration count not being optimizable in yielding loops 2025-10-12 11:16:25 -05:00
Thomas Weber eb0d678068 Only analyze repeat block inputs at the start of the loop 2025-10-12 11:12:05 -05:00
Thomas Weber 3b947da95e Remove unnecessary number index casts 2025-10-08 18:43:50 -05:00