@swf2es/player-hosts 0.0.0-stage → 0.1.0
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,27 @@
|
|
|
1
|
+
// flash.net.FileFilter: three strings a file dialog would show.
|
|
2
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
3
|
+
export function fileFilterNatives(_s) {
|
|
4
|
+
const natives = {};
|
|
5
|
+
class FileFilterNatives {
|
|
6
|
+
get description() {
|
|
7
|
+
return this.$description ?? null;
|
|
8
|
+
}
|
|
9
|
+
set description(v) {
|
|
10
|
+
this.$description = v;
|
|
11
|
+
}
|
|
12
|
+
get extension() {
|
|
13
|
+
return this.$extension ?? null;
|
|
14
|
+
}
|
|
15
|
+
set extension(v) {
|
|
16
|
+
this.$extension = v;
|
|
17
|
+
}
|
|
18
|
+
get macType() {
|
|
19
|
+
return this.$macType ?? null;
|
|
20
|
+
}
|
|
21
|
+
set macType(v) {
|
|
22
|
+
this.$macType = v;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
avm2.registerNativeClass(natives, "flash.net::FileFilter", FileFilterNatives);
|
|
26
|
+
return natives;
|
|
27
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// File dialogs and transfers, shared with AVM1 through the host's file services.
|
|
2
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
3
|
+
import { FileReference } from "../../../files.js";
|
|
4
|
+
import { dispatchEvent } from "../../../scripting/events.js";
|
|
5
|
+
import { fileEntry } from "../filesystem/File.js";
|
|
6
|
+
export function fileReferenceNatives(s) {
|
|
7
|
+
const natives = {};
|
|
8
|
+
const states = new WeakMap();
|
|
9
|
+
const services = {
|
|
10
|
+
host: s.fileHost,
|
|
11
|
+
signal: s.fileLifetime.signal,
|
|
12
|
+
defer: (deliver) => s.loads.deferHostEvent(deliver),
|
|
13
|
+
track: (task) => s.loads.trackRequest(task),
|
|
14
|
+
fetch: (request, signal) => s.fetch ? s.fetch({ ...request, purpose: "data" }, signal) : Promise.reject(),
|
|
15
|
+
error: (id) => {
|
|
16
|
+
throw s.rt.error("Error", id);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const state = (target) => {
|
|
20
|
+
let ref = states.get(target);
|
|
21
|
+
if (!ref) {
|
|
22
|
+
ref = new FileReference(services, (type, loaded, total, text) => {
|
|
23
|
+
let event;
|
|
24
|
+
switch (type) {
|
|
25
|
+
case "httpStatus":
|
|
26
|
+
event = s.httpStatus(loaded ?? 0);
|
|
27
|
+
break;
|
|
28
|
+
case "progress":
|
|
29
|
+
event = s.rt.construct(s.rt.classNamed("flash.events::ProgressEvent"), type, false, false, loaded, total);
|
|
30
|
+
break;
|
|
31
|
+
case "ioError":
|
|
32
|
+
target.$fileInto = null;
|
|
33
|
+
event = s.rt.construct(s.rt.classNamed("flash.events::IOErrorEvent"), type, false, false, text);
|
|
34
|
+
break;
|
|
35
|
+
case "uploadCompleteData":
|
|
36
|
+
event = s.rt.construct(s.rt.classNamed("flash.events::DataEvent"), type, false, false, text);
|
|
37
|
+
break;
|
|
38
|
+
case "complete": {
|
|
39
|
+
const into = target.$fileInto;
|
|
40
|
+
const data = states.get(target)?.data;
|
|
41
|
+
if (into && data) {
|
|
42
|
+
const bytes = avm2.bytesOf(s.rt, into);
|
|
43
|
+
bytes.length = 0;
|
|
44
|
+
bytes.position = 0;
|
|
45
|
+
bytes.write(data);
|
|
46
|
+
bytes.position = 0;
|
|
47
|
+
target.$fileData = into;
|
|
48
|
+
}
|
|
49
|
+
target.$fileInto = null;
|
|
50
|
+
event = s.event(type);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
case "select":
|
|
54
|
+
target.$fileData = null;
|
|
55
|
+
target.$fileInto = null;
|
|
56
|
+
event = s.event(type);
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
event = s.event(type);
|
|
60
|
+
}
|
|
61
|
+
dispatchEvent(s, target, event);
|
|
62
|
+
});
|
|
63
|
+
states.set(target, ref);
|
|
64
|
+
}
|
|
65
|
+
return ref;
|
|
66
|
+
};
|
|
67
|
+
const file = (target) => state(target).file ?? services.error(2037);
|
|
68
|
+
const property = (target, name) => s.rt.getProperty(target, s.rt.publicName(name));
|
|
69
|
+
const filters = (value) => (value?.$a ?? []).map((filter) => ({
|
|
70
|
+
description: s.rt.toString(property(filter, "description")),
|
|
71
|
+
extension: s.rt.toString(property(filter, "extension")),
|
|
72
|
+
}));
|
|
73
|
+
const requestOf = (request) => {
|
|
74
|
+
if (request === null || request === undefined) {
|
|
75
|
+
throw s.rt.error("TypeError", 2007, "request");
|
|
76
|
+
}
|
|
77
|
+
return request;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* What a File with a path has on disk, as a selected file's fields: its
|
|
81
|
+
* name whether or not it is there, the rest Error 3003 where it is not.
|
|
82
|
+
*/
|
|
83
|
+
const onDisk = (target) => {
|
|
84
|
+
const entry = fileEntry(s, target);
|
|
85
|
+
if (!entry) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const stat = entry.stat;
|
|
89
|
+
const missing = () => {
|
|
90
|
+
throw s.rt.error("Error", 3003);
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
name: entry.name,
|
|
94
|
+
get size() {
|
|
95
|
+
return stat ? (stat.directory ? 0 : stat.size) : missing();
|
|
96
|
+
},
|
|
97
|
+
get modificationDate() {
|
|
98
|
+
return stat ? stat.modified : missing();
|
|
99
|
+
},
|
|
100
|
+
get creationDate() {
|
|
101
|
+
return stat ? stat.created : missing();
|
|
102
|
+
},
|
|
103
|
+
directory: stat?.directory ?? false,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
const described = (target) => onDisk(target) ?? file(target);
|
|
107
|
+
class FileReferenceNatives {
|
|
108
|
+
get creationDate() {
|
|
109
|
+
const selected = described(this);
|
|
110
|
+
return s.rt.construct(s.rt.classNamed("Date"), selected.creationDate ?? selected.modificationDate);
|
|
111
|
+
}
|
|
112
|
+
get modificationDate() {
|
|
113
|
+
return s.rt.construct(s.rt.classNamed("Date"), described(this).modificationDate);
|
|
114
|
+
}
|
|
115
|
+
get name() {
|
|
116
|
+
return described(this).name;
|
|
117
|
+
}
|
|
118
|
+
get size() {
|
|
119
|
+
return described(this).size;
|
|
120
|
+
}
|
|
121
|
+
get type() {
|
|
122
|
+
const { name, directory } = described(this);
|
|
123
|
+
// A directory's is empty, a file's its extension with the dot, as adl's.
|
|
124
|
+
if (directory) {
|
|
125
|
+
return "";
|
|
126
|
+
}
|
|
127
|
+
const dot = name.lastIndexOf(".");
|
|
128
|
+
return dot < 0 ? "" : name.slice(dot);
|
|
129
|
+
}
|
|
130
|
+
get creator() {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
get data() {
|
|
134
|
+
return this.$fileData ?? null;
|
|
135
|
+
}
|
|
136
|
+
browse(typeFilter = null) {
|
|
137
|
+
state(this).browse(filters(typeFilter));
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
cancel() {
|
|
141
|
+
state(this).cancel();
|
|
142
|
+
this.$fileInto = null;
|
|
143
|
+
}
|
|
144
|
+
download(request, name = null) {
|
|
145
|
+
const outgoing = s.loads.fetchRequest(requestOf(request), s.url, { requestHeaders: false });
|
|
146
|
+
const suggested = name == null
|
|
147
|
+
? outgoing.url.split(/[?#]/, 1)[0].split("/").pop() || "download"
|
|
148
|
+
: s.rt.toString(name);
|
|
149
|
+
state(this).save(suggested, outgoing);
|
|
150
|
+
}
|
|
151
|
+
upload(request, field = "Filedata", test = false) {
|
|
152
|
+
const outgoing = s.loads.fetchRequest(requestOf(request), s.url, { requestHeaders: false });
|
|
153
|
+
if (field === null || field === undefined) {
|
|
154
|
+
throw s.rt.error("TypeError", 2007, "uploadDataFieldName");
|
|
155
|
+
}
|
|
156
|
+
const name = s.rt.toString(field);
|
|
157
|
+
const data = request.$data;
|
|
158
|
+
if (name === "" ||
|
|
159
|
+
(data && typeof data === "object" && s.rt.traitsOf(data).name === "flash.utils::ByteArray")) {
|
|
160
|
+
throw s.rt.error("ArgumentError", 2004);
|
|
161
|
+
}
|
|
162
|
+
state(this).upload(outgoing, name, Boolean(test) && s.platform.os.startsWith("Windows"));
|
|
163
|
+
}
|
|
164
|
+
uploadUnencoded(request) {
|
|
165
|
+
state(this).upload(s.loads.fetchRequest(requestOf(request), s.url, { requestHeaders: "all" }), null);
|
|
166
|
+
}
|
|
167
|
+
"flash.net:FileReference::_load"(into) {
|
|
168
|
+
state(this).load();
|
|
169
|
+
this.$fileInto = into;
|
|
170
|
+
this.$fileData = null;
|
|
171
|
+
}
|
|
172
|
+
"flash.net:FileReference::_save"(data, name) {
|
|
173
|
+
const bytes = avm2.bytesOf(s.rt, data);
|
|
174
|
+
state(this).save(name == null ? "Untitled" : s.rt.toString(name), bytes.buffer.slice(0, bytes.length));
|
|
175
|
+
}
|
|
176
|
+
static "flash.net:FileReference::_ensureIsRootPlayer"() { }
|
|
177
|
+
}
|
|
178
|
+
class FileReferenceListNatives {
|
|
179
|
+
get fileList() {
|
|
180
|
+
return this.$fileList ?? null;
|
|
181
|
+
}
|
|
182
|
+
browse(typeFilter = null) {
|
|
183
|
+
this.$fileList = s.rt.array([]);
|
|
184
|
+
state(this).browse(filters(typeFilter), true, (files) => {
|
|
185
|
+
this.$fileList = s.rt.array(files.map((file) => {
|
|
186
|
+
const object = s.rt.construct(s.rt.classNamed("flash.net::FileReference"));
|
|
187
|
+
state(object).file = file;
|
|
188
|
+
return object;
|
|
189
|
+
}));
|
|
190
|
+
});
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
avm2.registerNativeClass(natives, "flash.net::FileReference", FileReferenceNatives);
|
|
195
|
+
avm2.registerNativeClass(natives, "flash.net::FileReferenceList", FileReferenceListNatives);
|
|
196
|
+
return natives;
|
|
197
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Both VMs use the player's LocalConnection registry. The AS3 class keeps
|
|
2
|
+
// its public API in playerglobal; only transport and VM values live here.
|
|
3
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
4
|
+
import { localDomain, localMethodAllowed } from "../../../localconnection.js";
|
|
5
|
+
import { dispatchEvent, heard } from "../../../scripting/events.js";
|
|
6
|
+
import { readModernValues, writeModernValues } from "./local-modern.js";
|
|
7
|
+
import { readLocalValues, writeLocalValues } from "./local-values.js";
|
|
8
|
+
export function swfDomain(url) {
|
|
9
|
+
return localDomain(url).domain;
|
|
10
|
+
}
|
|
11
|
+
export function localConnectionNatives(s) {
|
|
12
|
+
const natives = {};
|
|
13
|
+
const states = new WeakMap();
|
|
14
|
+
const state = (self) => {
|
|
15
|
+
const found = states.get(self);
|
|
16
|
+
if (found) {
|
|
17
|
+
return found;
|
|
18
|
+
}
|
|
19
|
+
const origins = s.code.securityUrls(3).map(localDomain);
|
|
20
|
+
const origin = origins[0] ?? localDomain(s.url);
|
|
21
|
+
if (origins.some((other) => other.domain !== origin.domain || other.secure !== origin.secure)) {
|
|
22
|
+
// Where the engine cannot identify a caller, do not borrow the main SWF's permissions.
|
|
23
|
+
origin.domain = "";
|
|
24
|
+
}
|
|
25
|
+
const endpoint = {
|
|
26
|
+
owner: s,
|
|
27
|
+
...origin,
|
|
28
|
+
key: null,
|
|
29
|
+
client: self,
|
|
30
|
+
locked: false,
|
|
31
|
+
perUser: false,
|
|
32
|
+
domains: new Set(),
|
|
33
|
+
insecure: new Set(),
|
|
34
|
+
alive: () => !s.destroyed,
|
|
35
|
+
allows: (sender) => {
|
|
36
|
+
const allowed = endpoint.secure && !sender.secure ? endpoint.insecure : endpoint.domains;
|
|
37
|
+
return ((!(endpoint.secure && !sender.secure) && sender.domain === endpoint.domain) ||
|
|
38
|
+
allowed.has("*") ||
|
|
39
|
+
allowed.has(sender.domain));
|
|
40
|
+
},
|
|
41
|
+
defer: (deliver) => s.loads.deferHostEvent(deliver),
|
|
42
|
+
status: (success) => {
|
|
43
|
+
if (!heard(self, "status")) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
dispatchEvent(s, self, s.rt.construct(s.rt.classNamed("flash.events::StatusEvent"), "status", false, false, null, success ? "status" : "error"));
|
|
47
|
+
},
|
|
48
|
+
receive: (method, message) => {
|
|
49
|
+
try {
|
|
50
|
+
s.rt.callProperty(endpoint.client, s.rt.publicName(method), ...(message.encoding === 0
|
|
51
|
+
? readLocalValues(s.rt, message.bytes)
|
|
52
|
+
: readModernValues(s.rt, message.bytes)));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (error instanceof Error) {
|
|
56
|
+
s.reportUncaught(error);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const failure = s.rt.error("Error", 2095, "flash.net.LocalConnection", method);
|
|
60
|
+
if (!heard(self, "asyncError")) {
|
|
61
|
+
s.reportUncaught(failure);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
dispatchEvent(s, self, s.rt.construct(s.rt.classNamed("flash.events::AsyncErrorEvent"), "asyncError", false, false, s.rt.getProperty(failure, s.rt.publicName("message")), s.rt.isInstance(error, s.rt.classNamed("Error"))
|
|
65
|
+
? error
|
|
66
|
+
: s.rt.construct(s.rt.classNamed("Error"), s.rt.toString(error))));
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
states.set(self, endpoint);
|
|
71
|
+
return endpoint;
|
|
72
|
+
};
|
|
73
|
+
class LocalConnectionNatives {
|
|
74
|
+
"flash.net:LocalConnection::ctor"() {
|
|
75
|
+
state(this);
|
|
76
|
+
}
|
|
77
|
+
get domain() {
|
|
78
|
+
return state(this).domain;
|
|
79
|
+
}
|
|
80
|
+
connect(name) {
|
|
81
|
+
const endpoint = state(this);
|
|
82
|
+
endpoint.locked = true;
|
|
83
|
+
if (name === null) {
|
|
84
|
+
throw s.rt.error("TypeError", 2007, "connectionName");
|
|
85
|
+
}
|
|
86
|
+
if (name === "") {
|
|
87
|
+
throw s.rt.error("ArgumentError", 2085, "connectionName");
|
|
88
|
+
}
|
|
89
|
+
if (name.includes(":")) {
|
|
90
|
+
throw s.rt.error("ArgumentError", 2004);
|
|
91
|
+
}
|
|
92
|
+
if (!s.localConnections.connect(endpoint, name)) {
|
|
93
|
+
throw s.rt.error("ArgumentError", 2082);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
close() {
|
|
97
|
+
const endpoint = state(this);
|
|
98
|
+
endpoint.locked = true;
|
|
99
|
+
if (!s.localConnections.close(endpoint)) {
|
|
100
|
+
throw s.rt.error("ArgumentError", 2083);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
send(name, method, ...args) {
|
|
104
|
+
const endpoint = state(this);
|
|
105
|
+
endpoint.locked = true;
|
|
106
|
+
if (name === null || method === null) {
|
|
107
|
+
throw s.rt.error("TypeError", 2007, name === null ? "connectionName" : "methodName");
|
|
108
|
+
}
|
|
109
|
+
if (name === "" || method === "") {
|
|
110
|
+
throw s.rt.error("ArgumentError", 2085, name === "" ? "connectionName" : "methodName");
|
|
111
|
+
}
|
|
112
|
+
if (!localMethodAllowed(method)) {
|
|
113
|
+
throw s.rt.error("ArgumentError", 2004);
|
|
114
|
+
}
|
|
115
|
+
let bytes;
|
|
116
|
+
try {
|
|
117
|
+
bytes = writeModernValues(s.rt, args);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (!(error instanceof RangeError)) {
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
throw s.rt.error("ArgumentError", 2084);
|
|
124
|
+
}
|
|
125
|
+
s.localConnections.send(endpoint, name, method, {
|
|
126
|
+
encoding: 3,
|
|
127
|
+
bytes,
|
|
128
|
+
legacy: () => writeLocalValues(s.rt, readModernValues(s.rt, bytes)),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
get client() {
|
|
132
|
+
return state(this).client;
|
|
133
|
+
}
|
|
134
|
+
set client(value) {
|
|
135
|
+
if (value === null || value === undefined) {
|
|
136
|
+
throw s.rt.error("TypeError", 2007, "client");
|
|
137
|
+
}
|
|
138
|
+
state(this).client = value;
|
|
139
|
+
}
|
|
140
|
+
get isPerUser() {
|
|
141
|
+
return state(this).perUser;
|
|
142
|
+
}
|
|
143
|
+
set isPerUser(value) {
|
|
144
|
+
const endpoint = state(this);
|
|
145
|
+
if (endpoint.locked) {
|
|
146
|
+
throw s.rt.error("Error", 3316);
|
|
147
|
+
}
|
|
148
|
+
endpoint.perUser = value;
|
|
149
|
+
}
|
|
150
|
+
allowDomain(...domains) {
|
|
151
|
+
const endpoint = state(this);
|
|
152
|
+
for (const domain of domains) {
|
|
153
|
+
endpoint.domains.add(s.rt.toString(domain).toLowerCase());
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
allowInsecureDomain(...domains) {
|
|
157
|
+
const endpoint = state(this);
|
|
158
|
+
for (const domain of domains) {
|
|
159
|
+
const name = s.rt.toString(domain).toLowerCase();
|
|
160
|
+
endpoint.insecure.add(name);
|
|
161
|
+
endpoint.domains.add(name);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
avm2.registerNativeClass(natives, "flash.net::LocalConnection", LocalConnectionNatives);
|
|
166
|
+
return natives;
|
|
167
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// flash.net.NetConnection in its local mode, connect(null), which Flash
|
|
2
|
+
// keeps for progressive video, with its properties and status events as
|
|
3
|
+
// Flash gives them; an HTTP URI is kept, as Flash Remoting would use it,
|
|
4
|
+
// and a call over it is not supported yet. Responder holds its callbacks.
|
|
5
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
6
|
+
import { dispatchEvent } from "../../../scripting/events.js";
|
|
7
|
+
/** NetConnection's private invoke codes, as playerglobal's constants have them. */
|
|
8
|
+
const CLOSE = 1;
|
|
9
|
+
const CALL = 2;
|
|
10
|
+
const ADD_HEADER = 3;
|
|
11
|
+
const NONCE = "0".repeat(64);
|
|
12
|
+
export function netConnectionNatives(s) {
|
|
13
|
+
const natives = {};
|
|
14
|
+
let defaultEncoding = 3;
|
|
15
|
+
const status = (target, info) => {
|
|
16
|
+
dispatchEvent(s, target, s.rt.construct(s.rt.classNamed("flash.events::NetStatusEvent"), "netStatus", false, false, s.rt.newObject(info)));
|
|
17
|
+
};
|
|
18
|
+
/** What a local connection has; ArgumentError 2126 for any other. */
|
|
19
|
+
const connectedOnly = (o, value) => {
|
|
20
|
+
if (!o.$connected) {
|
|
21
|
+
throw s.rt.error("ArgumentError", 2126);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
class NetConnectionNatives {
|
|
26
|
+
get connected() {
|
|
27
|
+
return this.$connected ?? false;
|
|
28
|
+
}
|
|
29
|
+
get uri() {
|
|
30
|
+
return this.$uri ?? null;
|
|
31
|
+
}
|
|
32
|
+
/** Null is the local connection, at once and connected; an HTTP URI is only kept. A connection made goes first. */
|
|
33
|
+
connect(command) {
|
|
34
|
+
const self = this;
|
|
35
|
+
if (this.$connected) {
|
|
36
|
+
this.$connected = false;
|
|
37
|
+
status(self, ["code", "NetConnection.Connect.Closed", "level", "status"]);
|
|
38
|
+
}
|
|
39
|
+
if (command === null || command === undefined || s.rt.toString(command) === "null") {
|
|
40
|
+
this.$uri = "null";
|
|
41
|
+
this.$connected = true;
|
|
42
|
+
status(self, ["code", "NetConnection.Connect.Success", "level", "status"]);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.$uri = s.rt.toString(command);
|
|
46
|
+
}
|
|
47
|
+
"flash.net:NetConnection::invoke"(code) {
|
|
48
|
+
if (s.rt.toUint(code) === CLOSE) {
|
|
49
|
+
close(this);
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
throw s.rt.unsupported(`NetConnection invoke ${s.rt.toUint(code)}`);
|
|
53
|
+
}
|
|
54
|
+
"flash.net:NetConnection::invokeWithArgsArray"(code, _args) {
|
|
55
|
+
const which = s.rt.toUint(code);
|
|
56
|
+
if (which === ADD_HEADER) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (which === CALL) {
|
|
60
|
+
throw s.rt.unsupported("NetConnection.call, Flash Remoting");
|
|
61
|
+
}
|
|
62
|
+
throw s.rt.unsupported(`NetConnection invoke ${which}`);
|
|
63
|
+
}
|
|
64
|
+
get client() {
|
|
65
|
+
return this.$client ?? this;
|
|
66
|
+
}
|
|
67
|
+
set client(v) {
|
|
68
|
+
if (v === null || v === undefined) {
|
|
69
|
+
throw s.rt.error("TypeError", 2004);
|
|
70
|
+
}
|
|
71
|
+
this.$client = v;
|
|
72
|
+
}
|
|
73
|
+
get objectEncoding() {
|
|
74
|
+
return this.$objectEncoding ?? defaultEncoding;
|
|
75
|
+
}
|
|
76
|
+
set objectEncoding(v) {
|
|
77
|
+
this.$objectEncoding = s.rt.toUint(v);
|
|
78
|
+
}
|
|
79
|
+
get proxyType() {
|
|
80
|
+
return this.$proxyType ?? "none";
|
|
81
|
+
}
|
|
82
|
+
set proxyType(v) {
|
|
83
|
+
this.$proxyType = s.rt.toString(v);
|
|
84
|
+
}
|
|
85
|
+
get maxPeerConnections() {
|
|
86
|
+
return this.$maxPeers ?? 8;
|
|
87
|
+
}
|
|
88
|
+
set maxPeerConnections(v) {
|
|
89
|
+
this.$maxPeers = s.rt.toUint(v);
|
|
90
|
+
}
|
|
91
|
+
get httpIdleTimeout() {
|
|
92
|
+
return this.$idleTimeout ?? 0;
|
|
93
|
+
}
|
|
94
|
+
"flash.net:NetConnection::_SetHTTPIdleTimeout"(v) {
|
|
95
|
+
this.$idleTimeout = s.rt.toNumber(v);
|
|
96
|
+
}
|
|
97
|
+
get connectedProxyType() {
|
|
98
|
+
return connectedOnly(this, "none");
|
|
99
|
+
}
|
|
100
|
+
get usingTLS() {
|
|
101
|
+
return connectedOnly(this, false);
|
|
102
|
+
}
|
|
103
|
+
get protocol() {
|
|
104
|
+
return connectedOnly(this, "rtmp");
|
|
105
|
+
}
|
|
106
|
+
get nearID() {
|
|
107
|
+
return connectedOnly(this, "");
|
|
108
|
+
}
|
|
109
|
+
get farID() {
|
|
110
|
+
return connectedOnly(this, "");
|
|
111
|
+
}
|
|
112
|
+
get nearNonce() {
|
|
113
|
+
return connectedOnly(this, NONCE);
|
|
114
|
+
}
|
|
115
|
+
get farNonce() {
|
|
116
|
+
return connectedOnly(this, NONCE);
|
|
117
|
+
}
|
|
118
|
+
get unconnectedPeerStreams() {
|
|
119
|
+
return connectedOnly(this, s.rt.array([]));
|
|
120
|
+
}
|
|
121
|
+
static get defaultObjectEncoding() {
|
|
122
|
+
return defaultEncoding;
|
|
123
|
+
}
|
|
124
|
+
static set defaultObjectEncoding(v) {
|
|
125
|
+
defaultEncoding = s.rt.toUint(v);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Closed, as Flash reports it: a local connection's CLOSED; for a kept
|
|
130
|
+
* URI, CLOSED and then a status of empty strings, as the corpus's
|
|
131
|
+
* `netconnection_close` has it; nothing for no connection.
|
|
132
|
+
*/
|
|
133
|
+
const close = (o) => {
|
|
134
|
+
const uri = o.$uri ?? null;
|
|
135
|
+
const wasConnected = o.$connected ?? false;
|
|
136
|
+
o.$connected = false;
|
|
137
|
+
o.$uri = null;
|
|
138
|
+
if (wasConnected) {
|
|
139
|
+
status(o, ["code", "NetConnection.Connect.Closed", "level", "status"]);
|
|
140
|
+
}
|
|
141
|
+
else if (uri !== null) {
|
|
142
|
+
status(o, ["code", "NetConnection.Connect.Closed", "level", "status"]);
|
|
143
|
+
status(o, ["code", "", "description", "", "details", "", "level", "status"]);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
class ResponderNatives {
|
|
147
|
+
"flash.net:Responder::ctor"(result, status) {
|
|
148
|
+
this.$result = result;
|
|
149
|
+
this.$status = status;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
avm2.registerNativeClass(natives, "flash.net::NetConnection", NetConnectionNatives);
|
|
153
|
+
avm2.registerNativeClass(natives, "flash.net::Responder", ResponderNatives);
|
|
154
|
+
return natives;
|
|
155
|
+
}
|