@swf2es/player-hosts 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 +759 -0
- package/README.md +43 -2
- package/dist/indexeddb.d.ts +27 -0
- package/dist/indexeddb.d.ts.map +1 -0
- package/dist/indexeddb.js +170 -0
- package/dist/indexeddb.js.map +1 -0
- package/dist/node-worker.d.ts +2 -0
- package/dist/node-worker.d.ts.map +1 -0
- package/dist/node-worker.js +12 -0
- package/dist/node-worker.js.map +1 -0
- package/dist/node.d.ts +8 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +43 -0
- package/dist/node.js.map +1 -0
- package/dist/precompiled.d.ts +31 -0
- package/dist/precompiled.d.ts.map +1 -0
- package/dist/precompiled.js +125 -0
- package/dist/precompiled.js.map +1 -0
- package/dist/stage3d.d.ts +13 -0
- package/dist/stage3d.d.ts.map +1 -0
- package/dist/stage3d.js +61 -0
- package/dist/stage3d.js.map +1 -0
- package/dist/thread/codegen/codegen.js +308 -0
- package/dist/thread/codegen/index.js +405 -0
- package/dist/thread/format/abc-names.js +126 -0
- package/dist/thread/format/actions.js +222 -0
- package/dist/thread/format/air-descriptor.js +63 -0
- package/dist/thread/format/api-versions.js +22 -0
- package/dist/thread/format/bitmap.js +199 -0
- package/dist/thread/format/button.js +60 -0
- package/dist/thread/format/compression.js +200 -0
- package/dist/thread/format/display.js +305 -0
- package/dist/thread/format/filters.js +136 -0
- package/dist/thread/format/font.js +168 -0
- package/dist/thread/format/index.js +26 -0
- package/dist/thread/format/pbj.js +484 -0
- package/dist/thread/format/shape.js +411 -0
- package/dist/thread/format/sound.js +91 -0
- package/dist/thread/format/swf.js +163 -0
- package/dist/thread/format/tags.js +58 -0
- package/dist/thread/format/text.js +135 -0
- package/dist/thread/format/zip.js +91 -0
- package/dist/thread/native/audio/binary.js +3 -0
- package/dist/thread/native/audio/index.js +72 -0
- package/dist/thread/native/base64.js +9 -0
- package/dist/thread/native/compress/binary.js +3 -0
- package/dist/thread/native/compress/index.js +145 -0
- package/dist/thread/native/instance.js +49 -0
- package/dist/thread/native/mp3/binary.js +3 -0
- package/dist/thread/native/mp3/index.js +48 -0
- package/dist/thread/native/render/binary.js +3 -0
- package/dist/thread/native/render/bitmap-kernel.js +591 -0
- package/dist/thread/native/render/draw-kernel.js +204 -0
- package/dist/thread/native/render/dxt-encoder.js +94 -0
- package/dist/thread/native/render/index.js +10 -0
- package/dist/thread/native/render/lines.js +122 -0
- package/dist/thread/native/render/module.js +26 -0
- package/dist/thread/native/render/pixel-ops.js +235 -0
- package/dist/thread/native/render/tessellator.js +250 -0
- package/dist/thread/player/avm1/amf.js +507 -0
- package/dist/thread/player/avm1/avm1.js +1304 -0
- package/dist/thread/player/avm1/bindings.js +214 -0
- package/dist/thread/player/avm1/classes.js +75 -0
- package/dist/thread/player/avm1/clips.js +229 -0
- package/dist/thread/player/avm1/compile.js +140 -0
- package/dist/thread/player/avm1/external.js +79 -0
- package/dist/thread/player/avm1/focus.js +278 -0
- package/dist/thread/player/avm1/globals/BitmapData.js +542 -0
- package/dist/thread/player/avm1/globals/Button.js +31 -0
- package/dist/thread/player/avm1/globals/Color.js +115 -0
- package/dist/thread/player/avm1/globals/ExternalInterface.js +310 -0
- package/dist/thread/player/avm1/globals/FileReference.js +217 -0
- package/dist/thread/player/avm1/globals/Key.js +60 -0
- package/dist/thread/player/avm1/globals/LoadVars.js +208 -0
- package/dist/thread/player/avm1/globals/LocalConnection.js +92 -0
- package/dist/thread/player/avm1/globals/MovieClip.js +1070 -0
- package/dist/thread/player/avm1/globals/MovieClipLoader.js +90 -0
- package/dist/thread/player/avm1/globals/NetConnection.js +261 -0
- package/dist/thread/player/avm1/globals/PrintJob.js +37 -0
- package/dist/thread/player/avm1/globals/Selection.js +62 -0
- package/dist/thread/player/avm1/globals/SharedObject.js +245 -0
- package/dist/thread/player/avm1/globals/Sound.js +238 -0
- package/dist/thread/player/avm1/globals/Stage.js +12 -0
- package/dist/thread/player/avm1/globals/StyleSheet.js +205 -0
- package/dist/thread/player/avm1/globals/TextField.js +396 -0
- package/dist/thread/player/avm1/globals/TextFormat.js +194 -0
- package/dist/thread/player/avm1/globals/TextSnapshot.js +88 -0
- package/dist/thread/player/avm1/globals/XML.js +396 -0
- package/dist/thread/player/avm1/globals/XMLNode.js +413 -0
- package/dist/thread/player/avm1/globals/XMLSocket.js +205 -0
- package/dist/thread/player/avm1/globals/drawing.js +202 -0
- package/dist/thread/player/avm1/globals/filters.js +635 -0
- package/dist/thread/player/avm1/globals/geom.js +600 -0
- package/dist/thread/player/avm1/input.js +483 -0
- package/dist/thread/player/avm1/keyboard.js +113 -0
- package/dist/thread/player/avm1/loads.js +352 -0
- package/dist/thread/player/avm1/net.js +219 -0
- package/dist/thread/player/avm1/paths.js +104 -0
- package/dist/thread/player/avm1/pointer.js +512 -0
- package/dist/thread/player/avm1/queue.js +303 -0
- package/dist/thread/player/avm1/sound.js +106 -0
- package/dist/thread/player/avm1/swf.js +141 -0
- package/dist/thread/player/avm1/timers.js +113 -0
- package/dist/thread/player/bitmap/bitmap.js +627 -0
- package/dist/thread/player/bitmap/draw.js +68 -0
- package/dist/thread/player/bitmap/dxt.js +11 -0
- package/dist/thread/player/bitmap/filters.js +656 -0
- package/dist/thread/player/bitmap/images.js +240 -0
- package/dist/thread/player/bitmap/kernel.js +65 -0
- package/dist/thread/player/bitmap/ops.js +1239 -0
- package/dist/thread/player/bitmap/pixel-bender.js +911 -0
- package/dist/thread/player/bitmap/png.js +139 -0
- package/dist/thread/player/bitmap/turbulence.js +89 -0
- package/dist/thread/player/clock.js +182 -0
- package/dist/thread/player/display/bitmapobject.js +25 -0
- package/dist/thread/player/display/bounds.js +520 -0
- package/dist/thread/player/display/buttonobject.js +305 -0
- package/dist/thread/player/display/color.js +40 -0
- package/dist/thread/player/display/container.js +150 -0
- package/dist/thread/player/display/display.js +14 -0
- package/dist/thread/player/display/displayobject.js +664 -0
- package/dist/thread/player/display/drawing.js +613 -0
- package/dist/thread/player/display/filters.js +285 -0
- package/dist/thread/player/display/geometry.js +189 -0
- package/dist/thread/player/display/gradients.js +117 -0
- package/dist/thread/player/display/graphicsdata.js +592 -0
- package/dist/thread/player/display/instantiate.js +71 -0
- package/dist/thread/player/display/matrix3d.js +373 -0
- package/dist/thread/player/display/morph.js +226 -0
- package/dist/thread/player/display/movieclip.js +680 -0
- package/dist/thread/player/display/perspective.js +193 -0
- package/dist/thread/player/display/scale9.js +236 -0
- package/dist/thread/player/display/shapeobject.js +131 -0
- package/dist/thread/player/display/shapes.js +407 -0
- package/dist/thread/player/display/textobjects.js +222 -0
- package/dist/thread/player/display/timeline.js +471 -0
- package/dist/thread/player/display/value-lists.js +40 -0
- package/dist/thread/player/display/videoobject.js +6 -0
- package/dist/thread/player/display/walk.js +127 -0
- package/dist/thread/player/files.js +334 -0
- package/dist/thread/player/hosts.js +207 -0
- package/dist/thread/player/input/avm1.js +82 -0
- package/dist/thread/player/input/context-menu.js +63 -0
- package/dist/thread/player/input/keyboard.js +458 -0
- package/dist/thread/player/input/pointer.js +863 -0
- package/dist/thread/player/input/text-editor.js +319 -0
- package/dist/thread/player/input/touch.js +209 -0
- package/dist/thread/player/localconnection.js +90 -0
- package/dist/thread/player/media/audio.js +376 -0
- package/dist/thread/player/media/dynamic-sound.js +90 -0
- package/dist/thread/player/media/extract.js +135 -0
- package/dist/thread/player/media/mp3.js +152 -0
- package/dist/thread/player/media/sounds.js +507 -0
- package/dist/thread/player/media/streaming-audio.js +133 -0
- package/dist/thread/player/player.js +616 -0
- package/dist/thread/player/playerglobal/air/net/WebSocket.js +250 -0
- package/dist/thread/player/playerglobal/air-library.js +8 -0
- package/dist/thread/player/playerglobal/flash/accessibility/Accessibility.js +21 -0
- package/dist/thread/player/playerglobal/flash/crypto/generateRandomBytes.js +32 -0
- package/dist/thread/player/playerglobal/flash/data/EncryptedLocalStore.js +61 -0
- package/dist/thread/player/playerglobal/flash/desktop/Clipboard.js +173 -0
- package/dist/thread/player/playerglobal/flash/desktop/NativeApplication.js +179 -0
- package/dist/thread/player/playerglobal/flash/display/AVM1Movie.js +19 -0
- package/dist/thread/player/playerglobal/flash/display/Bitmap.js +58 -0
- package/dist/thread/player/playerglobal/flash/display/BitmapData.js +633 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObject.js +614 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObjectContainer.js +224 -0
- package/dist/thread/player/playerglobal/flash/display/Graphics.js +345 -0
- package/dist/thread/player/playerglobal/flash/display/InteractiveObject.js +87 -0
- package/dist/thread/player/playerglobal/flash/display/Loader.js +79 -0
- package/dist/thread/player/playerglobal/flash/display/LoaderInfo.js +128 -0
- package/dist/thread/player/playerglobal/flash/display/MovieClip.js +194 -0
- package/dist/thread/player/playerglobal/flash/display/NativeWindow.js +245 -0
- package/dist/thread/player/playerglobal/flash/display/Shader.js +26 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderData.js +85 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderInput.js +64 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderJob.js +181 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderParameter.js +23 -0
- package/dist/thread/player/playerglobal/flash/display/Shape.js +13 -0
- package/dist/thread/player/playerglobal/flash/display/SimpleButton.js +103 -0
- package/dist/thread/player/playerglobal/flash/display/Sprite.js +84 -0
- package/dist/thread/player/playerglobal/flash/display/Stage.js +231 -0
- package/dist/thread/player/playerglobal/flash/display/Stage3D.js +54 -0
- package/dist/thread/player/playerglobal/flash/display/shaders.js +228 -0
- package/dist/thread/player/playerglobal/flash/events/Event.js +58 -0
- package/dist/thread/player/playerglobal/flash/events/EventDispatcher.js +103 -0
- package/dist/thread/player/playerglobal/flash/events/GestureEvent.js +34 -0
- package/dist/thread/player/playerglobal/flash/events/HTTPStatusEvent.js +8 -0
- package/dist/thread/player/playerglobal/flash/events/KeyboardEvent.js +51 -0
- package/dist/thread/player/playerglobal/flash/events/MouseEvent.js +59 -0
- package/dist/thread/player/playerglobal/flash/events/PressAndTapGestureEvent.js +30 -0
- package/dist/thread/player/playerglobal/flash/events/TimerEvent.js +16 -0
- package/dist/thread/player/playerglobal/flash/events/TouchEvent.js +45 -0
- package/dist/thread/player/playerglobal/flash/external/ExternalInterface.js +73 -0
- package/dist/thread/player/playerglobal/flash/filesystem/File.js +340 -0
- package/dist/thread/player/playerglobal/flash/filesystem/FileStream.js +453 -0
- package/dist/thread/player/playerglobal/flash/filesystem/paths.js +156 -0
- package/dist/thread/player/playerglobal/flash/filesystem/writes.js +143 -0
- package/dist/thread/player/playerglobal/flash/filters/BevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/BitmapFilter.js +205 -0
- package/dist/thread/player/playerglobal/flash/filters/BlurFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ColorMatrixFilter.js +11 -0
- package/dist/thread/player/playerglobal/flash/filters/ConvolutionFilter.js +26 -0
- package/dist/thread/player/playerglobal/flash/filters/DisplacementMapFilter.js +51 -0
- package/dist/thread/player/playerglobal/flash/filters/DropShadowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientBevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientGlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ShaderFilter.js +53 -0
- package/dist/thread/player/playerglobal/flash/geom/Matrix3D.js +361 -0
- package/dist/thread/player/playerglobal/flash/geom/PerspectiveProjection.js +122 -0
- package/dist/thread/player/playerglobal/flash/geom/Transform.js +245 -0
- package/dist/thread/player/playerglobal/flash/geom/Utils3D.js +85 -0
- package/dist/thread/player/playerglobal/flash/globalization/Collator.js +149 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyFormatter.js +272 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyParseResult.js +21 -0
- package/dist/thread/player/playerglobal/flash/globalization/DateTimeFormatter.js +463 -0
- package/dist/thread/player/playerglobal/flash/globalization/LocaleID.js +144 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberFormatter.js +444 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberParseResult.js +22 -0
- package/dist/thread/player/playerglobal/flash/globalization/StringTools.js +59 -0
- package/dist/thread/player/playerglobal/flash/globalization/locale.js +190 -0
- package/dist/thread/player/playerglobal/flash/media/Camera.js +89 -0
- package/dist/thread/player/playerglobal/flash/media/Microphone.js +126 -0
- package/dist/thread/player/playerglobal/flash/media/Sound.js +543 -0
- package/dist/thread/player/playerglobal/flash/media/SoundMixer.js +74 -0
- package/dist/thread/player/playerglobal/flash/media/SoundTransform.js +40 -0
- package/dist/thread/player/playerglobal/flash/media/Video.js +43 -0
- package/dist/thread/player/playerglobal/flash/net/FileFilter.js +27 -0
- package/dist/thread/player/playerglobal/flash/net/FileReference.js +197 -0
- package/dist/thread/player/playerglobal/flash/net/LocalConnection.js +167 -0
- package/dist/thread/player/playerglobal/flash/net/NetConnection.js +155 -0
- package/dist/thread/player/playerglobal/flash/net/SharedObject.js +299 -0
- package/dist/thread/player/playerglobal/flash/net/Socket.js +282 -0
- package/dist/thread/player/playerglobal/flash/net/URLRequest.js +93 -0
- package/dist/thread/player/playerglobal/flash/net/URLStream.js +146 -0
- package/dist/thread/player/playerglobal/flash/net/XMLSocket.js +14 -0
- package/dist/thread/player/playerglobal/flash/net/local-modern.js +142 -0
- package/dist/thread/player/playerglobal/flash/net/local-values.js +217 -0
- package/dist/thread/player/playerglobal/flash/net/navigateToURL.js +29 -0
- package/dist/thread/player/playerglobal/flash/profiler/Telemetry.js +25 -0
- package/dist/thread/player/playerglobal/flash/sensors/Accelerometer.js +12 -0
- package/dist/thread/player/playerglobal/flash/system/ApplicationDomain.js +69 -0
- package/dist/thread/player/playerglobal/flash/system/Capabilities.js +163 -0
- package/dist/thread/player/playerglobal/flash/system/FSCommandHost.js +17 -0
- package/dist/thread/player/playerglobal/flash/system/Security.js +46 -0
- package/dist/thread/player/playerglobal/flash/system/SecurityDomain.js +21 -0
- package/dist/thread/player/playerglobal/flash/system/System.js +73 -0
- package/dist/thread/player/playerglobal/flash/system/Worker.js +112 -0
- package/dist/thread/player/playerglobal/flash/text/Font.js +95 -0
- package/dist/thread/player/playerglobal/flash/text/StaticText.js +16 -0
- package/dist/thread/player/playerglobal/flash/text/StyleSheet.js +65 -0
- package/dist/thread/player/playerglobal/flash/text/TextField.js +707 -0
- package/dist/thread/player/playerglobal/flash/text/TextRenderer.js +77 -0
- package/dist/thread/player/playerglobal/flash/text/engine/FontDescription.js +141 -0
- package/dist/thread/player/playerglobal/flash/text/engine/TabStop.js +46 -0
- package/dist/thread/player/playerglobal/flash/trace/Trace.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/ContextMenu.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/GameInput.js +19 -0
- package/dist/thread/player/playerglobal/flash/ui/Keyboard.js +27 -0
- package/dist/thread/player/playerglobal/flash/ui/Mouse.js +127 -0
- package/dist/thread/player/playerglobal/flash/ui/Multitouch.js +46 -0
- package/dist/thread/player/playerglobal/flash/utils/ByteArray.js +155 -0
- package/dist/thread/player/playerglobal/flash/utils/Timer.js +25 -0
- package/dist/thread/player/playerglobal/flash/xml/XMLDocument.js +74 -0
- package/dist/thread/player/playerglobal/index.js +224 -0
- package/dist/thread/player/playerglobal/libraries.js +10 -0
- package/dist/thread/player/playerglobal/playerglobal-library.js +22 -0
- package/dist/thread/player/playerglobal/toplevel.js +122 -0
- package/dist/thread/player/scripting/clipboard.js +146 -0
- package/dist/thread/player/scripting/code.js +900 -0
- package/dist/thread/player/scripting/evaluate.js +144 -0
- package/dist/thread/player/scripting/events.js +172 -0
- package/dist/thread/player/scripting/handover.js +182 -0
- package/dist/thread/player/scripting/lazy.js +38 -0
- package/dist/thread/player/scripting/lifecycle.js +272 -0
- package/dist/thread/player/scripting/loads.js +860 -0
- package/dist/thread/player/scripting/sha256.js +95 -0
- package/dist/thread/player/scripting/symbols.js +348 -0
- package/dist/thread/player/scripting/timers.js +434 -0
- package/dist/thread/player/scripting/workers.js +923 -0
- package/dist/thread/player/scripting.js +1018 -0
- package/dist/thread/player/stage.js +4 -0
- package/dist/thread/player/text/csm.js +113 -0
- package/dist/thread/player/text/css.js +167 -0
- package/dist/thread/player/text/fonts.js +97 -0
- package/dist/thread/player/text/layout.js +393 -0
- package/dist/thread/player/text/static.js +109 -0
- package/dist/thread/player/text/text.js +431 -0
- package/dist/thread/player/workers/thread.js +159 -0
- package/dist/thread/player/workers/wire.js +198 -0
- package/dist/thread/player-hosts/web-worker.js +19 -0
- package/dist/thread/runtime/avm1/activation.js +89 -0
- package/dist/thread/runtime/avm1/case.js +249 -0
- package/dist/thread/runtime/avm1/clips.js +334 -0
- package/dist/thread/runtime/avm1/control.js +280 -0
- package/dist/thread/runtime/avm1/errors.js +50 -0
- package/dist/thread/runtime/avm1/functions.js +249 -0
- package/dist/thread/runtime/avm1/globals/array.js +549 -0
- package/dist/thread/runtime/avm1/globals/broadcaster.js +131 -0
- package/dist/thread/runtime/avm1/globals/date.js +436 -0
- package/dist/thread/runtime/avm1/globals/global.js +344 -0
- package/dist/thread/runtime/avm1/globals/math.js +139 -0
- package/dist/thread/runtime/avm1/globals/number.js +93 -0
- package/dist/thread/runtime/avm1/globals/string.js +201 -0
- package/dist/thread/runtime/avm1/globals/timers.js +129 -0
- package/dist/thread/runtime/avm1/host.js +5 -0
- package/dist/thread/runtime/avm1/index.js +14 -0
- package/dist/thread/runtime/avm1/inheritance.js +132 -0
- package/dist/thread/runtime/avm1/numbers.js +298 -0
- package/dist/thread/runtime/avm1/objects.js +896 -0
- package/dist/thread/runtime/avm1/operators.js +170 -0
- package/dist/thread/runtime/avm1/realm.js +529 -0
- package/dist/thread/runtime/avm1/runtime.js +882 -0
- package/dist/thread/runtime/avm1/scope.js +385 -0
- package/dist/thread/runtime/avm1/urls.js +180 -0
- package/dist/thread/runtime/avm1/values.js +97 -0
- package/dist/thread/runtime/avm2/amf-classes.js +66 -0
- package/dist/thread/runtime/avm2/amf.js +801 -0
- package/dist/thread/runtime/avm2/array-conversion.js +100 -0
- package/dist/thread/runtime/avm2/builtin-library.js +21 -0
- package/dist/thread/runtime/avm2/cache-fill.js +86 -0
- package/dist/thread/runtime/avm2/classes.js +211 -0
- package/dist/thread/runtime/avm2/definitions.js +69 -0
- package/dist/thread/runtime/avm2/descriptors.js +5 -0
- package/dist/thread/runtime/avm2/dictionary-keys.js +295 -0
- package/dist/thread/runtime/avm2/domain-memory.js +75 -0
- package/dist/thread/runtime/avm2/domain.js +280 -0
- package/dist/thread/runtime/avm2/dynamic-properties.js +182 -0
- package/dist/thread/runtime/avm2/enumeration.js +393 -0
- package/dist/thread/runtime/avm2/errors.js +45 -0
- package/dist/thread/runtime/avm2/float-library.js +66 -0
- package/dist/thread/runtime/avm2/float.js +26 -0
- package/dist/thread/runtime/avm2/hooks.js +19 -0
- package/dist/thread/runtime/avm2/index.js +38 -0
- package/dist/thread/runtime/avm2/messages.js +177 -0
- package/dist/thread/runtime/avm2/method-factories.js +95 -0
- package/dist/thread/runtime/avm2/modules.js +105 -0
- package/dist/thread/runtime/avm2/names.js +248 -0
- package/dist/thread/runtime/avm2/natives/aliases.js +47 -0
- package/dist/thread/runtime/avm2/natives/array.js +390 -0
- package/dist/thread/runtime/avm2/natives/bytearray.js +1227 -0
- package/dist/thread/runtime/avm2/natives/case.js +88 -0
- package/dist/thread/runtime/avm2/natives/concurrent.js +199 -0
- package/dist/thread/runtime/avm2/natives/date.js +581 -0
- package/dist/thread/runtime/avm2/natives/define.js +130 -0
- package/dist/thread/runtime/avm2/natives/describe.js +351 -0
- package/dist/thread/runtime/avm2/natives/dictionary.js +12 -0
- package/dist/thread/runtime/avm2/natives/float-vector.js +81 -0
- package/dist/thread/runtime/avm2/natives/float.js +96 -0
- package/dist/thread/runtime/avm2/natives/index.js +64 -0
- package/dist/thread/runtime/avm2/natives/json.js +514 -0
- package/dist/thread/runtime/avm2/natives/number.js +162 -0
- package/dist/thread/runtime/avm2/natives/object.js +237 -0
- package/dist/thread/runtime/avm2/natives/proxy.js +75 -0
- package/dist/thread/runtime/avm2/natives/regexp.js +485 -0
- package/dist/thread/runtime/avm2/natives/shell-workers.js +404 -0
- package/dist/thread/runtime/avm2/natives/shell.js +557 -0
- package/dist/thread/runtime/avm2/natives/sort.js +377 -0
- package/dist/thread/runtime/avm2/natives/string.js +132 -0
- package/dist/thread/runtime/avm2/natives/sync.js +821 -0
- package/dist/thread/runtime/avm2/natives/toplevel.js +139 -0
- package/dist/thread/runtime/avm2/natives/vector-elements.js +46 -0
- package/dist/thread/runtime/avm2/natives/vector.js +406 -0
- package/dist/thread/runtime/avm2/natives/xml/access.js +633 -0
- package/dist/thread/runtime/avm2/natives/xml/build.js +291 -0
- package/dist/thread/runtime/avm2/natives/xml/chars.js +112 -0
- package/dist/thread/runtime/avm2/natives/xml/escape.js +38 -0
- package/dist/thread/runtime/avm2/natives/xml/names.js +204 -0
- package/dist/thread/runtime/avm2/natives/xml/node.js +272 -0
- package/dist/thread/runtime/avm2/natives/xml/operators.js +69 -0
- package/dist/thread/runtime/avm2/natives/xml/parser.js +356 -0
- package/dist/thread/runtime/avm2/natives/xml/strings.js +191 -0
- package/dist/thread/runtime/avm2/natives/xml/values.js +122 -0
- package/dist/thread/runtime/avm2/natives/xml/xml.js +645 -0
- package/dist/thread/runtime/avm2/number-strings.js +110 -0
- package/dist/thread/runtime/avm2/numbers.js +558 -0
- package/dist/thread/runtime/avm2/options.js +16 -0
- package/dist/thread/runtime/avm2/player-messages.js +550 -0
- package/dist/thread/runtime/avm2/property-cache.js +135 -0
- package/dist/thread/runtime/avm2/runtime.js +2644 -0
- package/dist/thread/runtime/avm2/traits.js +509 -0
- package/dist/thread/runtime/index.js +7 -0
- package/dist/web-worker.d.ts +2 -0
- package/dist/web-worker.d.ts.map +1 -0
- package/dist/web-worker.js +20 -0
- package/dist/web-worker.js.map +1 -0
- package/dist/websocket.d.ts +4 -0
- package/dist/websocket.d.ts.map +1 -0
- package/dist/websocket.js +27 -0
- package/dist/websocket.js.map +1 -0
- package/dist/workers.d.ts +35 -0
- package/dist/workers.d.ts.map +1 -0
- package/dist/workers.js +171 -0
- package/dist/workers.js.map +1 -0
- package/package.json +62 -3
- package/src/indexeddb.ts +227 -0
- package/src/node-worker.ts +13 -0
- package/src/node.ts +49 -0
- package/src/precompiled.ts +166 -0
- package/src/stage3d.ts +76 -0
- package/src/web-worker.ts +24 -0
- package/src/websocket.ts +32 -0
- package/src/workers.ts +255 -0
|
@@ -0,0 +1,177 @@
|
|
|
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
|
+
export const messages = {
|
|
7
|
+
1000: "The system is out of memory.",
|
|
8
|
+
1001: "The method %1 is not implemented.",
|
|
9
|
+
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.",
|
|
10
|
+
1003: "The radix argument must be between 2 and 36; got %1.",
|
|
11
|
+
1004: "Method %1 was invoked on an incompatible object.",
|
|
12
|
+
1005: "Array index is not a positive integer (%1).",
|
|
13
|
+
1006: "%1 is not a function.",
|
|
14
|
+
1007: "Instantiation attempted on a non-constructor.",
|
|
15
|
+
1008: "%1 is ambiguous; Found more than one matching binding.",
|
|
16
|
+
1009: "Cannot access a property or method of a null object reference.",
|
|
17
|
+
1010: "A term is undefined and has no properties.",
|
|
18
|
+
1011: "Method %1 contained illegal opcode %2 at offset %3.",
|
|
19
|
+
1012: "The last instruction exceeded code size.",
|
|
20
|
+
1013: "Cannot call OP_findproperty when scopeDepth is 0.",
|
|
21
|
+
1014: "Class %1 could not be found.",
|
|
22
|
+
1015: "Method %1 cannot set default xml namespace",
|
|
23
|
+
1016: "Descendants operator (..) not supported on type %1.",
|
|
24
|
+
1017: "Scope stack overflow occurred.",
|
|
25
|
+
1018: "Scope stack underflow occurred.",
|
|
26
|
+
1019: "Getscopeobject %1 is out of bounds.",
|
|
27
|
+
1020: "Code cannot fall off the end of a method.",
|
|
28
|
+
1021: "At least one branch target was not on a valid instruction in the method.",
|
|
29
|
+
1022: "Type void may only be used as a function return type.",
|
|
30
|
+
1023: "Stack overflow occurred.",
|
|
31
|
+
1024: "Stack underflow occurred.",
|
|
32
|
+
1025: "An invalid register %1 was accessed.",
|
|
33
|
+
1026: "Slot %1 exceeds slotCount=%2 of %3.",
|
|
34
|
+
1027: "Method_info %1 exceeds method_count=%2.",
|
|
35
|
+
1028: "Disp_id %1 exceeds max_disp_id=%2 of %3.",
|
|
36
|
+
1029: "Disp_id %1 is undefined on %2.",
|
|
37
|
+
1030: "Stack depth is unbalanced. %1 != %2.",
|
|
38
|
+
1031: "Scope depth is unbalanced. %1 != %2.",
|
|
39
|
+
1032: "Cpool index %1 is out of range %2.",
|
|
40
|
+
1033: "Cpool entry %1 is wrong type.",
|
|
41
|
+
1034: "Type Coercion failed: cannot convert %1 to %2.",
|
|
42
|
+
1035: "Illegal super expression found in method %1.",
|
|
43
|
+
1037: "Cannot assign to a method %1 on %2.",
|
|
44
|
+
1038: "%1 is already defined.",
|
|
45
|
+
1039: "Cannot verify method until it is referenced.",
|
|
46
|
+
1040: "The right-hand side of instanceof must be a class or function.",
|
|
47
|
+
1041: "The right-hand side of operator must be a class.",
|
|
48
|
+
1042: "Not an ABC file. major_version=%1 minor_version=%2.",
|
|
49
|
+
1043: "Invalid code_length=%1.",
|
|
50
|
+
1044: "MethodInfo-%1 unsupported flags=%2.",
|
|
51
|
+
1045: "Unsupported traits kind=%1.",
|
|
52
|
+
1046: "MethodInfo-%1 referenced before definition.",
|
|
53
|
+
1047: "No entry point was found.",
|
|
54
|
+
1049: "Prototype objects must be vanilla Objects.",
|
|
55
|
+
1050: "Cannot convert %1 to primitive.",
|
|
56
|
+
1051: "Illegal early binding access to %1.",
|
|
57
|
+
1052: "Invalid URI passed to %1 function.",
|
|
58
|
+
1053: "Illegal override of %1 in %2.",
|
|
59
|
+
1054: "Illegal range or target offsets in exception handler.",
|
|
60
|
+
1056: "Cannot create property %1 on %2.",
|
|
61
|
+
1057: "%1 can only contain methods.",
|
|
62
|
+
1058: "Illegal operand type: %1 must be %2.",
|
|
63
|
+
1059: "ClassInfo-%1 is referenced before definition.",
|
|
64
|
+
1060: "ClassInfo %1 exceeds class_count=%2.",
|
|
65
|
+
1061: "The value %1 cannot be converted to %2 without losing precision.",
|
|
66
|
+
1063: "Argument count mismatch on %1. Expected %2, got %3.",
|
|
67
|
+
1064: "Cannot call method %1 as constructor.",
|
|
68
|
+
1065: "Variable %1 is not defined.",
|
|
69
|
+
1066: "The form function('function body') is not supported.",
|
|
70
|
+
1067: "Native method %1 has illegal method body.",
|
|
71
|
+
1068: "%1 and %2 cannot be reconciled.",
|
|
72
|
+
1069: "Property %1 not found on %2 and there is no default value.",
|
|
73
|
+
1070: "Method %1 not found on %2",
|
|
74
|
+
1071: "Function %1 has already been bound to %2.",
|
|
75
|
+
1072: "Disp_id 0 is illegal.",
|
|
76
|
+
1073: "Non-override method %1 replaced because of duplicate disp_id %2.",
|
|
77
|
+
1074: "Illegal write to read-only property %1 on %2.",
|
|
78
|
+
1075: "Math is not a function.",
|
|
79
|
+
1076: "Math is not a constructor.",
|
|
80
|
+
1077: "Illegal read of write-only property %1 on %2.",
|
|
81
|
+
1078: "Illegal opcode/multiname combination: %1<%2>.",
|
|
82
|
+
1079: "Native methods are not allowed in loaded code.",
|
|
83
|
+
1080: "Illegal value for namespace.",
|
|
84
|
+
1081: "Property %1 not found on %2 and there is no default value.",
|
|
85
|
+
1082: "No default namespace has been set.",
|
|
86
|
+
1083: 'The prefix "%1" for element "%2" is not bound.',
|
|
87
|
+
1084: "Element or attribute (\"%1\") does not match QName production: QName::=(NCName':')?NCName.",
|
|
88
|
+
1085: 'The element type "%1" must be terminated by the matching end-tag "</%2>".',
|
|
89
|
+
1086: "The %1 method only works on lists containing one item.",
|
|
90
|
+
1087: "Assignment to indexed XML is not allowed.",
|
|
91
|
+
1088: "The markup in the document following the root element must be well-formed.",
|
|
92
|
+
1089: "Assignment to lists with more than one item is not supported.",
|
|
93
|
+
1090: "XML parser failure: element is malformed.",
|
|
94
|
+
1091: "XML parser failure: Unterminated CDATA section.",
|
|
95
|
+
1092: "XML parser failure: Unterminated XML declaration.",
|
|
96
|
+
1093: "XML parser failure: Unterminated DOCTYPE declaration.",
|
|
97
|
+
1094: "XML parser failure: Unterminated comment.",
|
|
98
|
+
1095: "XML parser failure: Unterminated attribute.",
|
|
99
|
+
1096: "XML parser failure: Unterminated element.",
|
|
100
|
+
1097: "XML parser failure: Unterminated processing instruction.",
|
|
101
|
+
1098: "Illegal prefix %1 for no namespace.",
|
|
102
|
+
1100: "Cannot supply flags when constructing one RegExp from another.",
|
|
103
|
+
1101: "Cannot verify method %1 with unknown scope.",
|
|
104
|
+
1102: "Illegal default value for type %1.",
|
|
105
|
+
1103: "Class %1 cannot extend final base class.",
|
|
106
|
+
1104: 'Attribute "%1" was already specified for element "%2".',
|
|
107
|
+
1107: "The ABC data is corrupt, attempt to read out of bounds.",
|
|
108
|
+
1108: "The OP_newclass opcode was used with the incorrect base class.",
|
|
109
|
+
1109: "Attempt to directly call unbound function %1 from method %2.",
|
|
110
|
+
1110: "%1 cannot extend %2.",
|
|
111
|
+
1111: "%1 cannot implement %2.",
|
|
112
|
+
1112: "Argument count mismatch on class coercion. Expected 1, got %1.",
|
|
113
|
+
1113: "OP_newactivation used in method without NEED_ACTIVATION flag.",
|
|
114
|
+
1114: "OP_getglobalslot or OP_setglobalslot used with no global scope.",
|
|
115
|
+
1115: "%1 is not a constructor.",
|
|
116
|
+
1116: "second argument to Function.prototype.apply must be an array.",
|
|
117
|
+
1117: "Invalid XML name: %1.",
|
|
118
|
+
1118: "Illegal cyclical loop between nodes.",
|
|
119
|
+
1119: "Delete operator is not supported with operand of type %1.",
|
|
120
|
+
1120: "Cannot delete property %1 on %2.",
|
|
121
|
+
1121: "Method %1 has a duplicate method body.",
|
|
122
|
+
1122: "Interface method %1 has illegal method body.",
|
|
123
|
+
1123: "Filter operator not supported on type %1.",
|
|
124
|
+
1124: "OP_hasnext2 requires object and index to be distinct registers.",
|
|
125
|
+
1125: "The index %1 is out of range %2.",
|
|
126
|
+
1126: "Cannot change the length of a fixed Vector.",
|
|
127
|
+
1127: "Type application attempted on a non-parameterized type.",
|
|
128
|
+
1128: "Incorrect number of type parameters for %1. Expected %2, got %3.",
|
|
129
|
+
1129: "Cyclic structure cannot be converted to JSON string.",
|
|
130
|
+
1131: "Replacer argument to JSON stringifier must be an array or a two parameter function.",
|
|
131
|
+
1132: "Invalid JSON parse input.",
|
|
132
|
+
1500: "Error occurred opening file %1.",
|
|
133
|
+
1501: "Error occurred writing to file %1.",
|
|
134
|
+
1502: "A script has executed for longer than the default timeout period of 15 seconds.",
|
|
135
|
+
1503: "A script failed to exit after 30 seconds and was terminated.",
|
|
136
|
+
1504: "End of file.",
|
|
137
|
+
1505: "The string index %1 is out of bounds; must be in range %2 to %3.",
|
|
138
|
+
1506: "The specified range is invalid.",
|
|
139
|
+
1507: "Argument %1 cannot be null.",
|
|
140
|
+
1508: "The value specified for argument %1 is invalid.",
|
|
141
|
+
1510: "When the callback argument is a method of a class, the optional this argument must be null.",
|
|
142
|
+
1511: "Worker is already started.",
|
|
143
|
+
1512: "Starting a worker that already failed is not supported.",
|
|
144
|
+
1513: 'Worker has terminated."',
|
|
145
|
+
1514: "unlock() with no preceding matching lock().",
|
|
146
|
+
1515: "Invalid condition timeout value: %1.",
|
|
147
|
+
1516: "Condition cannot notify if associated mutex is not owned.",
|
|
148
|
+
1517: "Condition cannot notifyAll if associated mutex is not owned.",
|
|
149
|
+
1518: "Condition cannot wait if associated mutex is not owned.",
|
|
150
|
+
1519: "Condition cannot be initialized.",
|
|
151
|
+
1520: "Mutex cannot be initialized.",
|
|
152
|
+
1521: "Only the worker's parent may call start.",
|
|
153
|
+
2004: "One of the parameters is invalid.",
|
|
154
|
+
2006: "The supplied index is out of bounds.",
|
|
155
|
+
2007: "Parameter %1 must be non-null.",
|
|
156
|
+
2008: "Parameter %1 must be one of the accepted values.",
|
|
157
|
+
2012: "%1 class cannot be instantiated.",
|
|
158
|
+
2030: "End of file was encountered.",
|
|
159
|
+
2035: "URL Not Found.",
|
|
160
|
+
2058: "There was an error decompressing the data.",
|
|
161
|
+
2078: "The name property of a Timeline-placed object cannot be modified.",
|
|
162
|
+
2099: "The loading object is not sufficiently loaded to provide this information.",
|
|
163
|
+
2085: "Parameter %1 must be non-empty string.",
|
|
164
|
+
2088: "The Proxy class does not implement getProperty. It must be overridden by a subclass.",
|
|
165
|
+
2089: "The Proxy class does not implement setProperty. It must be overridden by a subclass.",
|
|
166
|
+
2090: "The Proxy class does not implement callProperty. It must be overridden by a subclass.",
|
|
167
|
+
2091: "The Proxy class does not implement hasProperty. It must be overridden by a subclass.",
|
|
168
|
+
2092: "The Proxy class does not implement deleteProperty. It must be overridden by a subclass.",
|
|
169
|
+
2093: "The Proxy class does not implement getDescendants. It must be overridden by a subclass.",
|
|
170
|
+
2105: "The Proxy class does not implement nextNameIndex. It must be overridden by a subclass.",
|
|
171
|
+
2106: "The Proxy class does not implement nextName. It must be overridden by a subclass.",
|
|
172
|
+
2107: "The Proxy class does not implement nextValue. It must be overridden by a subclass.",
|
|
173
|
+
2108: "The value %1 is not a valid Array length.",
|
|
174
|
+
2124: "Loaded file is an unknown type.",
|
|
175
|
+
2173: "Unable to read object in stream. The class %1 does not implement flash.utils.IExternalizable but is aliased to an externalizable class.",
|
|
176
|
+
3735: "This API cannot accept shared ByteArrays.",
|
|
177
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
import { boundKey, methodKey, untypedSetKey } from "./traits.js";
|
|
5
|
+
/**
|
|
6
|
+
* The parameter types avmplus' coerceEnter converts to without a class to
|
|
7
|
+
* test against: the primitives, and Object, which takes undefined as null.
|
|
8
|
+
* A native checks a class-typed parameter itself.
|
|
9
|
+
*/
|
|
10
|
+
const COERCED = new Set(["String", "Number", "int", "uint", "Boolean", "float", "Object"]);
|
|
11
|
+
/** Factories nativeFactory made, whose methods coercedNative coerces. */
|
|
12
|
+
const natives = new WeakSet();
|
|
13
|
+
/** A native method, bound by its name; one the runtime lacks throws when called. */
|
|
14
|
+
export function nativeFactory(rt, name, required, max) {
|
|
15
|
+
const make = rt.natives[name];
|
|
16
|
+
if (!make) {
|
|
17
|
+
return () => () => {
|
|
18
|
+
throw rt.unsupported(`native ${name}`);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
let f = null;
|
|
22
|
+
const factory = () => {
|
|
23
|
+
if (!f) {
|
|
24
|
+
f = make(rt);
|
|
25
|
+
// Checked where a call was not bound (callBound, methodClosure): the
|
|
26
|
+
// verifier binds only a call its argument count fits.
|
|
27
|
+
if (required > 0 || max >= 0) {
|
|
28
|
+
f.$min = required;
|
|
29
|
+
f.$max = max;
|
|
30
|
+
}
|
|
31
|
+
// Its Function.length is the ABC's parameter count, as avmplus'
|
|
32
|
+
// (FunctionClass.cpp), not what the JavaScript declares: a native
|
|
33
|
+
// with optional parameters gives them defaults, which length skips.
|
|
34
|
+
if (max >= 0) {
|
|
35
|
+
f.$length = max;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return f;
|
|
39
|
+
};
|
|
40
|
+
natives.add(factory);
|
|
41
|
+
return factory;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `f`, a method `factory` made, installed in `proto` at dispatch id `d`,
|
|
45
|
+
* with what a call the compiler did not bind needs to coerce its arguments
|
|
46
|
+
* by its declared `params`, if it is a native that declares a primitive or
|
|
47
|
+
* Object one. avmplus coerces a native's arguments on entry, however it was
|
|
48
|
+
* called; a compiled call bound to it has coerced them already, and calls
|
|
49
|
+
* it as it is, so only the runtime's untyped paths pay: callBound, by the
|
|
50
|
+
* types kept on `f`, the same for every runtime, which may share it; and
|
|
51
|
+
* an untyped set, through a wrapper this runtime's `proto` keeps at
|
|
52
|
+
* untypedSetKey(d), which a method that needs none hides from its base's.
|
|
53
|
+
*/
|
|
54
|
+
export function installMethod(rt, proto, d, f, factory, params) {
|
|
55
|
+
proto[methodKey(d)] = f;
|
|
56
|
+
proto[boundKey(d)] = f.$bound ?? f;
|
|
57
|
+
const key = untypedSetKey(d);
|
|
58
|
+
if (!natives.has(factory) || !params.some((t) => COERCED.has(t))) {
|
|
59
|
+
if (key in proto) {
|
|
60
|
+
proto[key] = undefined;
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const m = f;
|
|
65
|
+
const types = params.map((t) => (COERCED.has(t) ? t : null));
|
|
66
|
+
m.$coerce = types;
|
|
67
|
+
// callBound coerces only a method with counts.
|
|
68
|
+
m.$min ??= 0;
|
|
69
|
+
m.$max ??= -1;
|
|
70
|
+
const type = types[0];
|
|
71
|
+
proto[key] =
|
|
72
|
+
type === null || type === undefined
|
|
73
|
+
? undefined
|
|
74
|
+
: function (v) {
|
|
75
|
+
return f.call(this, rt.coerce(v, type));
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** A method with no body, as an interface's: VerifyError 1001 when called. */
|
|
79
|
+
export function noBodyFactory(rt) {
|
|
80
|
+
return () => () => {
|
|
81
|
+
throw rt.error("VerifyError", 1001, "method");
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** A method the compiler did not verify. */
|
|
85
|
+
export function unverifiedFactory(rt) {
|
|
86
|
+
return () => () => {
|
|
87
|
+
throw rt.unsupported("a method the compiler did not verify");
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** A method the verifier rejected with VerifyError `id`, thrown when it is called. */
|
|
91
|
+
export function verifyErrorFactory(rt, id) {
|
|
92
|
+
return () => () => {
|
|
93
|
+
throw rt.error("VerifyError", id);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
import { add, Domain, definedInChain, frameScripts, stackFrames } from "./domain.js";
|
|
5
|
+
import { TypeName } from "./names.js";
|
|
6
|
+
export class Modules {
|
|
7
|
+
domainCount = 1;
|
|
8
|
+
loads = 0;
|
|
9
|
+
/**
|
|
10
|
+
* The domain of each loaded module's code, by the script a stack's frame
|
|
11
|
+
* names it with (see Runtime.codeDomain); found from the stacks its loads
|
|
12
|
+
* took, which wait in `unlocated` until a domain other than the root
|
|
13
|
+
* exists. Weakly: a module's code keeps its domain, through its Abc, for
|
|
14
|
+
* as long as it can run, and a domain no code is left of is let go, an
|
|
15
|
+
* entry dropped with it.
|
|
16
|
+
*/
|
|
17
|
+
moduleDomains = new Map();
|
|
18
|
+
moduleDomainGone = new FinalizationRegistry((at) => {
|
|
19
|
+
if (!this.moduleDomains.get(at)?.deref()) {
|
|
20
|
+
this.moduleDomains.delete(at);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
unlocated = [];
|
|
24
|
+
/** A domain whose definitions are looked up after `parent`'s. */
|
|
25
|
+
newDomain(parent) {
|
|
26
|
+
return new Domain(parent, this.domainCount++);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Load a module into `domain`: its scripts' names become visible there.
|
|
30
|
+
* `at` is the stack its load took, made in Runtime.abc, whose frame is
|
|
31
|
+
* its first and the module's factory its second (see locate); null for a
|
|
32
|
+
* player's own, whose code is not a domain's to Runtime.codeDomain.
|
|
33
|
+
*/
|
|
34
|
+
load(desc, domain, at) {
|
|
35
|
+
// Its layouts are those of its ABC after exactly these ABCs; the
|
|
36
|
+
// root's, which a player loads thousands into, are not copied.
|
|
37
|
+
const loaded = domain.parent ? domain.chain() : domain.own;
|
|
38
|
+
const linked = desc.linked;
|
|
39
|
+
if (linked.length !== loaded.length || linked.some((h, i) => h !== loaded[i])) {
|
|
40
|
+
throw new Error(`swf2es: a module compiled after [${linked.join(", ")}] cannot load after [${loaded.join(", ")}]`);
|
|
41
|
+
}
|
|
42
|
+
const abc = desc;
|
|
43
|
+
abc.domain = domain;
|
|
44
|
+
abc.index = domain.own.length;
|
|
45
|
+
domain.own.push(desc.hash);
|
|
46
|
+
domain.ownOrder.push(this.loads++);
|
|
47
|
+
if (at !== null) {
|
|
48
|
+
this.unlocated.push([at, domain]);
|
|
49
|
+
}
|
|
50
|
+
for (const name of abc.names) {
|
|
51
|
+
if (name instanceof TypeName) {
|
|
52
|
+
name.names = abc.names;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for (const cls of abc.classes) {
|
|
56
|
+
cls.abc = abc;
|
|
57
|
+
}
|
|
58
|
+
abc.scriptStates = abc.scripts.map((s) => ({ desc: s, abc, global: null, state: 0 }));
|
|
59
|
+
// As DomainMgr::addNamedScript: a name the domain's chain defines
|
|
60
|
+
// already, cached or loaded, is unreachable, and not added.
|
|
61
|
+
for (const script of abc.scriptStates) {
|
|
62
|
+
for (const [ns, version, name] of script.desc.traits.bindings) {
|
|
63
|
+
if (!definedInChain(domain, name, ns)) {
|
|
64
|
+
add(domain.globals, { ns, version, script }, name);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return abc;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The domain of the innermost code in `stack` that a module defines, or
|
|
72
|
+
* null. A frame is a module's by its script, so a host gives each module
|
|
73
|
+
* a script of its own: its URL, or a sourceURL comment for code it
|
|
74
|
+
* evaluates.
|
|
75
|
+
*/
|
|
76
|
+
domainOf(stack) {
|
|
77
|
+
this.locate();
|
|
78
|
+
for (const at of frameScripts(stack)) {
|
|
79
|
+
const domain = this.moduleDomains.get(at)?.deref();
|
|
80
|
+
if (domain) {
|
|
81
|
+
return domain;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The scripts of the modules loaded since last asked, by the stacks their
|
|
88
|
+
* loads took. Their stacks reach the modules' code, so they are not kept
|
|
89
|
+
* past the load once there are domains to tell apart.
|
|
90
|
+
*/
|
|
91
|
+
locate() {
|
|
92
|
+
for (const [error, domain] of this.unlocated) {
|
|
93
|
+
// Its first frame is abc's own, its second the module's factory. An
|
|
94
|
+
// engine may name no script for the factory's frame (JavaScriptCore,
|
|
95
|
+
// for code a Function made), and the next frame that names one is
|
|
96
|
+
// the host's, which must not stand for the module.
|
|
97
|
+
const at = stackFrames(error.stack)[1];
|
|
98
|
+
if (at) {
|
|
99
|
+
this.moduleDomains.set(at, new WeakRef(domain));
|
|
100
|
+
this.moduleDomainGone.register(domain, at);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
this.unlocated.length = 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Namespaces and multinames, as generated modules describe them.
|
|
2
|
+
//
|
|
3
|
+
// Namespaces are interned by kind and URI across modules, as the compiler
|
|
4
|
+
// interns them, so two modules' `public` are one object and names compare by
|
|
5
|
+
// identity. A private namespace is only ever equal to itself.
|
|
6
|
+
import { NO_CACHE } from "./property-cache.js";
|
|
7
|
+
/** Namespace kinds, numbered as the compiler's NS_* constants. */
|
|
8
|
+
export const NS_Public = 0;
|
|
9
|
+
export const NS_PackageInternal = 1;
|
|
10
|
+
export const NS_Protected = 2;
|
|
11
|
+
export const NS_Explicit = 3;
|
|
12
|
+
export const NS_StaticProtected = 4;
|
|
13
|
+
export const NS_Private = 5;
|
|
14
|
+
export class Namespace {
|
|
15
|
+
kind;
|
|
16
|
+
uri;
|
|
17
|
+
prefix;
|
|
18
|
+
constructor(kind,
|
|
19
|
+
/** null for a namespace without a URI (the any namespace). */
|
|
20
|
+
uri,
|
|
21
|
+
/**
|
|
22
|
+
* E4X's prefix, undefined for none, as a Namespace value can have one.
|
|
23
|
+
* A namespace with a prefix is not interned: names look it up as the
|
|
24
|
+
* interned one of its kind and URI (see interned).
|
|
25
|
+
*/
|
|
26
|
+
prefix = undefined) {
|
|
27
|
+
this.kind = kind;
|
|
28
|
+
this.uri = uri;
|
|
29
|
+
this.prefix = prefix;
|
|
30
|
+
}
|
|
31
|
+
/** The namespace names look this one up as: this one, or without its prefix, interned. */
|
|
32
|
+
get interned() {
|
|
33
|
+
return this.prefix === undefined ? this : namespace(this.kind, this.uri);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** The interned namespaces, by kind, then URI: null, the any namespace, is not "null". */
|
|
37
|
+
const interned = [];
|
|
38
|
+
/** The namespace of `kind` and `uri`, the same object each time. */
|
|
39
|
+
export function namespace(kind, uri) {
|
|
40
|
+
let byUri = interned[kind];
|
|
41
|
+
if (!byUri) {
|
|
42
|
+
byUri = new Map();
|
|
43
|
+
interned[kind] = byUri;
|
|
44
|
+
}
|
|
45
|
+
let ns = byUri.get(uri);
|
|
46
|
+
if (!ns) {
|
|
47
|
+
ns = new Namespace(kind, uri);
|
|
48
|
+
byUri.set(uri, ns);
|
|
49
|
+
}
|
|
50
|
+
return ns;
|
|
51
|
+
}
|
|
52
|
+
export const publicNs = namespace(NS_Public, "");
|
|
53
|
+
const PUBLIC_NAMESPACES = [publicNs];
|
|
54
|
+
const ALL_VERSIONS = [255];
|
|
55
|
+
/**
|
|
56
|
+
* A public Namespace value of `uri` with `prefix`, as E4X makes one: with
|
|
57
|
+
* no prefix, or the empty one for the empty URI, the interned namespace.
|
|
58
|
+
*/
|
|
59
|
+
export function prefixedNamespace(prefix, uri) {
|
|
60
|
+
if (prefix === undefined || (prefix === "" && uri === "")) {
|
|
61
|
+
return namespace(NS_Public, uri);
|
|
62
|
+
}
|
|
63
|
+
return new Namespace(NS_Public, uri, prefix);
|
|
64
|
+
}
|
|
65
|
+
/** A Namespace value's prefix, as avmplus has it: the empty URI's is "", else undefined unless given. */
|
|
66
|
+
export function prefixOf(ns) {
|
|
67
|
+
return ns.prefix ?? (ns.uri === "" ? "" : undefined);
|
|
68
|
+
}
|
|
69
|
+
// Multiname kinds, as the ABC numbers them.
|
|
70
|
+
export const CONSTANT_Qname = 0x07;
|
|
71
|
+
export const CONSTANT_QnameA = 0x0d;
|
|
72
|
+
export const CONSTANT_RTQname = 0x0f;
|
|
73
|
+
export const CONSTANT_RTQnameA = 0x10;
|
|
74
|
+
export const CONSTANT_RTQnameL = 0x11;
|
|
75
|
+
export const CONSTANT_RTQnameLA = 0x12;
|
|
76
|
+
export const CONSTANT_Multiname = 0x09;
|
|
77
|
+
export const CONSTANT_MultinameA = 0x0e;
|
|
78
|
+
export const CONSTANT_MultinameL = 0x1b;
|
|
79
|
+
export const CONSTANT_MultinameLA = 0x1c;
|
|
80
|
+
export const CONSTANT_TypeName = 0x1d;
|
|
81
|
+
/**
|
|
82
|
+
* A name as a property lookup uses it: its namespaces, each with the API
|
|
83
|
+
* version it sees bindings at, and its local name, null for any name.
|
|
84
|
+
*/
|
|
85
|
+
export class Multiname {
|
|
86
|
+
kind;
|
|
87
|
+
namespaces;
|
|
88
|
+
versions;
|
|
89
|
+
attribute;
|
|
90
|
+
/**
|
|
91
|
+
* The object a runtime name was, which a Dictionary keys by itself; its
|
|
92
|
+
* name is the object's string for any other. Declared, so that every
|
|
93
|
+
* multiname has the same shape.
|
|
94
|
+
*/
|
|
95
|
+
key = undefined;
|
|
96
|
+
/** The local name, or undefined until a key's is first needed. */
|
|
97
|
+
local;
|
|
98
|
+
/** How a key's name is made, as the object's string, when a lookup first needs it. */
|
|
99
|
+
nameOf = null;
|
|
100
|
+
/**
|
|
101
|
+
* The application domain whose definitions the name is looked up in: its
|
|
102
|
+
* module's, or the one of the name it was made from; null for the root.
|
|
103
|
+
*/
|
|
104
|
+
domain = null;
|
|
105
|
+
/** What its lookups found, for a module's name (property-cache.ts); a name made at run time keeps none. */
|
|
106
|
+
cache = NO_CACHE;
|
|
107
|
+
/**
|
|
108
|
+
* The script that defines it, once found: the first definition of a name
|
|
109
|
+
* wins, so later modules cannot change it (Runtime.definingScript).
|
|
110
|
+
*/
|
|
111
|
+
script = null;
|
|
112
|
+
/**
|
|
113
|
+
* That script's global object, once the script has been asked to run: a
|
|
114
|
+
* module's finddef reads it before calling the runtime (Runtime.findDef).
|
|
115
|
+
*/
|
|
116
|
+
global = null;
|
|
117
|
+
/** The class it names, once resolved (Runtime.resolveName). */
|
|
118
|
+
cls = null;
|
|
119
|
+
/** Fixed at construction so indexed access needs no getter in its hot path. */
|
|
120
|
+
elementName;
|
|
121
|
+
constructor(kind,
|
|
122
|
+
/** Its namespaces; one of null, as a Qname's, is any namespace. */
|
|
123
|
+
namespaces, versions, name, attribute) {
|
|
124
|
+
this.kind = kind;
|
|
125
|
+
this.namespaces = namespaces;
|
|
126
|
+
this.versions = versions;
|
|
127
|
+
this.attribute = attribute;
|
|
128
|
+
this.local = name;
|
|
129
|
+
this.elementName =
|
|
130
|
+
!attribute && namespaces.some((ns) => ns !== null && ns.kind === NS_Public && ns.uri === "");
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A runtime name that was an object: a Dictionary keys by the object
|
|
134
|
+
* itself, and anything else by its string, which is made only then, as
|
|
135
|
+
* avmplus converts it only for an object that is not a Dictionary.
|
|
136
|
+
*/
|
|
137
|
+
static keyed(kind, namespaces, versions, key, attribute, nameOf) {
|
|
138
|
+
const mn = new Multiname(kind, namespaces, versions, null, attribute);
|
|
139
|
+
mn.key = key;
|
|
140
|
+
mn.local = undefined;
|
|
141
|
+
mn.nameOf = nameOf;
|
|
142
|
+
return mn;
|
|
143
|
+
}
|
|
144
|
+
/** The local name, null for any name. */
|
|
145
|
+
get name() {
|
|
146
|
+
const local = this.local;
|
|
147
|
+
if (local !== undefined) {
|
|
148
|
+
return local;
|
|
149
|
+
}
|
|
150
|
+
const name = this.nameOf(this.key);
|
|
151
|
+
this.local = name;
|
|
152
|
+
return name;
|
|
153
|
+
}
|
|
154
|
+
/** Whether the name still needs a namespace from the stack. */
|
|
155
|
+
get runtimeNs() {
|
|
156
|
+
const k = this.kind;
|
|
157
|
+
return (k === CONSTANT_RTQname ||
|
|
158
|
+
k === CONSTANT_RTQnameA ||
|
|
159
|
+
k === CONSTANT_RTQnameL ||
|
|
160
|
+
k === CONSTANT_RTQnameLA);
|
|
161
|
+
}
|
|
162
|
+
/** Whether the local name comes from the stack. */
|
|
163
|
+
get runtimeName() {
|
|
164
|
+
const k = this.kind;
|
|
165
|
+
return (k === CONSTANT_RTQnameL ||
|
|
166
|
+
k === CONSTANT_RTQnameLA ||
|
|
167
|
+
k === CONSTANT_MultinameL ||
|
|
168
|
+
k === CONSTANT_MultinameLA);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The dynamic property the name names, or null, as
|
|
172
|
+
* Multiname::isValidDynamicName: not an attribute and with a public
|
|
173
|
+
* namespace, one of the public kind and an empty URI, as
|
|
174
|
+
* Namespace::isPublic.
|
|
175
|
+
*/
|
|
176
|
+
dynamicName() {
|
|
177
|
+
if (this.attribute || this.name === null) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
for (const ns of this.namespaces) {
|
|
181
|
+
// null is any namespace, as in *::x.
|
|
182
|
+
if (ns !== null && ns.kind === NS_Public && ns.uri === "") {
|
|
183
|
+
return this.name;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
toString() {
|
|
189
|
+
const ns = this.namespaces.length === 1 ? this.namespaces[0] : null;
|
|
190
|
+
const name = this.name ?? "*";
|
|
191
|
+
return ns?.uri ? `${ns.uri}::${name}` : name;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/** A TypeName, `Base.<Param>`, whose parts are other multinames of its module. */
|
|
195
|
+
export class TypeName {
|
|
196
|
+
base;
|
|
197
|
+
params;
|
|
198
|
+
names = [];
|
|
199
|
+
constructor(base, params) {
|
|
200
|
+
this.base = base;
|
|
201
|
+
this.params = params;
|
|
202
|
+
}
|
|
203
|
+
get baseName() {
|
|
204
|
+
return this.names[this.base];
|
|
205
|
+
}
|
|
206
|
+
param(i) {
|
|
207
|
+
return this.names[this.params[i]];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/** A Qname in one namespace, seen at every version. */
|
|
211
|
+
export function qname(ns, name) {
|
|
212
|
+
return new Multiname(CONSTANT_Qname, ns === publicNs ? PUBLIC_NAMESPACES : [ns], ALL_VERSIONS, name, false);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* A public name the runtime makes from a string, as `in`, hasOwnProperty,
|
|
216
|
+
* JSON and AMF do: seen at user code's version, as avmplus' findPublicNamespace
|
|
217
|
+
* sees it from the user code on the call stack, so an AIR-only or a
|
|
218
|
+
* VM-internal binding is not there, as it is not to the code itself.
|
|
219
|
+
*/
|
|
220
|
+
export function publicQname(name, versions) {
|
|
221
|
+
return new Multiname(CONSTANT_Qname, PUBLIC_NAMESPACES, versions, name, false);
|
|
222
|
+
}
|
|
223
|
+
/** The builtin Vector classes, which avmplus names as the types they are vectors of. */
|
|
224
|
+
const VECTOR_NAMES = {
|
|
225
|
+
"__AS3__.vec::Vector$int": "__AS3__.vec::Vector.<int>",
|
|
226
|
+
"__AS3__.vec::Vector$uint": "__AS3__.vec::Vector.<uint>",
|
|
227
|
+
"__AS3__.vec::Vector$double": "__AS3__.vec::Vector.<Number>",
|
|
228
|
+
"__AS3__.vec::Vector$object": "__AS3__.vec::Vector.<*>",
|
|
229
|
+
};
|
|
230
|
+
/** A traits' name as avmplus writes it: a class's statics' without their trailing $, a builtin Vector's as Vector.<T>. */
|
|
231
|
+
export function formatClassName(name) {
|
|
232
|
+
const own = name.endsWith("$") ? name.slice(0, -1) : name;
|
|
233
|
+
return VECTOR_NAMES[own] ?? own;
|
|
234
|
+
}
|
|
235
|
+
/** A name's index as an array element, or -1: a canonical uint below 2^32 - 1. */
|
|
236
|
+
export function arrayIndex(name) {
|
|
237
|
+
const c = name.charCodeAt(0);
|
|
238
|
+
if (!(c >= 0x30 && c <= 0x39)) {
|
|
239
|
+
return -1;
|
|
240
|
+
}
|
|
241
|
+
const i = Number(name);
|
|
242
|
+
return i >>> 0 === i && i !== 0xffffffff && String(i) === name ? i : -1;
|
|
243
|
+
}
|
|
244
|
+
/** The qualified name of a class's name, "uri::name", or the name in the unnamed package. */
|
|
245
|
+
export function qualifiedName(mn) {
|
|
246
|
+
const ns = mn.namespaces[0];
|
|
247
|
+
return ns?.uri ? `${ns.uri}::${mn.name}` : (mn.name ?? "*");
|
|
248
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Class aliases, and AMF through ByteArray's readObject and writeObject.
|
|
2
|
+
import { readObject, writeObject } from "../amf.js";
|
|
3
|
+
import { bytesOf } from "./bytearray.js";
|
|
4
|
+
export const aliasesNatives = {
|
|
5
|
+
// Class aliases and AMF.
|
|
6
|
+
"flash.net::registerClassAlias": (rt) => (aliasName, cls) => {
|
|
7
|
+
if (cls === null || cls === undefined) {
|
|
8
|
+
throw rt.error("TypeError", 2007, "classObject");
|
|
9
|
+
}
|
|
10
|
+
if (aliasName === null || aliasName === undefined) {
|
|
11
|
+
throw rt.error("TypeError", 2007, "aliasName");
|
|
12
|
+
}
|
|
13
|
+
const name = rt.toString(aliasName);
|
|
14
|
+
if (name === "") {
|
|
15
|
+
throw rt.error("ArgumentError", 2085, "aliasName");
|
|
16
|
+
}
|
|
17
|
+
rt.registerClassAlias(name, cls);
|
|
18
|
+
},
|
|
19
|
+
"flash.net::getClassByAlias": (rt) => (aliasName) => {
|
|
20
|
+
if (aliasName === null || aliasName === undefined) {
|
|
21
|
+
throw rt.error("TypeError", 2007, "aliasName");
|
|
22
|
+
}
|
|
23
|
+
const name = rt.toString(aliasName);
|
|
24
|
+
if (name === "") {
|
|
25
|
+
throw rt.error("ArgumentError", 2085, "aliasName");
|
|
26
|
+
}
|
|
27
|
+
return rt.classByAlias(name);
|
|
28
|
+
},
|
|
29
|
+
"flash.net::ObjectEncoding.get:dynamicPropertyWriter": (rt) => () => rt.dynamicPropertyWriter,
|
|
30
|
+
"flash.net::ObjectEncoding.set:dynamicPropertyWriter": (rt) => (writer) => {
|
|
31
|
+
rt.dynamicPropertyWriter = writer ?? null;
|
|
32
|
+
},
|
|
33
|
+
// What writeDynamicProperties writes through: the object being written's
|
|
34
|
+
// dynamic part, each name and value.
|
|
35
|
+
"flash.net::DynamicPropertyOutput#writeDynamicProperty": (rt) => function (name, value) {
|
|
36
|
+
if (name === null || name === undefined) {
|
|
37
|
+
throw rt.error("TypeError", 2007, "name");
|
|
38
|
+
}
|
|
39
|
+
this.$amf.dynamicProperty(rt.toString(name), value);
|
|
40
|
+
},
|
|
41
|
+
"flash.utils::ByteArray#writeObject": (rt) => function (v) {
|
|
42
|
+
writeObject(rt, bytesOf(rt, this), v);
|
|
43
|
+
},
|
|
44
|
+
"flash.utils::ByteArray#readObject": (rt) => function () {
|
|
45
|
+
return readObject(rt, bytesOf(rt, this));
|
|
46
|
+
},
|
|
47
|
+
};
|