Commit Graph
5601 Commits
Author SHA1 Message Date
Muffin f0bb852f10 Revert "Update behavior of non-existant procedures in compiler to match interpreter"
This reverts commit b04df3eda7.

There are still subtle issues related to execution order (JS is left-to-right while
Scratch is depth-first). As there will inherently be some issues, we may as well
do what runs faster.
2023-07-23 15:06:29 -05:00
GarboMuffin f42b260cc0 Refactor procedure return tests into more manageable pieces 2023-07-14 22:22:22 -05:00
GarboMuffin b04df3eda7 Update behavior of non-existant procedures in compiler to match interpreter
- Fixed default return value
 - Still need to evaluate arguments of non-existant blocks in case of side effects
2023-07-14 21:54:23 -05:00
GarboMuffin 249bec5762 Fix return value of non-existant procedures in interpreter 2023-07-14 21:51:30 -05:00
GarboMuffin 83605d0216 Fix execution order in recursive procedure reporters in compiler 2023-07-14 20:48:33 -05:00
GarboMuffin f033067b6f Non-warp recursion should yield in interpreter
Matches normal procedure blocks. Already worked in compiler.
2023-07-14 19:28:13 -05:00
GarboMuffin 40e053daf4 Export internal block being executed on StackFrame 2023-07-14 18:43:07 -05:00
GarboMuffin 6300494cc2 Update snapshot tests 2023-07-10 22:12:30 -05:00
GarboMuffin b8bc8571f1 Add reasonably comprehensive tests for return blocks 2023-07-10 21:49:38 -05:00
GarboMuffin 6b8f443680 Implement procedure returns in interpreter 2023-07-10 21:46:15 -05:00
GarboMuffin d63ca91439 Implement procedure returns in compiler 2023-07-02 17:43:54 -05:00
GarboMuffin 19c9e8f591 Fix Scratch.translate in unsandboxed custom extensions 2023-05-29 01:16:04 -05:00
GarboMuffin f6ab22e280 Merge pull request #135 from TurboWarp/default-extension-urls
Add default extension URL for compatibility with Scratch Lab animated text projects
2023-05-28 23:57:08 -05:00
GarboMuffin 21915f4565 Export some internal classes for extensions
This is similar to what we do in TW/scratch-render
2023-05-28 22:48:38 -05:00
GarboMuffin e387ceadf9 Merge pull request #138 from TurboWarp/openwindow-noreferrer
Always force noreferrer when opening new windows
2023-05-26 22:38:27 -05:00
GarboMuffin ea81f29955 Always force noreferrer when opening new windows 2023-05-26 22:32:03 -05:00
GarboMuffin c4561c2f1c Support custom buttons in extensions (#137) 2023-05-26 20:52:52 -05:00
GarboMuffin 8866f532b2 Merge pull request #136 from TurboWarp/more-security-prompts
Add canRecordAudio, canRecordVideo, canReadClipboard, canNotify

This unblocks https://github.com/TurboWarp/extensions/pull/57
2023-05-26 20:33:16 -05:00
GarboMuffin 227dec235a Add canRecordAudio, canRecordVideo, canReadClipboard, canNotify 2023-05-26 20:17:09 -05:00
GarboMuffin 7e29bbef17 Add default extension URL for compatibility with Scratch Lab animated text projects 2023-05-22 20:09:08 -05:00
GarboMuffin eed07ed3a4 Fix incorrect JSDoc 2023-05-22 20:00:22 -05:00
GarboMuffin 584e3452a3 Add BEFORE_EXECUTE and AFTER_EXECUTE events in _step
These are for extensions.
2023-05-22 20:00:22 -05:00
GarboMuffin 65bb7b9930 Merge pull request #134 from TurboWarp/serialize-monitors
Fix serializing extensions used only by monitors
2023-05-18 16:40:03 -05:00
GarboMuffin 2b4de3e62b Update tests 2023-05-18 01:17:05 -05:00
GarboMuffin d4bc61714e Fix serializing extensions used only by monitors 2023-05-18 00:58:25 -05:00
GarboMuffin 398892c6f2 Extension L10N - VM part (#133)
Sandboxed extensions will use navigator.language
Unsandboxed extensions will use the language set by setLocale
2023-05-18 00:00:59 -05:00
True FantømandGarboMuffin 8a7ae3f774 Add LABEL BlockType (#132)
Co-authored-by: GarboMuffin <muffin@mailbox.org>
2023-05-17 23:54:03 -05:00
GarboMuffin 6124ba8b1e Allow name of addon blocks category to be translated
A bit overdue
2023-03-26 02:13:05 -05:00
GarboMuffin 50b42f9415 Update tw.blocks.openDocs message
Our l10n scripts now parse this dynamically
2023-03-26 02:12:04 -05:00
GarboMuffin c73f821abf Add ArgumentType.COSTUME and ArgumentType.SOUND 2023-03-25 14:33:57 -05:00
GarboMuffin c6a81eb845 Fix refreshBlocks error log
Stringification is more likely to produce a helpful output than
JSON.stringify on error objects.

Old message:
Failed to refresh built-in extension primitives: {}
New message:
Failed to refresh built-in extension primitives: TypeError: Cannot destructure property 'provider' of ...
2023-03-25 14:31:46 -05:00
GarboMuffin 1ab111b7ca Fix using empty defaultValue for NUMBER arguments
Closes https://github.com/TurboWarp/extensions/issues/119
2023-03-25 13:54:44 -05:00
GarboMuffin 47adea8107 Add Scratch.fetch, Scratch.openWindow, and Scratch.redirect stubs in sandboxed extensions
Also includes the appropriate can[Fetch|OpenWindow|Redirect] methods.
Fetching is always allowed. The other methods are always rejected.
The Worker-based sandbox does not have a window.open method and the
iframe-based sandbox has a feature policy that should prevent them from
opening windows already.
2023-03-18 13:15:05 -05:00
GarboMuffin c0a1c3db83 Merge pull request #123 from TurboWarp/xml-fixes
Consistently escape attributes in extension and block XML
2023-03-08 20:07:37 -06:00
GarboMuffin 92a91f156a Consistently escape attributes in extension and block XML
While this is not believed to cause security bugs as this is not
interpeted as HTML, the inconsistent/no escaping causes bugs such as:
https://github.com/TurboWarp/extensions/issues/241

To resolve this, we now fully escape (hopefully) every value from
extensions that makes its way into XML, so now the characters:
    " ' < > &
can be used anywhere in extensions without issues, even opcodes,
argument names, field names, etc. Just not the extension ID.

Some parts of Scratch such as ExtensionManager._sanitizeID and
Runtime._convertPlaceholders tried to explicitly remove XML characters,
however the code was broken (they only removed the first occurrence) and
this seems like the wrong fix anyways. We can use XML characters, they just
need to be escaped.

Also includes a very comprehensive test.
2023-03-08 20:02:08 -06:00
GarboMuffin cd8f28fbba Restore test that checks compressed IDs do not conflict with uncompressed 2023-02-17 18:19:02 -06:00
GarboMuffin 2ada1d301d Merge pull request #120 from TurboWarp/fix-compress-breaking-script-order
Fix sb3 compression breaking execution order at random
2023-02-17 17:53:27 -06:00
GarboMuffin 750cd7adb1 Fix sb3 compression breaking execution order at random
The bug was that property keys that look like array indexes are always
enumerated by JS before other keys regardless of creation time. For now,
we will avoid using numbers when compressing projects.

This does negligibly increase the size of project.json.
Appel v1.4 went from 2257234 to 2260628 bytes, a 0.15% increase.
2023-02-17 17:42:09 -06:00
GarboMuffin 53af7244ca Update compressed ID uniqueness test 2023-02-17 17:42:02 -06:00
GarboMuffin acd1144b25 Never follow redirects in Scratch.fetch
This is unfortunate. Ideally we would add some manual logic to follow
redirects ourselves, but it turns out fetch's redirect: 'manual' is
actually useless.
2023-02-12 14:22:23 -06:00
GarboMuffin 209e46b5b0 Merge pull request #119 from TurboWarp/extension-permissions-2
Add Scratch.fetch, Scratch.openWindow, Scratch.redirect
2023-02-12 02:51:12 -06:00
GarboMuffin 2a002f62eb Add Scratch.fetch, Scratch.openWindow, Scratch.redirect 2023-02-12 02:45:25 -06:00
GarboMuffin 07597d8a93 Fix default security manager 2023-02-11 20:52:27 -06:00
GarboMuffin fd3b675466 Test that extension permission APIs handle non-string URLs 2023-02-11 19:00:14 -06:00
GarboMuffin e5bc69c0ab Merge pull request #117 from TurboWarp/extension-permissions
Add Scratch.canFetch, Scratch.canOpenWindow, Scratch.canRedirect extension APIs
2023-02-11 18:28:10 -06:00
GarboMuffin 703ee8fa35 Merge pull request #118 from TurboWarp/fix-eslint-warnings
Fix some ESLint warnings
2023-02-11 18:27:49 -06:00
GarboMuffin 5ccaee81d3 Scratch.canFetchResource -> Scratch.canFetch 2023-02-11 18:15:59 -06:00
GarboMuffin 795ceb1fb3 Add Scratch.canOpenWindow and Scratch.canRedirect 2023-02-11 18:12:11 -06:00
GarboMuffin 58d7bc269c Add Scratch.canFetchResource API 2023-02-11 17:25:09 -06:00
GarboMuffin 23cab6b8cc Fix ESLint warning in worker-dispatch.js 2023-02-11 16:11:59 -06:00