@swf2es/runtime 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/LICENSE.third-party +422 -0
- package/README.md +29 -2
- package/dist/avm1/activation.d.ts +108 -0
- package/dist/avm1/activation.d.ts.map +1 -0
- package/dist/avm1/activation.js +90 -0
- package/dist/avm1/activation.js.map +1 -0
- package/dist/avm1/case.d.ts +3 -0
- package/dist/avm1/case.d.ts.map +1 -0
- package/dist/avm1/case.js +250 -0
- package/dist/avm1/case.js.map +1 -0
- package/dist/avm1/clips.d.ts +68 -0
- package/dist/avm1/clips.d.ts.map +1 -0
- package/dist/avm1/clips.js +335 -0
- package/dist/avm1/clips.js.map +1 -0
- package/dist/avm1/control.d.ts +54 -0
- package/dist/avm1/control.d.ts.map +1 -0
- package/dist/avm1/control.js +281 -0
- package/dist/avm1/control.js.map +1 -0
- package/dist/avm1/errors.d.ts +49 -0
- package/dist/avm1/errors.d.ts.map +1 -0
- package/dist/avm1/errors.js +51 -0
- package/dist/avm1/errors.js.map +1 -0
- package/dist/avm1/functions.d.ts +94 -0
- package/dist/avm1/functions.d.ts.map +1 -0
- package/dist/avm1/functions.js +250 -0
- package/dist/avm1/functions.js.map +1 -0
- package/dist/avm1/globals/array.d.ts +8 -0
- package/dist/avm1/globals/array.d.ts.map +1 -0
- package/dist/avm1/globals/array.js +550 -0
- package/dist/avm1/globals/array.js.map +1 -0
- package/dist/avm1/globals/broadcaster.d.ts +22 -0
- package/dist/avm1/globals/broadcaster.d.ts.map +1 -0
- package/dist/avm1/globals/broadcaster.js +132 -0
- package/dist/avm1/globals/broadcaster.js.map +1 -0
- package/dist/avm1/globals/date.d.ts +10 -0
- package/dist/avm1/globals/date.d.ts.map +1 -0
- package/dist/avm1/globals/date.js +437 -0
- package/dist/avm1/globals/date.js.map +1 -0
- package/dist/avm1/globals/global.d.ts +23 -0
- package/dist/avm1/globals/global.d.ts.map +1 -0
- package/dist/avm1/globals/global.js +345 -0
- package/dist/avm1/globals/global.js.map +1 -0
- package/dist/avm1/globals/math.d.ts +7 -0
- package/dist/avm1/globals/math.d.ts.map +1 -0
- package/dist/avm1/globals/math.js +140 -0
- package/dist/avm1/globals/math.js.map +1 -0
- package/dist/avm1/globals/number.d.ts +11 -0
- package/dist/avm1/globals/number.d.ts.map +1 -0
- package/dist/avm1/globals/number.js +94 -0
- package/dist/avm1/globals/number.js.map +1 -0
- package/dist/avm1/globals/string.d.ts +8 -0
- package/dist/avm1/globals/string.d.ts.map +1 -0
- package/dist/avm1/globals/string.js +202 -0
- package/dist/avm1/globals/string.js.map +1 -0
- package/dist/avm1/globals/timers.d.ts +49 -0
- package/dist/avm1/globals/timers.d.ts.map +1 -0
- package/dist/avm1/globals/timers.js +130 -0
- package/dist/avm1/globals/timers.js.map +1 -0
- package/dist/avm1/host.d.ts +146 -0
- package/dist/avm1/host.d.ts.map +1 -0
- package/dist/avm1/host.js +6 -0
- package/dist/avm1/host.js.map +1 -0
- package/dist/avm1/index.d.ts +15 -0
- package/dist/avm1/index.d.ts.map +1 -0
- package/dist/avm1/index.js +15 -0
- package/dist/avm1/index.js.map +1 -0
- package/dist/avm1/inheritance.d.ts +25 -0
- package/dist/avm1/inheritance.d.ts.map +1 -0
- package/dist/avm1/inheritance.js +133 -0
- package/dist/avm1/inheritance.js.map +1 -0
- package/dist/avm1/numbers.d.ts +21 -0
- package/dist/avm1/numbers.d.ts.map +1 -0
- package/dist/avm1/numbers.js +299 -0
- package/dist/avm1/numbers.js.map +1 -0
- package/dist/avm1/objects.d.ts +245 -0
- package/dist/avm1/objects.d.ts.map +1 -0
- package/dist/avm1/objects.js +897 -0
- package/dist/avm1/objects.js.map +1 -0
- package/dist/avm1/operators.d.ts +45 -0
- package/dist/avm1/operators.d.ts.map +1 -0
- package/dist/avm1/operators.js +171 -0
- package/dist/avm1/operators.js.map +1 -0
- package/dist/avm1/realm.d.ts +126 -0
- package/dist/avm1/realm.d.ts.map +1 -0
- package/dist/avm1/realm.js +530 -0
- package/dist/avm1/realm.js.map +1 -0
- package/dist/avm1/runtime.d.ts +294 -0
- package/dist/avm1/runtime.d.ts.map +1 -0
- package/dist/avm1/runtime.js +883 -0
- package/dist/avm1/runtime.js.map +1 -0
- package/dist/avm1/scope.d.ts +77 -0
- package/dist/avm1/scope.d.ts.map +1 -0
- package/dist/avm1/scope.js +386 -0
- package/dist/avm1/scope.js.map +1 -0
- package/dist/avm1/urls.d.ts +25 -0
- package/dist/avm1/urls.d.ts.map +1 -0
- package/dist/avm1/urls.js +181 -0
- package/dist/avm1/urls.js.map +1 -0
- package/dist/avm1/values.d.ts +52 -0
- package/dist/avm1/values.d.ts.map +1 -0
- package/dist/avm1/values.js +98 -0
- package/dist/avm1/values.js.map +1 -0
- package/dist/avm2/amf-classes.d.ts +28 -0
- package/dist/avm2/amf-classes.d.ts.map +1 -0
- package/dist/avm2/amf-classes.js +67 -0
- package/dist/avm2/amf-classes.js.map +1 -0
- package/dist/avm2/amf.d.ts +96 -0
- package/dist/avm2/amf.d.ts.map +1 -0
- package/dist/avm2/amf.js +802 -0
- package/dist/avm2/amf.js.map +1 -0
- package/dist/avm2/array-conversion.d.ts +31 -0
- package/dist/avm2/array-conversion.d.ts.map +1 -0
- package/dist/avm2/array-conversion.js +101 -0
- package/dist/avm2/array-conversion.js.map +1 -0
- package/dist/avm2/builtin-library.d.ts +2 -0
- package/dist/avm2/builtin-library.d.ts.map +1 -0
- package/dist/avm2/builtin-library.js +22 -0
- package/dist/avm2/builtin-library.js.map +1 -0
- package/dist/avm2/cache-fill.d.ts +14 -0
- package/dist/avm2/cache-fill.d.ts.map +1 -0
- package/dist/avm2/cache-fill.js +87 -0
- package/dist/avm2/cache-fill.js.map +1 -0
- package/dist/avm2/classes.d.ts +17 -0
- package/dist/avm2/classes.d.ts.map +1 -0
- package/dist/avm2/classes.js +212 -0
- package/dist/avm2/classes.js.map +1 -0
- package/dist/avm2/definitions.d.ts +28 -0
- package/dist/avm2/definitions.d.ts.map +1 -0
- package/dist/avm2/definitions.js +70 -0
- package/dist/avm2/definitions.js.map +1 -0
- package/dist/avm2/descriptors.d.ts +118 -0
- package/dist/avm2/descriptors.d.ts.map +1 -0
- package/dist/avm2/descriptors.js +6 -0
- package/dist/avm2/descriptors.js.map +1 -0
- package/dist/avm2/dictionary-keys.d.ts +73 -0
- package/dist/avm2/dictionary-keys.d.ts.map +1 -0
- package/dist/avm2/dictionary-keys.js +296 -0
- package/dist/avm2/dictionary-keys.js.map +1 -0
- package/dist/avm2/domain-memory.d.ts +23 -0
- package/dist/avm2/domain-memory.d.ts.map +1 -0
- package/dist/avm2/domain-memory.js +76 -0
- package/dist/avm2/domain-memory.js.map +1 -0
- package/dist/avm2/domain.d.ts +108 -0
- package/dist/avm2/domain.d.ts.map +1 -0
- package/dist/avm2/domain.js +281 -0
- package/dist/avm2/domain.js.map +1 -0
- package/dist/avm2/dynamic-properties.d.ts +62 -0
- package/dist/avm2/dynamic-properties.d.ts.map +1 -0
- package/dist/avm2/dynamic-properties.js +183 -0
- package/dist/avm2/dynamic-properties.js.map +1 -0
- package/dist/avm2/enumeration.d.ts +75 -0
- package/dist/avm2/enumeration.d.ts.map +1 -0
- package/dist/avm2/enumeration.js +394 -0
- package/dist/avm2/enumeration.js.map +1 -0
- package/dist/avm2/errors.d.ts +20 -0
- package/dist/avm2/errors.d.ts.map +1 -0
- package/dist/avm2/errors.js +46 -0
- package/dist/avm2/errors.js.map +1 -0
- package/dist/avm2/float-library.d.ts +2 -0
- package/dist/avm2/float-library.d.ts.map +1 -0
- package/dist/avm2/float-library.js +67 -0
- package/dist/avm2/float-library.js.map +1 -0
- package/dist/avm2/float.d.ts +9 -0
- package/dist/avm2/float.d.ts.map +1 -0
- package/dist/avm2/float.js +27 -0
- package/dist/avm2/float.js.map +1 -0
- package/dist/avm2/hooks.d.ts +77 -0
- package/dist/avm2/hooks.d.ts.map +1 -0
- package/dist/avm2/hooks.js +20 -0
- package/dist/avm2/hooks.js.map +1 -0
- package/dist/avm2/index.d.ts +32 -0
- package/dist/avm2/index.d.ts.map +1 -0
- package/dist/avm2/index.js +39 -0
- package/dist/avm2/index.js.map +1 -0
- package/dist/avm2/messages.d.ts +2 -0
- package/dist/avm2/messages.d.ts.map +1 -0
- package/dist/avm2/messages.js +178 -0
- package/dist/avm2/messages.js.map +1 -0
- package/dist/avm2/method-factories.d.ts +35 -0
- package/dist/avm2/method-factories.d.ts.map +1 -0
- package/dist/avm2/method-factories.js +96 -0
- package/dist/avm2/method-factories.js.map +1 -0
- package/dist/avm2/modules.d.ts +40 -0
- package/dist/avm2/modules.d.ts.map +1 -0
- package/dist/avm2/modules.js +106 -0
- package/dist/avm2/modules.js.map +1 -0
- package/dist/avm2/names.d.ts +143 -0
- package/dist/avm2/names.d.ts.map +1 -0
- package/dist/avm2/names.js +249 -0
- package/dist/avm2/names.js.map +1 -0
- package/dist/avm2/natives/aliases.d.ts +3 -0
- package/dist/avm2/natives/aliases.d.ts.map +1 -0
- package/dist/avm2/natives/aliases.js +48 -0
- package/dist/avm2/natives/aliases.js.map +1 -0
- package/dist/avm2/natives/array.d.ts +5 -0
- package/dist/avm2/natives/array.d.ts.map +1 -0
- package/dist/avm2/natives/array.js +391 -0
- package/dist/avm2/natives/array.js.map +1 -0
- package/dist/avm2/natives/bytearray.d.ts +180 -0
- package/dist/avm2/natives/bytearray.d.ts.map +1 -0
- package/dist/avm2/natives/bytearray.js +1228 -0
- package/dist/avm2/natives/bytearray.js.map +1 -0
- package/dist/avm2/natives/case.d.ts +5 -0
- package/dist/avm2/natives/case.d.ts.map +1 -0
- package/dist/avm2/natives/case.js +89 -0
- package/dist/avm2/natives/case.js.map +1 -0
- package/dist/avm2/natives/concurrent.d.ts +24 -0
- package/dist/avm2/natives/concurrent.d.ts.map +1 -0
- package/dist/avm2/natives/concurrent.js +200 -0
- package/dist/avm2/natives/concurrent.js.map +1 -0
- package/dist/avm2/natives/date.d.ts +5 -0
- package/dist/avm2/natives/date.d.ts.map +1 -0
- package/dist/avm2/natives/date.js +582 -0
- package/dist/avm2/natives/date.js.map +1 -0
- package/dist/avm2/natives/define.d.ts +58 -0
- package/dist/avm2/natives/define.d.ts.map +1 -0
- package/dist/avm2/natives/define.js +131 -0
- package/dist/avm2/natives/define.js.map +1 -0
- package/dist/avm2/natives/describe.d.ts +3 -0
- package/dist/avm2/natives/describe.d.ts.map +1 -0
- package/dist/avm2/natives/describe.js +352 -0
- package/dist/avm2/natives/describe.js.map +1 -0
- package/dist/avm2/natives/dictionary.d.ts +3 -0
- package/dist/avm2/natives/dictionary.d.ts.map +1 -0
- package/dist/avm2/natives/dictionary.js +13 -0
- package/dist/avm2/natives/dictionary.js.map +1 -0
- package/dist/avm2/natives/float-vector.d.ts +20 -0
- package/dist/avm2/natives/float-vector.d.ts.map +1 -0
- package/dist/avm2/natives/float-vector.js +82 -0
- package/dist/avm2/natives/float-vector.js.map +1 -0
- package/dist/avm2/natives/float.d.ts +5 -0
- package/dist/avm2/natives/float.d.ts.map +1 -0
- package/dist/avm2/natives/float.js +97 -0
- package/dist/avm2/natives/float.js.map +1 -0
- package/dist/avm2/natives/index.d.ts +7 -0
- package/dist/avm2/natives/index.d.ts.map +1 -0
- package/dist/avm2/natives/index.js +65 -0
- package/dist/avm2/natives/index.js.map +1 -0
- package/dist/avm2/natives/json.d.ts +3 -0
- package/dist/avm2/natives/json.d.ts.map +1 -0
- package/dist/avm2/natives/json.js +515 -0
- package/dist/avm2/natives/json.js.map +1 -0
- package/dist/avm2/natives/number.d.ts +15 -0
- package/dist/avm2/natives/number.d.ts.map +1 -0
- package/dist/avm2/natives/number.js +163 -0
- package/dist/avm2/natives/number.js.map +1 -0
- package/dist/avm2/natives/object.d.ts +8 -0
- package/dist/avm2/natives/object.d.ts.map +1 -0
- package/dist/avm2/natives/object.js +238 -0
- package/dist/avm2/natives/object.js.map +1 -0
- package/dist/avm2/natives/proxy.d.ts +5 -0
- package/dist/avm2/natives/proxy.d.ts.map +1 -0
- package/dist/avm2/natives/proxy.js +76 -0
- package/dist/avm2/natives/proxy.js.map +1 -0
- package/dist/avm2/natives/regexp.d.ts +21 -0
- package/dist/avm2/natives/regexp.d.ts.map +1 -0
- package/dist/avm2/natives/regexp.js +486 -0
- package/dist/avm2/natives/regexp.js.map +1 -0
- package/dist/avm2/natives/shell-workers.d.ts +140 -0
- package/dist/avm2/natives/shell-workers.d.ts.map +1 -0
- package/dist/avm2/natives/shell-workers.js +405 -0
- package/dist/avm2/natives/shell-workers.js.map +1 -0
- package/dist/avm2/natives/shell.d.ts +12 -0
- package/dist/avm2/natives/shell.d.ts.map +1 -0
- package/dist/avm2/natives/shell.js +558 -0
- package/dist/avm2/natives/shell.js.map +1 -0
- package/dist/avm2/natives/sort.d.ts +7 -0
- package/dist/avm2/natives/sort.d.ts.map +1 -0
- package/dist/avm2/natives/sort.js +378 -0
- package/dist/avm2/natives/sort.js.map +1 -0
- package/dist/avm2/natives/string.d.ts +5 -0
- package/dist/avm2/natives/string.d.ts.map +1 -0
- package/dist/avm2/natives/string.js +133 -0
- package/dist/avm2/natives/string.js.map +1 -0
- package/dist/avm2/natives/sync.d.ts +215 -0
- package/dist/avm2/natives/sync.d.ts.map +1 -0
- package/dist/avm2/natives/sync.js +822 -0
- package/dist/avm2/natives/sync.js.map +1 -0
- package/dist/avm2/natives/toplevel.d.ts +5 -0
- package/dist/avm2/natives/toplevel.d.ts.map +1 -0
- package/dist/avm2/natives/toplevel.js +140 -0
- package/dist/avm2/natives/toplevel.js.map +1 -0
- package/dist/avm2/natives/vector-elements.d.ts +10 -0
- package/dist/avm2/natives/vector-elements.d.ts.map +1 -0
- package/dist/avm2/natives/vector-elements.js +47 -0
- package/dist/avm2/natives/vector-elements.js.map +1 -0
- package/dist/avm2/natives/vector.d.ts +5 -0
- package/dist/avm2/natives/vector.d.ts.map +1 -0
- package/dist/avm2/natives/vector.js +407 -0
- package/dist/avm2/natives/vector.js.map +1 -0
- package/dist/avm2/natives/xml/access.d.ts +34 -0
- package/dist/avm2/natives/xml/access.d.ts.map +1 -0
- package/dist/avm2/natives/xml/access.js +634 -0
- package/dist/avm2/natives/xml/access.js.map +1 -0
- package/dist/avm2/natives/xml/build.d.ts +11 -0
- package/dist/avm2/natives/xml/build.d.ts.map +1 -0
- package/dist/avm2/natives/xml/build.js +292 -0
- package/dist/avm2/natives/xml/build.js.map +1 -0
- package/dist/avm2/natives/xml/chars.d.ts +9 -0
- package/dist/avm2/natives/xml/chars.d.ts.map +1 -0
- package/dist/avm2/natives/xml/chars.js +113 -0
- package/dist/avm2/natives/xml/chars.js.map +1 -0
- package/dist/avm2/natives/xml/escape.d.ts +5 -0
- package/dist/avm2/natives/xml/escape.d.ts.map +1 -0
- package/dist/avm2/natives/xml/escape.js +39 -0
- package/dist/avm2/natives/xml/escape.js.map +1 -0
- package/dist/avm2/natives/xml/names.d.ts +46 -0
- package/dist/avm2/natives/xml/names.d.ts.map +1 -0
- package/dist/avm2/natives/xml/names.js +205 -0
- package/dist/avm2/natives/xml/names.js.map +1 -0
- package/dist/avm2/natives/xml/node.d.ts +94 -0
- package/dist/avm2/natives/xml/node.d.ts.map +1 -0
- package/dist/avm2/natives/xml/node.js +273 -0
- package/dist/avm2/natives/xml/node.js.map +1 -0
- package/dist/avm2/natives/xml/operators.d.ts +7 -0
- package/dist/avm2/natives/xml/operators.d.ts.map +1 -0
- package/dist/avm2/natives/xml/operators.js +70 -0
- package/dist/avm2/natives/xml/operators.js.map +1 -0
- package/dist/avm2/natives/xml/parser.d.ts +51 -0
- package/dist/avm2/natives/xml/parser.d.ts.map +1 -0
- package/dist/avm2/natives/xml/parser.js +357 -0
- package/dist/avm2/natives/xml/parser.js.map +1 -0
- package/dist/avm2/natives/xml/strings.d.ts +10 -0
- package/dist/avm2/natives/xml/strings.d.ts.map +1 -0
- package/dist/avm2/natives/xml/strings.js +192 -0
- package/dist/avm2/natives/xml/strings.js.map +1 -0
- package/dist/avm2/natives/xml/values.d.ts +48 -0
- package/dist/avm2/natives/xml/values.d.ts.map +1 -0
- package/dist/avm2/natives/xml/values.js +123 -0
- package/dist/avm2/natives/xml/values.js.map +1 -0
- package/dist/avm2/natives/xml/xml.d.ts +5 -0
- package/dist/avm2/natives/xml/xml.d.ts.map +1 -0
- package/dist/avm2/natives/xml/xml.js +646 -0
- package/dist/avm2/natives/xml/xml.js.map +1 -0
- package/dist/avm2/number-strings.d.ts +28 -0
- package/dist/avm2/number-strings.d.ts.map +1 -0
- package/dist/avm2/number-strings.js +111 -0
- package/dist/avm2/number-strings.js.map +1 -0
- package/dist/avm2/numbers.d.ts +12 -0
- package/dist/avm2/numbers.d.ts.map +1 -0
- package/dist/avm2/numbers.js +559 -0
- package/dist/avm2/numbers.js.map +1 -0
- package/dist/avm2/options.d.ts +105 -0
- package/dist/avm2/options.d.ts.map +1 -0
- package/dist/avm2/options.js +17 -0
- package/dist/avm2/options.js.map +1 -0
- package/dist/avm2/player-messages.d.ts +3 -0
- package/dist/avm2/player-messages.d.ts.map +1 -0
- package/dist/avm2/player-messages.js +551 -0
- package/dist/avm2/player-messages.js.map +1 -0
- package/dist/avm2/property-cache.d.ts +61 -0
- package/dist/avm2/property-cache.d.ts.map +1 -0
- package/dist/avm2/property-cache.js +136 -0
- package/dist/avm2/property-cache.js.map +1 -0
- package/dist/avm2/runtime.d.ts +588 -0
- package/dist/avm2/runtime.d.ts.map +1 -0
- package/dist/avm2/runtime.js +2645 -0
- package/dist/avm2/runtime.js.map +1 -0
- package/dist/avm2/traits.d.ts +233 -0
- package/dist/avm2/traits.d.ts.map +1 -0
- package/dist/avm2/traits.js +510 -0
- package/dist/avm2/traits.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -3
- package/src/avm1/activation.ts +114 -0
- package/src/avm1/case.ts +257 -0
- package/src/avm1/clips.ts +440 -0
- package/src/avm1/control.ts +339 -0
- package/src/avm1/errors.ts +60 -0
- package/src/avm1/functions.ts +271 -0
- package/src/avm1/globals/array.ts +676 -0
- package/src/avm1/globals/broadcaster.ts +185 -0
- package/src/avm1/globals/date.ts +548 -0
- package/src/avm1/globals/global.ts +420 -0
- package/src/avm1/globals/math.ts +152 -0
- package/src/avm1/globals/number.ts +122 -0
- package/src/avm1/globals/string.ts +254 -0
- package/src/avm1/globals/timers.ts +144 -0
- package/src/avm1/host.ts +155 -0
- package/src/avm1/index.ts +69 -0
- package/src/avm1/inheritance.ts +159 -0
- package/src/avm1/numbers.ts +348 -0
- package/src/avm1/objects.ts +1080 -0
- package/src/avm1/operators.ts +229 -0
- package/src/avm1/realm.ts +704 -0
- package/src/avm1/runtime.ts +1291 -0
- package/src/avm1/scope.ts +482 -0
- package/src/avm1/urls.ts +226 -0
- package/src/avm1/values.ts +145 -0
- package/src/avm2/amf-classes.ts +80 -0
- package/src/avm2/amf.ts +913 -0
- package/src/avm2/array-conversion.ts +117 -0
- package/src/avm2/builtin-library.ts +28 -0
- package/src/avm2/cache-fill.ts +124 -0
- package/src/avm2/classes.ts +235 -0
- package/src/avm2/definitions.ts +93 -0
- package/src/avm2/descriptors.ts +137 -0
- package/src/avm2/dictionary-keys.ts +345 -0
- package/src/avm2/domain-memory.ts +95 -0
- package/src/avm2/domain.ts +335 -0
- package/src/avm2/dynamic-properties.ts +209 -0
- package/src/avm2/enumeration.ts +506 -0
- package/src/avm2/errors.ts +54 -0
- package/src/avm2/float-library.ts +66 -0
- package/src/avm2/float.ts +31 -0
- package/src/avm2/hooks.ts +97 -0
- package/src/avm2/index.ts +84 -0
- package/src/avm2/messages.ts +178 -0
- package/src/avm2/method-factories.ts +130 -0
- package/src/avm2/modules.ts +120 -0
- package/src/avm2/names.ts +292 -0
- package/src/avm2/natives/aliases.ts +59 -0
- package/src/avm2/natives/array.ts +482 -0
- package/src/avm2/natives/bytearray.ts +1474 -0
- package/src/avm2/natives/case.ts +98 -0
- package/src/avm2/natives/concurrent.ts +268 -0
- package/src/avm2/natives/date.ts +678 -0
- package/src/avm2/natives/define.ts +176 -0
- package/src/avm2/natives/describe.ts +426 -0
- package/src/avm2/natives/dictionary.ts +18 -0
- package/src/avm2/natives/float-vector.ts +99 -0
- package/src/avm2/natives/float.ts +116 -0
- package/src/avm2/natives/index.ts +70 -0
- package/src/avm2/natives/json.ts +600 -0
- package/src/avm2/natives/number.ts +194 -0
- package/src/avm2/natives/object.ts +272 -0
- package/src/avm2/natives/proxy.ts +98 -0
- package/src/avm2/natives/regexp.ts +580 -0
- package/src/avm2/natives/shell-workers.ts +474 -0
- package/src/avm2/natives/shell.ts +707 -0
- package/src/avm2/natives/sort.ts +438 -0
- package/src/avm2/natives/string.ts +158 -0
- package/src/avm2/natives/sync.ts +964 -0
- package/src/avm2/natives/toplevel.ts +163 -0
- package/src/avm2/natives/vector-elements.ts +61 -0
- package/src/avm2/natives/vector.ts +511 -0
- package/src/avm2/natives/xml/access.ts +767 -0
- package/src/avm2/natives/xml/build.ts +381 -0
- package/src/avm2/natives/xml/chars.ts +127 -0
- package/src/avm2/natives/xml/escape.ts +46 -0
- package/src/avm2/natives/xml/names.ts +256 -0
- package/src/avm2/natives/xml/node.ts +339 -0
- package/src/avm2/natives/xml/operators.ts +90 -0
- package/src/avm2/natives/xml/parser.ts +414 -0
- package/src/avm2/natives/xml/strings.ts +241 -0
- package/src/avm2/natives/xml/values.ts +162 -0
- package/src/avm2/natives/xml/xml.ts +829 -0
- package/src/avm2/number-strings.ts +127 -0
- package/src/avm2/numbers.ts +605 -0
- package/src/avm2/options.ts +125 -0
- package/src/avm2/player-messages.ts +552 -0
- package/src/avm2/property-cache.ts +160 -0
- package/src/avm2/runtime.ts +3274 -0
- package/src/avm2/traits.ts +584 -0
- package/src/index.ts +8 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// What the natives and a player plug into the runtime for the builtin
|
|
2
|
+
// classes that differ from others: how they allocate, index, resolve
|
|
3
|
+
// names, and are called and constructed.
|
|
4
|
+
|
|
5
|
+
import type { AsObject, Method, Value } from "./descriptors.js";
|
|
6
|
+
import { type Multiname, NS_Public } from "./names.js";
|
|
7
|
+
import type { Runtime } from "./runtime.js";
|
|
8
|
+
import { BIND_Method, type Traits } from "./traits.js";
|
|
9
|
+
|
|
10
|
+
/** How a class that holds its own elements indexes them. */
|
|
11
|
+
export interface IndexHook {
|
|
12
|
+
getIndex: (o: AsObject, i: number, rt: Runtime) => Value;
|
|
13
|
+
setIndex: (o: AsObject, i: number, v: Value, rt: Runtime) => void;
|
|
14
|
+
hasIndex: (o: AsObject, i: number) => boolean;
|
|
15
|
+
/** A name's element index, -1 if it names none; the class's own rule, else an array index's. */
|
|
16
|
+
index?: (o: AsObject, name: string, rt: Runtime) => number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* How a class's instances resolve the names their traits do not bind, in
|
|
21
|
+
* place of dynamic properties, as XML and XMLList do (E4X's [[Get]] and so
|
|
22
|
+
* on): each operation, their enumeration, and their equality and +.
|
|
23
|
+
*/
|
|
24
|
+
export interface PropertyHook {
|
|
25
|
+
/**
|
|
26
|
+
* Whether a public method's name resolves through the hook too, as a
|
|
27
|
+
* child or attribute of XML hides the methods of its names, or is the
|
|
28
|
+
* method the traits bind, as a Proxy's is.
|
|
29
|
+
*/
|
|
30
|
+
hidesMethods: boolean;
|
|
31
|
+
get(rt: Runtime, o: AsObject, mn: Multiname): Value;
|
|
32
|
+
set(rt: Runtime, o: AsObject, mn: Multiname, v: Value): void;
|
|
33
|
+
delete(rt: Runtime, o: AsObject, mn: Multiname): boolean;
|
|
34
|
+
has(rt: Runtime, o: AsObject, mn: Multiname): boolean;
|
|
35
|
+
/** callproperty: what a name calls, looked for as the class does. */
|
|
36
|
+
callee(rt: Runtime, o: AsObject, mn: Multiname): Value;
|
|
37
|
+
descendants(rt: Runtime, o: AsObject, mn: Multiname): Value;
|
|
38
|
+
/** The index after `index` for a for-in, or 0; and the name and value at one. */
|
|
39
|
+
nextIndex(rt: Runtime, o: AsObject, index: number): number;
|
|
40
|
+
nextName(rt: Runtime, o: AsObject, index: number): Value;
|
|
41
|
+
nextValue(rt: Runtime, o: AsObject, index: number): Value;
|
|
42
|
+
/** ==, when either side is an instance, or undefined to leave it to the rest. */
|
|
43
|
+
equals(rt: Runtime, a: Value, b: Value): boolean | undefined;
|
|
44
|
+
/** +, when both sides are an instance or another hooked class's, or undefined. */
|
|
45
|
+
add(rt: Runtime, a: Value, b: Value): Value;
|
|
46
|
+
/** An instance's string, as its primitive value. */
|
|
47
|
+
toString(rt: Runtime, o: AsObject): string;
|
|
48
|
+
/** An instance as XML text, as esc_xelem writes it. */
|
|
49
|
+
toXMLString(rt: Runtime, o: AsObject): string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Whether a hooked class's hook resolves `mn`, bound to `b`: a name its
|
|
54
|
+
* traits do not bind, an attribute's, or a public name of a method, as a
|
|
55
|
+
* child or attribute of XML hides the methods of its names (as avmplus'
|
|
56
|
+
* getproperty does for XML and XMLList).
|
|
57
|
+
*/
|
|
58
|
+
export function hookedBinding(b: number, mn: Multiname, hook: PropertyHook): boolean {
|
|
59
|
+
if (b === 0 || mn.attribute) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
hook.hidesMethods &&
|
|
65
|
+
(b & 7) === BIND_Method &&
|
|
66
|
+
mn.namespaces.some((ns) => ns?.kind === NS_Public && ns.uri === "")
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Natives by name, or a function that makes them for the runtime they will serve. */
|
|
71
|
+
export type NativesProvider =
|
|
72
|
+
| Record<string, (rt: Runtime) => Method>
|
|
73
|
+
| ((rt: Runtime) => Record<string, (rt: Runtime) => Method>);
|
|
74
|
+
|
|
75
|
+
/** How a builtin class differs from others: allocation, index access, calls and construction. */
|
|
76
|
+
export interface ClassHook {
|
|
77
|
+
/** How its instances resolve names, as XML's (Traits.properties). */
|
|
78
|
+
properties?: PropertyHook;
|
|
79
|
+
/** A playerglobal set-only accessor whose bodyless setter stores in an instance slot. */
|
|
80
|
+
setOnlySlots?: Record<string, string>;
|
|
81
|
+
create?: (traits: Traits, rt: Runtime) => AsObject;
|
|
82
|
+
/** Its prototype object, when not an Object: an instance of the class, as Date's (its $it is ready). */
|
|
83
|
+
prototype?: (rt: Runtime, cls: AsObject) => AsObject;
|
|
84
|
+
/** Whether its instances refuse any name but their own and an index, as a Vector's (Traits.refusesNames). */
|
|
85
|
+
refusesNames?: boolean;
|
|
86
|
+
getIndex?: IndexHook["getIndex"];
|
|
87
|
+
setIndex?: IndexHook["setIndex"];
|
|
88
|
+
hasIndex?: IndexHook["hasIndex"];
|
|
89
|
+
index?: IndexHook["index"];
|
|
90
|
+
construct?: (rt: Runtime, cls: AsObject, args: Value[]) => Value;
|
|
91
|
+
call?: (rt: Runtime, cls: AsObject, args: Value[]) => Value;
|
|
92
|
+
apply?: (rt: Runtime, factory: AsObject, params: Value[]) => AsObject;
|
|
93
|
+
/** What the VM sets up on the class once its static initializer has run, as avmshell's Worker.current. */
|
|
94
|
+
created?: (rt: Runtime, cls: AsObject) => void;
|
|
95
|
+
/** As construct="restricted": a subclass from another ABC cannot be constructed, nor what extends it. */
|
|
96
|
+
restricted?: boolean;
|
|
97
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// The AVM2 runtime: what generated modules call as `rt`.
|
|
2
|
+
import { builtinHooks, builtinNatives } from "./natives/index.js";
|
|
3
|
+
import type { RuntimeOptions } from "./options.js";
|
|
4
|
+
import { Runtime } from "./runtime.js";
|
|
5
|
+
|
|
6
|
+
export { Reader as Amf3Reader, Writer as Amf3Writer } from "./amf.js";
|
|
7
|
+
/** avmplus' builtin.abc (MPL-2.0), which every runtime loads first. */
|
|
8
|
+
export { builtinLibrary } from "./builtin-library.js";
|
|
9
|
+
export type { Abc, AsObject, CompileUnit, FoundDefinition, Method, Value } from "./descriptors.js";
|
|
10
|
+
export { type Domain, frameScripts, frameSites, siteScript, stackFrames } from "./domain.js";
|
|
11
|
+
export { FloatValue, hasFloatLibrary } from "./float.js";
|
|
12
|
+
export { floatLibrary } from "./float-library.js";
|
|
13
|
+
export type { ClassHook, NativesProvider } from "./hooks.js";
|
|
14
|
+
export { messages } from "./messages.js";
|
|
15
|
+
export { publicNs, qname } from "./names.js";
|
|
16
|
+
export {
|
|
17
|
+
Bytes,
|
|
18
|
+
byteArrayHook,
|
|
19
|
+
bytesOf,
|
|
20
|
+
canShareMemory,
|
|
21
|
+
GLOBAL_MEMORY_MIN_SIZE,
|
|
22
|
+
notIsolated,
|
|
23
|
+
type SharedBytesMemory,
|
|
24
|
+
setDomainMemory,
|
|
25
|
+
shareBytes,
|
|
26
|
+
sharedByteArray,
|
|
27
|
+
} from "./natives/bytearray.js";
|
|
28
|
+
export {
|
|
29
|
+
type SyncRef,
|
|
30
|
+
syncError,
|
|
31
|
+
syncObject,
|
|
32
|
+
syncOf,
|
|
33
|
+
syncRef,
|
|
34
|
+
} from "./natives/concurrent.js";
|
|
35
|
+
export type { Natives } from "./natives/define.js";
|
|
36
|
+
export { type NativeClass, plain, registerNativeClass } from "./natives/define.js";
|
|
37
|
+
// The builtins' natives and hooks, for a player that adds playerglobal's to them.
|
|
38
|
+
export { builtinHooks, builtinNatives } from "./natives/index.js";
|
|
39
|
+
export {
|
|
40
|
+
endShellWorker,
|
|
41
|
+
shellWorkerTerminated,
|
|
42
|
+
startShellWorker,
|
|
43
|
+
} from "./natives/shell-workers.js";
|
|
44
|
+
export {
|
|
45
|
+
newSyncMemory,
|
|
46
|
+
SCRIPT_TIMEOUT,
|
|
47
|
+
Sync,
|
|
48
|
+
SyncFull,
|
|
49
|
+
type SyncInit,
|
|
50
|
+
type SyncMemory,
|
|
51
|
+
SyncTerminated,
|
|
52
|
+
SyncTimeout,
|
|
53
|
+
} from "./natives/sync.js";
|
|
54
|
+
// avmplus' XML tokenizer, which playerglobal's flash.xml.XMLDocument parses with too.
|
|
55
|
+
export { XMLParser, XMLTag } from "./natives/xml/parser.js";
|
|
56
|
+
export type {
|
|
57
|
+
RuntimeOptions,
|
|
58
|
+
ShellFiles,
|
|
59
|
+
ShellThread,
|
|
60
|
+
ShellWorkerHost,
|
|
61
|
+
ShellWorkerInit,
|
|
62
|
+
ShellWorkersMemory,
|
|
63
|
+
} from "./options.js";
|
|
64
|
+
export { errorMessages } from "./player-messages.js";
|
|
65
|
+
// A destroyed host must not remain reachable through shared inline-cache entries.
|
|
66
|
+
export { invalidate as clearPropertyCaches } from "./property-cache.js";
|
|
67
|
+
export { Runtime } from "./runtime.js";
|
|
68
|
+
// methodKey: where a method sits on its traits, for a player that makes a closure of its own.
|
|
69
|
+
export { instanceVarField, methodKey, setStaticVar } from "./traits.js";
|
|
70
|
+
|
|
71
|
+
/** A runtime with the builtins' natives, for modules compiled from builtin.abc and after. */
|
|
72
|
+
export function createRuntime(options: RuntimeOptions = {}): Runtime {
|
|
73
|
+
return new Runtime(builtinNatives, builtinHooks(), options);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** AS3 `int(value)`: ToInt32(ToNumber(value)). */
|
|
77
|
+
export function toInt(value: unknown): number {
|
|
78
|
+
return Number(value) | 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** AS3 `uint(value)`: ToUint32(ToNumber(value)). */
|
|
82
|
+
export function toUint(value: unknown): number {
|
|
83
|
+
return Number(value) >>> 0;
|
|
84
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Error messages of avmplus, in English, by error number.
|
|
2
|
+
//
|
|
3
|
+
// Generated from oracle/avmplus/core/ErrorConstants.cpp; not to be edited.
|
|
4
|
+
// Derived from avmplus, this file is subject to the Mozilla Public License,
|
|
5
|
+
// v. 2.0: http://mozilla.org/MPL/2.0/.
|
|
6
|
+
|
|
7
|
+
export const messages: Record<number, string> = {
|
|
8
|
+
1000: "The system is out of memory.",
|
|
9
|
+
1001: "The method %1 is not implemented.",
|
|
10
|
+
1002: "Number.toPrecision has a range of 1 to 21. Number.toFixed and Number.toExponential have a range of 0 to 20. Specified value is not within expected range.",
|
|
11
|
+
1003: "The radix argument must be between 2 and 36; got %1.",
|
|
12
|
+
1004: "Method %1 was invoked on an incompatible object.",
|
|
13
|
+
1005: "Array index is not a positive integer (%1).",
|
|
14
|
+
1006: "%1 is not a function.",
|
|
15
|
+
1007: "Instantiation attempted on a non-constructor.",
|
|
16
|
+
1008: "%1 is ambiguous; Found more than one matching binding.",
|
|
17
|
+
1009: "Cannot access a property or method of a null object reference.",
|
|
18
|
+
1010: "A term is undefined and has no properties.",
|
|
19
|
+
1011: "Method %1 contained illegal opcode %2 at offset %3.",
|
|
20
|
+
1012: "The last instruction exceeded code size.",
|
|
21
|
+
1013: "Cannot call OP_findproperty when scopeDepth is 0.",
|
|
22
|
+
1014: "Class %1 could not be found.",
|
|
23
|
+
1015: "Method %1 cannot set default xml namespace",
|
|
24
|
+
1016: "Descendants operator (..) not supported on type %1.",
|
|
25
|
+
1017: "Scope stack overflow occurred.",
|
|
26
|
+
1018: "Scope stack underflow occurred.",
|
|
27
|
+
1019: "Getscopeobject %1 is out of bounds.",
|
|
28
|
+
1020: "Code cannot fall off the end of a method.",
|
|
29
|
+
1021: "At least one branch target was not on a valid instruction in the method.",
|
|
30
|
+
1022: "Type void may only be used as a function return type.",
|
|
31
|
+
1023: "Stack overflow occurred.",
|
|
32
|
+
1024: "Stack underflow occurred.",
|
|
33
|
+
1025: "An invalid register %1 was accessed.",
|
|
34
|
+
1026: "Slot %1 exceeds slotCount=%2 of %3.",
|
|
35
|
+
1027: "Method_info %1 exceeds method_count=%2.",
|
|
36
|
+
1028: "Disp_id %1 exceeds max_disp_id=%2 of %3.",
|
|
37
|
+
1029: "Disp_id %1 is undefined on %2.",
|
|
38
|
+
1030: "Stack depth is unbalanced. %1 != %2.",
|
|
39
|
+
1031: "Scope depth is unbalanced. %1 != %2.",
|
|
40
|
+
1032: "Cpool index %1 is out of range %2.",
|
|
41
|
+
1033: "Cpool entry %1 is wrong type.",
|
|
42
|
+
1034: "Type Coercion failed: cannot convert %1 to %2.",
|
|
43
|
+
1035: "Illegal super expression found in method %1.",
|
|
44
|
+
1037: "Cannot assign to a method %1 on %2.",
|
|
45
|
+
1038: "%1 is already defined.",
|
|
46
|
+
1039: "Cannot verify method until it is referenced.",
|
|
47
|
+
1040: "The right-hand side of instanceof must be a class or function.",
|
|
48
|
+
1041: "The right-hand side of operator must be a class.",
|
|
49
|
+
1042: "Not an ABC file. major_version=%1 minor_version=%2.",
|
|
50
|
+
1043: "Invalid code_length=%1.",
|
|
51
|
+
1044: "MethodInfo-%1 unsupported flags=%2.",
|
|
52
|
+
1045: "Unsupported traits kind=%1.",
|
|
53
|
+
1046: "MethodInfo-%1 referenced before definition.",
|
|
54
|
+
1047: "No entry point was found.",
|
|
55
|
+
1049: "Prototype objects must be vanilla Objects.",
|
|
56
|
+
1050: "Cannot convert %1 to primitive.",
|
|
57
|
+
1051: "Illegal early binding access to %1.",
|
|
58
|
+
1052: "Invalid URI passed to %1 function.",
|
|
59
|
+
1053: "Illegal override of %1 in %2.",
|
|
60
|
+
1054: "Illegal range or target offsets in exception handler.",
|
|
61
|
+
1056: "Cannot create property %1 on %2.",
|
|
62
|
+
1057: "%1 can only contain methods.",
|
|
63
|
+
1058: "Illegal operand type: %1 must be %2.",
|
|
64
|
+
1059: "ClassInfo-%1 is referenced before definition.",
|
|
65
|
+
1060: "ClassInfo %1 exceeds class_count=%2.",
|
|
66
|
+
1061: "The value %1 cannot be converted to %2 without losing precision.",
|
|
67
|
+
1063: "Argument count mismatch on %1. Expected %2, got %3.",
|
|
68
|
+
1064: "Cannot call method %1 as constructor.",
|
|
69
|
+
1065: "Variable %1 is not defined.",
|
|
70
|
+
1066: "The form function('function body') is not supported.",
|
|
71
|
+
1067: "Native method %1 has illegal method body.",
|
|
72
|
+
1068: "%1 and %2 cannot be reconciled.",
|
|
73
|
+
1069: "Property %1 not found on %2 and there is no default value.",
|
|
74
|
+
1070: "Method %1 not found on %2",
|
|
75
|
+
1071: "Function %1 has already been bound to %2.",
|
|
76
|
+
1072: "Disp_id 0 is illegal.",
|
|
77
|
+
1073: "Non-override method %1 replaced because of duplicate disp_id %2.",
|
|
78
|
+
1074: "Illegal write to read-only property %1 on %2.",
|
|
79
|
+
1075: "Math is not a function.",
|
|
80
|
+
1076: "Math is not a constructor.",
|
|
81
|
+
1077: "Illegal read of write-only property %1 on %2.",
|
|
82
|
+
1078: "Illegal opcode/multiname combination: %1<%2>.",
|
|
83
|
+
1079: "Native methods are not allowed in loaded code.",
|
|
84
|
+
1080: "Illegal value for namespace.",
|
|
85
|
+
1081: "Property %1 not found on %2 and there is no default value.",
|
|
86
|
+
1082: "No default namespace has been set.",
|
|
87
|
+
1083: 'The prefix "%1" for element "%2" is not bound.',
|
|
88
|
+
1084: "Element or attribute (\"%1\") does not match QName production: QName::=(NCName':')?NCName.",
|
|
89
|
+
1085: 'The element type "%1" must be terminated by the matching end-tag "</%2>".',
|
|
90
|
+
1086: "The %1 method only works on lists containing one item.",
|
|
91
|
+
1087: "Assignment to indexed XML is not allowed.",
|
|
92
|
+
1088: "The markup in the document following the root element must be well-formed.",
|
|
93
|
+
1089: "Assignment to lists with more than one item is not supported.",
|
|
94
|
+
1090: "XML parser failure: element is malformed.",
|
|
95
|
+
1091: "XML parser failure: Unterminated CDATA section.",
|
|
96
|
+
1092: "XML parser failure: Unterminated XML declaration.",
|
|
97
|
+
1093: "XML parser failure: Unterminated DOCTYPE declaration.",
|
|
98
|
+
1094: "XML parser failure: Unterminated comment.",
|
|
99
|
+
1095: "XML parser failure: Unterminated attribute.",
|
|
100
|
+
1096: "XML parser failure: Unterminated element.",
|
|
101
|
+
1097: "XML parser failure: Unterminated processing instruction.",
|
|
102
|
+
1098: "Illegal prefix %1 for no namespace.",
|
|
103
|
+
1100: "Cannot supply flags when constructing one RegExp from another.",
|
|
104
|
+
1101: "Cannot verify method %1 with unknown scope.",
|
|
105
|
+
1102: "Illegal default value for type %1.",
|
|
106
|
+
1103: "Class %1 cannot extend final base class.",
|
|
107
|
+
1104: 'Attribute "%1" was already specified for element "%2".',
|
|
108
|
+
1107: "The ABC data is corrupt, attempt to read out of bounds.",
|
|
109
|
+
1108: "The OP_newclass opcode was used with the incorrect base class.",
|
|
110
|
+
1109: "Attempt to directly call unbound function %1 from method %2.",
|
|
111
|
+
1110: "%1 cannot extend %2.",
|
|
112
|
+
1111: "%1 cannot implement %2.",
|
|
113
|
+
1112: "Argument count mismatch on class coercion. Expected 1, got %1.",
|
|
114
|
+
1113: "OP_newactivation used in method without NEED_ACTIVATION flag.",
|
|
115
|
+
1114: "OP_getglobalslot or OP_setglobalslot used with no global scope.",
|
|
116
|
+
1115: "%1 is not a constructor.",
|
|
117
|
+
1116: "second argument to Function.prototype.apply must be an array.",
|
|
118
|
+
1117: "Invalid XML name: %1.",
|
|
119
|
+
1118: "Illegal cyclical loop between nodes.",
|
|
120
|
+
1119: "Delete operator is not supported with operand of type %1.",
|
|
121
|
+
1120: "Cannot delete property %1 on %2.",
|
|
122
|
+
1121: "Method %1 has a duplicate method body.",
|
|
123
|
+
1122: "Interface method %1 has illegal method body.",
|
|
124
|
+
1123: "Filter operator not supported on type %1.",
|
|
125
|
+
1124: "OP_hasnext2 requires object and index to be distinct registers.",
|
|
126
|
+
1125: "The index %1 is out of range %2.",
|
|
127
|
+
1126: "Cannot change the length of a fixed Vector.",
|
|
128
|
+
1127: "Type application attempted on a non-parameterized type.",
|
|
129
|
+
1128: "Incorrect number of type parameters for %1. Expected %2, got %3.",
|
|
130
|
+
1129: "Cyclic structure cannot be converted to JSON string.",
|
|
131
|
+
1131: "Replacer argument to JSON stringifier must be an array or a two parameter function.",
|
|
132
|
+
1132: "Invalid JSON parse input.",
|
|
133
|
+
1500: "Error occurred opening file %1.",
|
|
134
|
+
1501: "Error occurred writing to file %1.",
|
|
135
|
+
1502: "A script has executed for longer than the default timeout period of 15 seconds.",
|
|
136
|
+
1503: "A script failed to exit after 30 seconds and was terminated.",
|
|
137
|
+
1504: "End of file.",
|
|
138
|
+
1505: "The string index %1 is out of bounds; must be in range %2 to %3.",
|
|
139
|
+
1506: "The specified range is invalid.",
|
|
140
|
+
1507: "Argument %1 cannot be null.",
|
|
141
|
+
1508: "The value specified for argument %1 is invalid.",
|
|
142
|
+
1510: "When the callback argument is a method of a class, the optional this argument must be null.",
|
|
143
|
+
1511: "Worker is already started.",
|
|
144
|
+
1512: "Starting a worker that already failed is not supported.",
|
|
145
|
+
1513: 'Worker has terminated."',
|
|
146
|
+
1514: "unlock() with no preceding matching lock().",
|
|
147
|
+
1515: "Invalid condition timeout value: %1.",
|
|
148
|
+
1516: "Condition cannot notify if associated mutex is not owned.",
|
|
149
|
+
1517: "Condition cannot notifyAll if associated mutex is not owned.",
|
|
150
|
+
1518: "Condition cannot wait if associated mutex is not owned.",
|
|
151
|
+
1519: "Condition cannot be initialized.",
|
|
152
|
+
1520: "Mutex cannot be initialized.",
|
|
153
|
+
1521: "Only the worker's parent may call start.",
|
|
154
|
+
2004: "One of the parameters is invalid.",
|
|
155
|
+
2006: "The supplied index is out of bounds.",
|
|
156
|
+
2007: "Parameter %1 must be non-null.",
|
|
157
|
+
2008: "Parameter %1 must be one of the accepted values.",
|
|
158
|
+
2012: "%1 class cannot be instantiated.",
|
|
159
|
+
2030: "End of file was encountered.",
|
|
160
|
+
2035: "URL Not Found.",
|
|
161
|
+
2058: "There was an error decompressing the data.",
|
|
162
|
+
2078: "The name property of a Timeline-placed object cannot be modified.",
|
|
163
|
+
2099: "The loading object is not sufficiently loaded to provide this information.",
|
|
164
|
+
2085: "Parameter %1 must be non-empty string.",
|
|
165
|
+
2088: "The Proxy class does not implement getProperty. It must be overridden by a subclass.",
|
|
166
|
+
2089: "The Proxy class does not implement setProperty. It must be overridden by a subclass.",
|
|
167
|
+
2090: "The Proxy class does not implement callProperty. It must be overridden by a subclass.",
|
|
168
|
+
2091: "The Proxy class does not implement hasProperty. It must be overridden by a subclass.",
|
|
169
|
+
2092: "The Proxy class does not implement deleteProperty. It must be overridden by a subclass.",
|
|
170
|
+
2093: "The Proxy class does not implement getDescendants. It must be overridden by a subclass.",
|
|
171
|
+
2105: "The Proxy class does not implement nextNameIndex. It must be overridden by a subclass.",
|
|
172
|
+
2106: "The Proxy class does not implement nextName. It must be overridden by a subclass.",
|
|
173
|
+
2107: "The Proxy class does not implement nextValue. It must be overridden by a subclass.",
|
|
174
|
+
2108: "The value %1 is not a valid Array length.",
|
|
175
|
+
2124: "Loaded file is an unknown type.",
|
|
176
|
+
2173: "Unable to read object in stream. The class %1 does not implement flash.utils.IExternalizable but is aliased to an externalizable class.",
|
|
177
|
+
3735: "This API cannot accept shared ByteArrays.",
|
|
178
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// The factories of methods whose bodies are not generated, as a module binds
|
|
2
|
+
// them through Runtime.native, noBody, unverified and verifyError: once,
|
|
3
|
+
// when it loads, never on a call.
|
|
4
|
+
|
|
5
|
+
import type { AsObject, Factory, Method, TypeRef, Value } from "./descriptors.js";
|
|
6
|
+
import type { Runtime } from "./runtime.js";
|
|
7
|
+
import { boundKey, methodKey, untypedSetKey } from "./traits.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A native with argument counts to check, when it has any, its declared
|
|
11
|
+
* parameter count (see nativeFactory), and, when it declares a parameter
|
|
12
|
+
* of a primitive type, those types to coerce a call's arguments to where
|
|
13
|
+
* the compiler did not (see coercedNative).
|
|
14
|
+
*/
|
|
15
|
+
export type CountedMethod = Method & {
|
|
16
|
+
$min?: number;
|
|
17
|
+
$max?: number;
|
|
18
|
+
$length?: number;
|
|
19
|
+
$coerce?: TypeRef[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The parameter types avmplus' coerceEnter converts to without a class to
|
|
24
|
+
* test against: the primitives, and Object, which takes undefined as null.
|
|
25
|
+
* A native checks a class-typed parameter itself.
|
|
26
|
+
*/
|
|
27
|
+
const COERCED = new Set<TypeRef>(["String", "Number", "int", "uint", "Boolean", "float", "Object"]);
|
|
28
|
+
|
|
29
|
+
/** Factories nativeFactory made, whose methods coercedNative coerces. */
|
|
30
|
+
const natives = new WeakSet<Factory>();
|
|
31
|
+
|
|
32
|
+
/** A native method, bound by its name; one the runtime lacks throws when called. */
|
|
33
|
+
export function nativeFactory(rt: Runtime, name: string, required: number, max: number): Factory {
|
|
34
|
+
const make = rt.natives[name];
|
|
35
|
+
if (!make) {
|
|
36
|
+
return () => () => {
|
|
37
|
+
throw rt.unsupported(`native ${name}`);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let f: Method | null = null;
|
|
42
|
+
const factory: Factory = () => {
|
|
43
|
+
if (!f) {
|
|
44
|
+
f = make(rt);
|
|
45
|
+
// Checked where a call was not bound (callBound, methodClosure): the
|
|
46
|
+
// verifier binds only a call its argument count fits.
|
|
47
|
+
if (required > 0 || max >= 0) {
|
|
48
|
+
(f as CountedMethod).$min = required;
|
|
49
|
+
(f as CountedMethod).$max = max;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Its Function.length is the ABC's parameter count, as avmplus'
|
|
53
|
+
// (FunctionClass.cpp), not what the JavaScript declares: a native
|
|
54
|
+
// with optional parameters gives them defaults, which length skips.
|
|
55
|
+
if (max >= 0) {
|
|
56
|
+
(f as CountedMethod).$length = max;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return f;
|
|
61
|
+
};
|
|
62
|
+
natives.add(factory);
|
|
63
|
+
return factory;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `f`, a method `factory` made, installed in `proto` at dispatch id `d`,
|
|
68
|
+
* with what a call the compiler did not bind needs to coerce its arguments
|
|
69
|
+
* by its declared `params`, if it is a native that declares a primitive or
|
|
70
|
+
* Object one. avmplus coerces a native's arguments on entry, however it was
|
|
71
|
+
* called; a compiled call bound to it has coerced them already, and calls
|
|
72
|
+
* it as it is, so only the runtime's untyped paths pay: callBound, by the
|
|
73
|
+
* types kept on `f`, the same for every runtime, which may share it; and
|
|
74
|
+
* an untyped set, through a wrapper this runtime's `proto` keeps at
|
|
75
|
+
* untypedSetKey(d), which a method that needs none hides from its base's.
|
|
76
|
+
*/
|
|
77
|
+
export function installMethod(
|
|
78
|
+
rt: Runtime,
|
|
79
|
+
proto: AsObject,
|
|
80
|
+
d: number,
|
|
81
|
+
f: Method,
|
|
82
|
+
factory: Factory,
|
|
83
|
+
params: TypeRef[],
|
|
84
|
+
): void {
|
|
85
|
+
proto[methodKey(d)] = f;
|
|
86
|
+
proto[boundKey(d)] = (f as Method & { $bound?: Method }).$bound ?? f;
|
|
87
|
+
const key = untypedSetKey(d);
|
|
88
|
+
if (!natives.has(factory) || !params.some((t) => COERCED.has(t))) {
|
|
89
|
+
if (key in proto) {
|
|
90
|
+
proto[key] = undefined;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const m = f as CountedMethod;
|
|
97
|
+
const types = params.map((t) => (COERCED.has(t) ? t : null));
|
|
98
|
+
m.$coerce = types;
|
|
99
|
+
// callBound coerces only a method with counts.
|
|
100
|
+
m.$min ??= 0;
|
|
101
|
+
m.$max ??= -1;
|
|
102
|
+
const type = types[0];
|
|
103
|
+
proto[key] =
|
|
104
|
+
type === null || type === undefined
|
|
105
|
+
? undefined
|
|
106
|
+
: function (this: Value, v: Value): Value {
|
|
107
|
+
return f.call(this, rt.coerce(v, type));
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A method with no body, as an interface's: VerifyError 1001 when called. */
|
|
112
|
+
export function noBodyFactory(rt: Runtime): Factory {
|
|
113
|
+
return () => () => {
|
|
114
|
+
throw rt.error("VerifyError", 1001, "method");
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** A method the compiler did not verify. */
|
|
119
|
+
export function unverifiedFactory(rt: Runtime): Factory {
|
|
120
|
+
return () => () => {
|
|
121
|
+
throw rt.unsupported("a method the compiler did not verify");
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** A method the verifier rejected with VerifyError `id`, thrown when it is called. */
|
|
126
|
+
export function verifyErrorFactory(rt: Runtime, id: number): Factory {
|
|
127
|
+
return () => () => {
|
|
128
|
+
throw rt.error("VerifyError", id);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// The modules a runtime loads into its application domains, and which of
|
|
2
|
+
// them the code on a stack is from: a Runtime's (Runtime.modules), apart
|
|
3
|
+
// from its object model, as nothing compiled code calls goes through it.
|
|
4
|
+
|
|
5
|
+
import type { Abc, AbcDesc } from "./descriptors.js";
|
|
6
|
+
import { add, Domain, definedInChain, frameScripts, stackFrames } from "./domain.js";
|
|
7
|
+
import { TypeName } from "./names.js";
|
|
8
|
+
|
|
9
|
+
export class Modules {
|
|
10
|
+
private domainCount = 1;
|
|
11
|
+
private loads = 0;
|
|
12
|
+
/**
|
|
13
|
+
* The domain of each loaded module's code, by the script a stack's frame
|
|
14
|
+
* names it with (see Runtime.codeDomain); found from the stacks its loads
|
|
15
|
+
* took, which wait in `unlocated` until a domain other than the root
|
|
16
|
+
* exists. Weakly: a module's code keeps its domain, through its Abc, for
|
|
17
|
+
* as long as it can run, and a domain no code is left of is let go, an
|
|
18
|
+
* entry dropped with it.
|
|
19
|
+
*/
|
|
20
|
+
private readonly moduleDomains = new Map<string, WeakRef<Domain>>();
|
|
21
|
+
private readonly moduleDomainGone = new FinalizationRegistry<string>((at) => {
|
|
22
|
+
if (!this.moduleDomains.get(at)?.deref()) {
|
|
23
|
+
this.moduleDomains.delete(at);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
private readonly unlocated: [Error, Domain][] = [];
|
|
27
|
+
|
|
28
|
+
/** A domain whose definitions are looked up after `parent`'s. */
|
|
29
|
+
newDomain(parent: Domain): Domain {
|
|
30
|
+
return new Domain(parent, this.domainCount++);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Load a module into `domain`: its scripts' names become visible there.
|
|
35
|
+
* `at` is the stack its load took, made in Runtime.abc, whose frame is
|
|
36
|
+
* its first and the module's factory its second (see locate); null for a
|
|
37
|
+
* player's own, whose code is not a domain's to Runtime.codeDomain.
|
|
38
|
+
*/
|
|
39
|
+
load(desc: AbcDesc, domain: Domain, at: Error | null): Abc {
|
|
40
|
+
// Its layouts are those of its ABC after exactly these ABCs; the
|
|
41
|
+
// root's, which a player loads thousands into, are not copied.
|
|
42
|
+
const loaded = domain.parent ? domain.chain() : domain.own;
|
|
43
|
+
const linked = desc.linked;
|
|
44
|
+
if (linked.length !== loaded.length || linked.some((h, i) => h !== loaded[i])) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`swf2es: a module compiled after [${linked.join(", ")}] cannot load after [${loaded.join(", ")}]`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const abc = desc as Abc;
|
|
51
|
+
abc.domain = domain;
|
|
52
|
+
abc.index = domain.own.length;
|
|
53
|
+
domain.own.push(desc.hash);
|
|
54
|
+
domain.ownOrder.push(this.loads++);
|
|
55
|
+
if (at !== null) {
|
|
56
|
+
this.unlocated.push([at, domain]);
|
|
57
|
+
}
|
|
58
|
+
for (const name of abc.names) {
|
|
59
|
+
if (name instanceof TypeName) {
|
|
60
|
+
name.names = abc.names;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const cls of abc.classes) {
|
|
65
|
+
cls.abc = abc;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
abc.scriptStates = abc.scripts.map((s) => ({ desc: s, abc, global: null, state: 0 }));
|
|
69
|
+
// As DomainMgr::addNamedScript: a name the domain's chain defines
|
|
70
|
+
// already, cached or loaded, is unreachable, and not added.
|
|
71
|
+
for (const script of abc.scriptStates) {
|
|
72
|
+
for (const [ns, version, name] of script.desc.traits.bindings) {
|
|
73
|
+
if (!definedInChain(domain, name, ns)) {
|
|
74
|
+
add(domain.globals, { ns, version, script }, name);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return abc;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The domain of the innermost code in `stack` that a module defines, or
|
|
84
|
+
* null. A frame is a module's by its script, so a host gives each module
|
|
85
|
+
* a script of its own: its URL, or a sourceURL comment for code it
|
|
86
|
+
* evaluates.
|
|
87
|
+
*/
|
|
88
|
+
domainOf(stack: string | undefined): Domain | null {
|
|
89
|
+
this.locate();
|
|
90
|
+
for (const at of frameScripts(stack)) {
|
|
91
|
+
const domain = this.moduleDomains.get(at)?.deref();
|
|
92
|
+
if (domain) {
|
|
93
|
+
return domain;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The scripts of the modules loaded since last asked, by the stacks their
|
|
102
|
+
* loads took. Their stacks reach the modules' code, so they are not kept
|
|
103
|
+
* past the load once there are domains to tell apart.
|
|
104
|
+
*/
|
|
105
|
+
locate(): void {
|
|
106
|
+
for (const [error, domain] of this.unlocated) {
|
|
107
|
+
// Its first frame is abc's own, its second the module's factory. An
|
|
108
|
+
// engine may name no script for the factory's frame (JavaScriptCore,
|
|
109
|
+
// for code a Function made), and the next frame that names one is
|
|
110
|
+
// the host's, which must not stand for the module.
|
|
111
|
+
const at = stackFrames(error.stack)[1];
|
|
112
|
+
if (at) {
|
|
113
|
+
this.moduleDomains.set(at, new WeakRef(domain));
|
|
114
|
+
this.moduleDomainGone.register(domain, at);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.unlocated.length = 0;
|
|
119
|
+
}
|
|
120
|
+
}
|