@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,280 @@
|
|
|
1
|
+
// Application domains, as avmplus' DomainMgr keeps them: the scripts each
|
|
2
|
+
// one's modules define, by name, and what each has found, from which a
|
|
3
|
+
// name's definition is looked up along a domain's chain.
|
|
4
|
+
import { NS_Private } from "./names.js";
|
|
5
|
+
/**
|
|
6
|
+
* An application domain, as avmplus' Domain: the scripts its modules
|
|
7
|
+
* define, by name, a name its chain defines already not again (see
|
|
8
|
+
* Runtime.abc); the definitions it has found, by name, which it keeps
|
|
9
|
+
* (see Runtime.findScript), as names and, apart, as types; and the ABCs
|
|
10
|
+
* loaded into it, by hash.
|
|
11
|
+
*/
|
|
12
|
+
export class Domain {
|
|
13
|
+
parent;
|
|
14
|
+
id;
|
|
15
|
+
globals = new Map();
|
|
16
|
+
cached = new Map();
|
|
17
|
+
/** As avmplus' m_cachedTraits, which a name's lookup never fills, nor a type's m_cachedScripts. */
|
|
18
|
+
types = new Map();
|
|
19
|
+
classRefs = new Map();
|
|
20
|
+
/**
|
|
21
|
+
* The classes classNamed found here, by qualified name: what a name
|
|
22
|
+
* finds in a domain is kept once found, so a player's lookups by name,
|
|
23
|
+
* one for each object it makes, need not name it anew each time.
|
|
24
|
+
*/
|
|
25
|
+
named = new Map();
|
|
26
|
+
/** The same, of the classes code finds by name, at user code's version (classNamedByCode). */
|
|
27
|
+
namedByCode = new Map();
|
|
28
|
+
own = [];
|
|
29
|
+
/** Each of its ABCs' place among all the runtime loads. */
|
|
30
|
+
ownOrder = [];
|
|
31
|
+
constructor(parent,
|
|
32
|
+
/** Its number in its runtime, which a host's compiler knows it by: the root's is 0. */
|
|
33
|
+
id) {
|
|
34
|
+
this.parent = parent;
|
|
35
|
+
this.id = id;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The ABCs a module loaded into it now is compiled after: its own and
|
|
39
|
+
* its ancestors', including those loaded after it was made, in the order
|
|
40
|
+
* they loaded.
|
|
41
|
+
*/
|
|
42
|
+
chain() {
|
|
43
|
+
if (!this.parent) {
|
|
44
|
+
return [...this.own];
|
|
45
|
+
}
|
|
46
|
+
const loads = [];
|
|
47
|
+
for (let d = this; d; d = d.parent) {
|
|
48
|
+
const { own, ownOrder } = d;
|
|
49
|
+
for (let i = 0; i < own.length; i++) {
|
|
50
|
+
loads.push([ownOrder[i], own[i]]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return loads.sort((a, b) => a[0] - b[0]).map(([, hash]) => hash);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Each frame's site, "script:line:column", innermost first, or null for a
|
|
58
|
+
* frame line it cannot read: V8's "at f (script:1:2)" and "at script:1:2",
|
|
59
|
+
* and SpiderMonkey's and JavaScriptCore's "f@script:1:2". Lines that are
|
|
60
|
+
* no frame, as V8's heading "Error", are left out. The site is read so
|
|
61
|
+
* that nothing a name holds can stand for it: in V8's frames, inside the
|
|
62
|
+
* last parentheses; in the others, after the first "@", since URLs may
|
|
63
|
+
* hold one ("/npm/p@1.0/m.js") and the names a SWF's code can have
|
|
64
|
+
* cannot (codegen spells them from [A-Za-z0-9_$]). One without a line and
|
|
65
|
+
* column is unread: JavaScriptCore's for code a Function or eval made,
|
|
66
|
+
* whatever its sourceURL ("f@"), and for native code ("f@[native code]"),
|
|
67
|
+
* and V8's "native", "<anonymous>" or "index 0".
|
|
68
|
+
*/
|
|
69
|
+
export function frameSites(stack) {
|
|
70
|
+
const lines = stack?.split("\n") ?? [];
|
|
71
|
+
const v8 = lines.some((line) => /^\s*at /.test(line));
|
|
72
|
+
const sites = [];
|
|
73
|
+
for (const line of lines) {
|
|
74
|
+
if (v8 ? !/^\s*at /.test(line) : !line.includes("@")) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
let site;
|
|
78
|
+
if (v8) {
|
|
79
|
+
const text = line.replace(/^\s*at /, "");
|
|
80
|
+
const open = text.lastIndexOf(" (");
|
|
81
|
+
site =
|
|
82
|
+
text.endsWith(")") && open >= 0 ? text.slice(open + 2, -1) : text.replace(/^async /, "");
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
site = line.slice(line.indexOf("@") + 1);
|
|
86
|
+
}
|
|
87
|
+
sites.push(/:\d+:\d+$/.test(site) ? site : null);
|
|
88
|
+
}
|
|
89
|
+
return sites;
|
|
90
|
+
}
|
|
91
|
+
/** A frame site's script: "script:1:2" without its line and column. */
|
|
92
|
+
export function siteScript(site) {
|
|
93
|
+
const script = /^(.+):\d+:\d+$/.exec(site)?.[1];
|
|
94
|
+
// Deferred entries have separate debugger files but their module's code context.
|
|
95
|
+
return script?.replace(/^(swf2es-\d+\.js)\/\$f\d+\.js$/, "$1") ?? null;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The script each of a stack's frames names, innermost first, or null for
|
|
99
|
+
* a frame that names none or a line it cannot read (see frameSites). For
|
|
100
|
+
* security checks, where such a frame must not be passed over;
|
|
101
|
+
* frameScripts leaves them out.
|
|
102
|
+
*/
|
|
103
|
+
export function stackFrames(stack) {
|
|
104
|
+
return frameSites(stack).map((site) => (site === null ? null : siteScript(site)));
|
|
105
|
+
}
|
|
106
|
+
/** The scripts a stack's frames name, innermost first, those that name none left out. */
|
|
107
|
+
export function frameScripts(stack) {
|
|
108
|
+
return stackFrames(stack).filter((at) => at !== null);
|
|
109
|
+
}
|
|
110
|
+
/** The definition of a table's that `mn` names: its namespaces in order, each at a version it sees. */
|
|
111
|
+
function match(table, mn, name) {
|
|
112
|
+
const list = table.get(name);
|
|
113
|
+
if (!list) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
for (let i = 0; i < mn.namespaces.length; i++) {
|
|
117
|
+
const ns = mn.namespaces[i];
|
|
118
|
+
for (const g of list) {
|
|
119
|
+
if (g.ns === ns && g.version <= mn.versions[i]) {
|
|
120
|
+
return g;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
/** Add a definition to a table, unless it has one of that name in that namespace. */
|
|
127
|
+
export function add(table, g, name) {
|
|
128
|
+
let list = table.get(name);
|
|
129
|
+
if (!list) {
|
|
130
|
+
list = [];
|
|
131
|
+
table.set(name, list);
|
|
132
|
+
}
|
|
133
|
+
if (!list.some((other) => other.ns === g.ns)) {
|
|
134
|
+
list.push(g);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The script that defines `mn` for `domain`, or null, as
|
|
139
|
+
* DomainMgr::findScriptInDomainByMultinameImpl finds it: a definition a
|
|
140
|
+
* domain of the chain has found before, from the name's own up; else the
|
|
141
|
+
* first loaded, from the root down. Either is kept by the name's domain,
|
|
142
|
+
* and one loaded by the domain that loaded it, so a child that found its
|
|
143
|
+
* own keeps it when its parent defines the name later. A type is found
|
|
144
|
+
* the same way through caches of its own (`asType`), as avmplus finds
|
|
145
|
+
* traits, so a class a child found by name is not the type it finds.
|
|
146
|
+
*/
|
|
147
|
+
export function findScript(domain, mn, asType) {
|
|
148
|
+
const name = mn.name;
|
|
149
|
+
if (name === null) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const cache = (d) => (asType ? d.types : d.cached);
|
|
153
|
+
for (let d = domain; d; d = d.parent) {
|
|
154
|
+
const found = match(cache(d), mn, name);
|
|
155
|
+
if (found) {
|
|
156
|
+
if (d !== domain) {
|
|
157
|
+
add(cache(domain), found, name);
|
|
158
|
+
}
|
|
159
|
+
return found.script;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const chain = [];
|
|
163
|
+
for (let d = domain; d; d = d.parent) {
|
|
164
|
+
chain.push(d);
|
|
165
|
+
}
|
|
166
|
+
for (let k = chain.length - 1; k >= 0; k--) {
|
|
167
|
+
const found = match(chain[k].globals, mn, name);
|
|
168
|
+
if (found) {
|
|
169
|
+
add(cache(chain[k]), found, name);
|
|
170
|
+
add(cache(domain), found, name);
|
|
171
|
+
return found.script;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The script of the first definition of `mn` from the root down to
|
|
178
|
+
* `domain`, what no cache has changed, and caching none: for a question
|
|
179
|
+
* that must not decide what a later lookup finds.
|
|
180
|
+
*/
|
|
181
|
+
export function firstDefinition(domain, mn) {
|
|
182
|
+
const name = mn.name;
|
|
183
|
+
if (name === null) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const chain = [];
|
|
187
|
+
for (let d = domain; d; d = d.parent) {
|
|
188
|
+
chain.push(d);
|
|
189
|
+
}
|
|
190
|
+
for (let k = chain.length - 1; k >= 0; k--) {
|
|
191
|
+
const found = match(chain[k].globals, mn, name);
|
|
192
|
+
if (found) {
|
|
193
|
+
return found.script;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
/** What an ABC loaded into `domain` now compiles in. */
|
|
199
|
+
export function compileUnit(domain) {
|
|
200
|
+
const domains = [];
|
|
201
|
+
for (let d = domain; d; d = d.parent) {
|
|
202
|
+
domains.push(d.id);
|
|
203
|
+
}
|
|
204
|
+
return { linked: domain.chain(), domains, found: foundIn(domain) };
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* What `domain` finds, by name and as a type, that is not the first
|
|
208
|
+
* definition from the root down: what a cache of its chain holds, from
|
|
209
|
+
* the domain up. The root's caches hold only its own first definitions.
|
|
210
|
+
*/
|
|
211
|
+
function foundIn(domain) {
|
|
212
|
+
const found = [];
|
|
213
|
+
for (const asType of [false, true]) {
|
|
214
|
+
const seen = new Set();
|
|
215
|
+
for (let d = domain; d?.parent; d = d.parent) {
|
|
216
|
+
for (const [name, list] of asType ? d.types : d.cached) {
|
|
217
|
+
for (const g of list) {
|
|
218
|
+
const key = `${g.ns.kind}:${g.ns.uri}::${name}`;
|
|
219
|
+
if (seen.has(key) || g.ns.uri === null || g.ns.kind === NS_Private) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
seen.add(key);
|
|
223
|
+
if (firstLoaded(domain, name, g.ns) !== g.script) {
|
|
224
|
+
const abc = g.script.abc;
|
|
225
|
+
found.push({
|
|
226
|
+
nsKind: g.ns.kind,
|
|
227
|
+
uri: g.ns.uri,
|
|
228
|
+
name,
|
|
229
|
+
domain: abc.domain.id,
|
|
230
|
+
index: abc.index,
|
|
231
|
+
hash: abc.hash,
|
|
232
|
+
asType,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return found;
|
|
240
|
+
}
|
|
241
|
+
/** The script that first defines `name` in `ns` for `domain`, from the root down. */
|
|
242
|
+
function firstLoaded(domain, name, ns) {
|
|
243
|
+
const chain = [];
|
|
244
|
+
for (let d = domain; d; d = d.parent) {
|
|
245
|
+
chain.push(d);
|
|
246
|
+
}
|
|
247
|
+
for (let k = chain.length - 1; k >= 0; k--) {
|
|
248
|
+
const g = chain[k].globals.get(name)?.find((other) => other.ns === ns);
|
|
249
|
+
if (g) {
|
|
250
|
+
return g.script;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
/** Whether `domain`'s chain defines `name` in `ns`, cached or loaded, without keeping what it finds. */
|
|
256
|
+
export function definedInChain(domain, name, ns) {
|
|
257
|
+
for (let d = domain; d; d = d.parent) {
|
|
258
|
+
if (d.cached.get(name)?.some((g) => g.ns === ns) ||
|
|
259
|
+
d.globals.get(name)?.some((g) => g.ns === ns)) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The names `domain`'s own modules define, private ones left out, as
|
|
267
|
+
* Flash's ApplicationDomain.getQualifiedDefinitionNames lists them:
|
|
268
|
+
* "pkg::Name", or the name alone in the top-level package.
|
|
269
|
+
*/
|
|
270
|
+
export function definitionNames(domain) {
|
|
271
|
+
const names = [];
|
|
272
|
+
for (const [name, list] of domain.globals) {
|
|
273
|
+
for (const g of list) {
|
|
274
|
+
if (g.ns.kind !== NS_Private) {
|
|
275
|
+
names.push(g.ns.uri ? `${g.ns.uri}::${name}` : name);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return names;
|
|
280
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// A dynamic object's properties, and the slots a for-in goes through them
|
|
2
|
+
// by. As avmplus' hashtable, where a name, its value and its place in a
|
|
3
|
+
// for-in are one slot, the properties keep the slots themselves, as they
|
|
4
|
+
// are set and deleted: a for-in reads a slot at each step, with no lookup,
|
|
5
|
+
// and finds at its start only what changed since the last, with no list of
|
|
6
|
+
// names to build and compare. An object no for-in has gone through keeps no
|
|
7
|
+
// slots, and its properties are a Map as any other.
|
|
8
|
+
/**
|
|
9
|
+
* The slots of an object's names, as avmplus' hashtable keeps them: a name
|
|
10
|
+
* keeps its slot while it is there, so that a for-in started inside another
|
|
11
|
+
* never moves the outer one's names. One deleted stays in its slot, which a
|
|
12
|
+
* for-in passes over, until a for-in next starts: then its slot is free.
|
|
13
|
+
* Names added since take the free slots, lowest first, in the order they
|
|
14
|
+
* were added, and only with none free does the list grow; set again before
|
|
15
|
+
* its slot is freed, a name takes it back.
|
|
16
|
+
*/
|
|
17
|
+
/** A slot's name deleted, or the slot free: passed over. */
|
|
18
|
+
export const GONE = 0;
|
|
19
|
+
/** A slot's name there. */
|
|
20
|
+
const THERE = 1;
|
|
21
|
+
/** A slot's name set again after it was deleted, its slot still in `deleted`. */
|
|
22
|
+
const BACK = 2;
|
|
23
|
+
export class Walk {
|
|
24
|
+
/** Each slot's name, null where free. */
|
|
25
|
+
slots;
|
|
26
|
+
/** Whether each slot's name is there: GONE, THERE or BACK. */
|
|
27
|
+
live;
|
|
28
|
+
slotOf;
|
|
29
|
+
/** The names added since a for-in last placed them, oldest first, some since deleted or added again. */
|
|
30
|
+
added = [];
|
|
31
|
+
/** The count of those at which the ones deleted are dropped and each kept once, so that none pile up. */
|
|
32
|
+
addedLimit = 64;
|
|
33
|
+
/** The slots of the names deleted since a for-in last started, to free when one next does. */
|
|
34
|
+
deleted = [];
|
|
35
|
+
/** The free slots, lowest first. */
|
|
36
|
+
free = [];
|
|
37
|
+
constructor(names) {
|
|
38
|
+
this.slots = names;
|
|
39
|
+
this.live = new Array(names.length).fill(THERE);
|
|
40
|
+
this.slotOf = new Map();
|
|
41
|
+
for (let i = 0; i < names.length; i++) {
|
|
42
|
+
this.slotOf.set(names[i], i);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** `name`, not there, set: back in its slot if it still has one, else to take one. */
|
|
46
|
+
noteAdded(name, properties) {
|
|
47
|
+
const i = this.slotOf.get(name);
|
|
48
|
+
if (i !== undefined) {
|
|
49
|
+
// In `deleted` still: set again and deleted over and over, it is there once.
|
|
50
|
+
this.live[i] = BACK;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.added.push(name);
|
|
54
|
+
if (this.added.length >= this.addedLimit) {
|
|
55
|
+
this.added = this.settle(properties);
|
|
56
|
+
this.addedLimit = Math.max(64, this.added.length * 2);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** `name`, there, deleted: passed over in its slot, if it has one, until a for-in next starts. */
|
|
60
|
+
noteDeleted(name) {
|
|
61
|
+
const i = this.slotOf.get(name);
|
|
62
|
+
if (i === undefined) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (this.live[i] === THERE) {
|
|
66
|
+
this.deleted.push(i);
|
|
67
|
+
}
|
|
68
|
+
this.live[i] = GONE;
|
|
69
|
+
}
|
|
70
|
+
/** At a for-in's start: the slots of the names deleted since the last are free. */
|
|
71
|
+
freeDeleted() {
|
|
72
|
+
const deleted = this.deleted;
|
|
73
|
+
if (deleted.length === 0) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const slots = this.slots;
|
|
77
|
+
for (let n = 0; n < deleted.length; n++) {
|
|
78
|
+
const i = deleted[n];
|
|
79
|
+
if (this.live[i] === BACK) {
|
|
80
|
+
this.live[i] = THERE;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.slotOf.delete(slots[i]);
|
|
84
|
+
slots[i] = null;
|
|
85
|
+
this.free.push(i);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
deleted.length = 0;
|
|
89
|
+
this.free.sort((a, b) => a - b);
|
|
90
|
+
}
|
|
91
|
+
/** The names added since this was last called, in the slots free, then after them. */
|
|
92
|
+
place(properties) {
|
|
93
|
+
if (this.added.length === 0) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const names = this.settle(properties);
|
|
97
|
+
const slots = this.slots;
|
|
98
|
+
const free = this.free;
|
|
99
|
+
let taken = 0;
|
|
100
|
+
for (let n = 0; n < names.length; n++) {
|
|
101
|
+
const name = names[n];
|
|
102
|
+
const i = taken < free.length ? free[taken++] : slots.length;
|
|
103
|
+
slots[i] = name;
|
|
104
|
+
this.live[i] = THERE;
|
|
105
|
+
this.slotOf.set(name, i);
|
|
106
|
+
}
|
|
107
|
+
free.splice(0, taken);
|
|
108
|
+
this.added = [];
|
|
109
|
+
this.addedLimit = 64;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The names of `added` still there and without a slot, each once, in the
|
|
113
|
+
* order the properties have them: by when each was last added.
|
|
114
|
+
*/
|
|
115
|
+
settle(properties) {
|
|
116
|
+
const added = this.added;
|
|
117
|
+
const kept = [];
|
|
118
|
+
const seen = new Set();
|
|
119
|
+
for (let n = added.length - 1; n >= 0; n--) {
|
|
120
|
+
const name = added[n];
|
|
121
|
+
if (!seen.has(name) && properties.has(name) && !this.slotOf.has(name)) {
|
|
122
|
+
seen.add(name);
|
|
123
|
+
kept.push(name);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return kept.reverse();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** An object's dynamic properties, by name, which keep their slots once a for-in has gone through them. */
|
|
130
|
+
export class DynamicProperties extends Map {
|
|
131
|
+
/** The slots, from the first for-in over the object. */
|
|
132
|
+
walk = null;
|
|
133
|
+
/**
|
|
134
|
+
* Whether every name was found hidden, as a prototype's methods are, so
|
|
135
|
+
* that a for-in passing through need not look at each again: until a
|
|
136
|
+
* name is set, or one shown (setPropertyIsEnumerable).
|
|
137
|
+
*/
|
|
138
|
+
allHidden = false;
|
|
139
|
+
set(name, value) {
|
|
140
|
+
this.allHidden = false;
|
|
141
|
+
// Undefined while the Map's constructor runs, before the field is set.
|
|
142
|
+
const walk = this.walk;
|
|
143
|
+
if (walk && !super.has(name)) {
|
|
144
|
+
walk.noteAdded(name, this);
|
|
145
|
+
}
|
|
146
|
+
return super.set(name, value);
|
|
147
|
+
}
|
|
148
|
+
delete(name) {
|
|
149
|
+
if (!super.delete(name)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
this.walk?.noteDeleted(name);
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
clear() {
|
|
156
|
+
const walk = this.walk;
|
|
157
|
+
if (walk) {
|
|
158
|
+
for (const name of super.keys()) {
|
|
159
|
+
walk.noteDeleted(name);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
super.clear();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The slots at the start of a for-in over the names (`starting`), whose
|
|
166
|
+
* deleted names' slots are then free, or going on to them from an Array's
|
|
167
|
+
* elements, whose start freed them: with the names added since in them.
|
|
168
|
+
*/
|
|
169
|
+
startWalk(starting) {
|
|
170
|
+
let walk = this.walk;
|
|
171
|
+
if (walk === null) {
|
|
172
|
+
walk = new Walk([...super.keys()]);
|
|
173
|
+
this.walk = walk;
|
|
174
|
+
return walk;
|
|
175
|
+
}
|
|
176
|
+
if (starting) {
|
|
177
|
+
walk.freeDeleted();
|
|
178
|
+
}
|
|
179
|
+
walk.place(this);
|
|
180
|
+
return walk;
|
|
181
|
+
}
|
|
182
|
+
}
|