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
For games that put their entire interface through translate blocks, this
allows them to be more usable when no internet connection is present.
Has convenient side effect of breaking some online detectors.
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.
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.
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.
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.
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.