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
9453bb45f7
Add more test cases
2023-01-17 13:57:27 -06:00
GarboMuffin
4fd7b3728a
Fix handling of tab characters in comparison functions to match scratch-www
...
Closes https://github.com/TurboWarp/scratch-vm/issues/115
2023-01-14 22:36:57 -06:00
GarboMuffin
4aa167e523
Replace isWhiteSpace with something faster
...
isWhiteSpace works by trimming the entire string. This works, but in the
context we use it, this is a lot of unnecessary work.
At this point we know that `+x === 0` and we want to know if that's
because x is empty or because it actually contains 0, hence we can use
a loop that just checks for a 0 existing in the string. This relies on
the assumption that there is no x such that:
+x === 0 && x.trim().length !== 0 && !x.includes('0')
In a very biased microbenchmark (https://scratch.mit.edu/projects/788352711 )
this results in a 10% performance improvement.
This also will allow us to resolve https://github.com/TurboWarp/scratch-vm/issues/115
in a later commit.
2023-01-14 22:06:26 -06:00
GarboMuffin
6049dd58fc
Merge pull request #97 from TurboWarp/dont-load-existing-extensions
...
Don't duplicate loaded extensions in loadExtensionURL
2023-01-09 22:24:39 -06:00
GarboMuffin
e941bb0f04
Export Cast to custom extensions ( #110 )
2022-12-19 21:09:54 -06:00
GarboMuffin
61af8a9fa2
Update tests
2022-12-07 10:41:07 -06:00
GarboMuffin
bd0a38246d
Don't duplicate loaded extensions in loadExtensionURL
...
If the URL is already loaded, resolve immediately.
Fixes https://github.com/TurboWarp/scratch-gui/issues/637
Caused by TWStateManager repeatedly calling loadExtensionURL on locale
change.
This could be fixed in GUI, but fixing it in VM is easier and loading
multiple instances of the same extension doesn't make sense anyways.
2022-12-03 14:25:17 -06:00
GarboMuffin
43128ccc0d
Add more unsandboxed extension tests
2022-11-06 12:55:30 -06:00
GarboMuffin
cd40f38f76
Make global.Scratch actually unique per extension
...
and add some tests for unsandboxed extensions
2022-11-05 20:28:53 -05:00
GarboMuffin
10f07fc8c7
Fix test broken by incomplete extension manager mock
2022-11-05 19:25:10 -05:00
GarboMuffin
bffa0ac77c
Allow loading custom extensions from file:
...
Regression from the unsandboxed extension changes. This matters in eg. the packager.
2022-11-05 19:12:05 -05:00
GarboMuffin
dcc0d961d7
Automatically load custom extensions saved in project
...
Requires disabled-by-default security manager configuration
2022-10-22 22:02:30 -05:00
GarboMuffin
bede390599
Refactor extension manager's builtin extension check
2022-10-22 21:30:08 -05:00
GarboMuffin
3d75f4759a
Fix incorrect mouse position when clientX or clientY is 0
...
https://github.com/TurboWarp/packager/issues/494
2022-10-21 22:10:22 -05:00
GarboMuffin
d8984c80a2
Ignore error in performance.measure() if browser garbage collects a mark
2022-08-27 22:20:42 -05:00
GarboMuffin
eb600cfcf8
Replace local extended JSON parser with @turbowarp/json
2022-08-14 19:45:30 -05:00
GarboMuffin
dc9b3f6055
Fix error in uint8ArrayToBase64 when input is too large
2022-08-13 14:45:33 -05:00
GarboMuffin
b2e042fde6
Add tests to util_base64.js
2022-08-13 14:40:21 -05:00
GarboMuffin
6db9599f2e
Do not use md5 to generate asset IDs in packaged runtime mode
...
md5 unnecessary in this mode and slows project load by ~10%.
2022-08-05 00:18:09 -05:00
GarboMuffin
b78dc53c8e
Set runtime.isPackaged=true when convertToPackagedRuntime is called
2022-08-05 00:17:47 -05:00
GarboMuffin
3cf6320e9b
Revert "Fix tests now that we always emit field default value"
...
This reverts commit 4325486bef .
2022-08-02 13:05:15 -05:00
GarboMuffin
458b9b7aad
Allow rotation center preservation in exported SVGs
...
Requires additional changes in scratch-gui
2022-08-01 23:50:50 -05:00
GarboMuffin
20258b5a7d
Limit number of concurrent createImageBitmap calls
...
Browsers, especially Chrome, crumble when we try to create too many
image bitmaps at once. So we'll queue them up when too many are
happening. Projects will load slightly slower but this is still much
faster than <img> with data: URIs
2022-07-31 14:06:51 -05:00
GarboMuffin
4325486bef
Fix tests now that we always emit field default value
2022-07-27 17:01:36 -05:00
GarboMuffin
7ea25cbbe8
Fix turbo mode stored in project not appearing in GUI state
2022-07-18 16:34:35 -05:00
Thomas Weber
24bdd21bdd
Disable test that relies on currentStepTime defaulting to null
2022-07-09 16:41:22 -05:00
Thomas Weber
c4fa4a84a8
Set Runtime.currentStepTime to a number by default instead of null
2022-07-09 16:28:28 -05:00
Thomas Weber
95f57eaf96
scratchx: Extract some functions to separate module
2022-07-08 20:03:03 -05:00
Thomas Weber
b182b0afd0
scratchx: Add test for block type ' ' being equivalent to ''
2022-07-08 02:24:55 -05:00
Thomas Weber
651b72f677
scratchx: Add displayName support
2022-07-08 02:22:56 -05:00
Thomas Weber
274cf02d47
scratchx: Fix default value of default argument values
2022-07-07 17:47:55 -05:00
Thomas Weber
3a7e75930a
scratchx: Use shorter prefix for generated extension IDs
...
No projects use this yet so it's safe to change.
2022-07-07 17:47:55 -05:00
Thomas Weber
6bbedd479b
scratchx: Add support for menu arguments using : as a separator
2022-07-07 02:30:37 -05:00
Thomas Weber
9115616f47
scratchx: Add support for more types of separators
2022-07-07 02:21:09 -05:00
Thomas Weber
ef0e7cffe2
scratchx: Implement separators
2022-07-07 02:02:34 -05:00
Thomas Weber
2c693860a2
scratchx: Implement async blocks
2022-07-07 01:50:51 -05:00
Thomas Weber
d991629a49
scratchX: Set Scratch 3 docsURI to ScratchX url
2022-07-07 01:38:23 -05:00
Thomas Weber
f424b2e03e
scratchx: Add menu support
2022-07-07 01:37:00 -05:00
Thomas Weber
65e58845fc
scratchx: Add primitive support for ScratchX extensions
2022-07-07 01:25:19 -05:00
Thomas Weber
7f0291a1ae
Fix addSound error when target does not exist
...
Promise.reject() is not a constructor.
Additionally, rejecting with an Error instead of a string means
developer tools can show proper stack information.
Related to #82
2022-07-01 16:32:08 -05:00
Thomas Weber
f8ec0084ad
Add Runtime#getNumberOfCloudVariables
2022-06-27 22:57:18 -05:00
Thomas Weber
339cdd4453
Move TW runtime tests to separate file, revert unnecessary changes
2022-05-28 19:13:16 -05:00
Thomas Weber
d18af5ab18
Move TW VM tests to separate file
2022-05-28 19:05:27 -05:00
Thomas Weber
3e7b17fa86
Move TW mouse tests to separate file
2022-05-28 19:05:09 -05:00
Thomas Weber
c8502b7928
Move TW keyboard tests to separate file
2022-05-28 19:05:02 -05:00
Thomas Weber
21374cebc7
Rename sound tests
2022-05-28 19:04:50 -05:00
Thomas Weber
1207e5ec2b
Rename pen tests
2022-05-28 19:04:44 -05:00