Commit Graph

547 Commits

Author SHA1 Message Date
Mike Welsh d736293425 avm1: Fix method calls with null/empty string name
`f[null]` should call `f["null"]`.
`f[undefined]`, `f[""]`, `f[o]` where o.toString returns the empty
string should call `f` directly.
2020-12-30 13:35:36 -08:00
CUB3D 5fb15c8f80 core: Support CallMethod with non-string method_name (fix #2160) 2020-12-30 13:35:36 -08:00
paq 4f980becb2 avm1: Implement escape 2020-12-30 12:42:03 -08:00
Callum Thomson 7b202bd2e7
avm1: Implement flash.filters.ColorMatrixFilter avm1 built-in 2020-12-29 03:10:46 -08:00
paq 8c86434e38 avm1: Implement Matrix.deltaTransformPoint 2020-12-28 01:17:00 -08:00
paq 8baa36e801 avm2: Implement isFinite 2020-12-27 23:02:39 -08:00
paq ce2d7efac3 avm2: Implement isNaN 2020-12-27 23:02:39 -08:00
paq 7bfe3f7177 avm1: Implement Matrix.transformPoint (ruffle-rs#303) 2020-12-27 14:27:04 -08:00
Sam Morrow 38bdb8b39a web/desktop: Add basic dialog handling (closes #1978) 2020-12-23 19:08:18 -08:00
Callum Thomson e38d559b1e
avm1: Implement flash.filters.DropShadowFilter
Implements the AVM object for DropShadowFilter. Actual rendering is still TODO.
2020-12-22 14:17:12 -08:00
David Wendt 19219ad0c1 avm2: Implement `dispatchEvent`.
Event dispatch is a surprisingly complicated procedure, so this makes sure to test:

1. Event dispatch on bare dispatchers
2. Event dispatch on hierarchial dispatchers (movieclips)
3. Event cancellation (which is reported by `dispatchEvent`)
4. The implicit `this` on unbound event handlers. I'm not yet sure if this is a special property of event dispatch or if all unbound functions inherit their global scope as `this`.
5. The execution order of handlers on both bare and hierarchial dispatchers
6. Delegation to hierarchial dispatchers
7. Modification of the dispatch list during dispatch of an event. Surprisingly enough, you can add handlers to the event you're handling and expect them to execute, *if* you added them to a further object in the order *or* you added a bubble handler in the capture phase.
2020-12-21 21:47:29 -08:00
David Wendt 87ff679898 avm2: Implement `EventDispatcher.willTrigger` 2020-12-21 21:47:29 -08:00
David Wendt be4e37a55c avm2: Implement `addEventListener`, `removeEventListener`, and `hasEventListener`. 2020-12-21 21:47:29 -08:00
Callum Thomson 69ab12fcc3
avm1: Add flash.filters.GlowFilter 2020-12-20 15:31:09 -08:00
Mike Welsh 9d6e711006 tests: Add test for #2030 2020-12-19 02:14:27 -08:00
Mike Welsh 981a4de9c9 tests: Uncomment arguments.caller avm1 test 2020-12-19 01:46:20 -08:00
Mike Welsh a3f18b80b6 tests: Add test for TextField.replaceSel 2020-12-19 00:35:26 -08:00
Mike Welsh 042e9a444b tests: Add parseFloat tests 2020-12-18 02:50:09 -08:00
Mike Welsh 72a24b9800 tests: Add tests for #1906 2020-12-17 18:07:01 -08:00
David Wendt 09f9e99fbb avm2: Implement `rest` parameters in function calls. 2020-12-17 13:21:44 -08:00
David Wendt 453e013c2c avm2: Implement `arguments`. 2020-12-17 13:21:44 -08:00
David Wendt 217890f4a6 avm2: Implement `Function.apply` 2020-12-17 13:21:44 -08:00
CUB3D 23a9c7143a core: Support failiable constructors 2020-12-15 00:04:51 -08:00
CUB3D b3dd5c0c0b core+renderer: Fix corner cases 2020-12-15 00:04:51 -08:00
CUB3D 74ab728cff core: Format 2020-12-15 00:04:51 -08:00
CUB3D 22a7b1d340 core: Add handling of invalid arguments for getColorBoundsRect/colorTransform 2020-12-15 00:04:51 -08:00
CUB3D 353d5a268b core: Add better handling of invalid arguments to BitmapData 2020-12-15 00:04:51 -08:00
CUB3D 9d46d67588 core+web+renderer: Add load/attach Bitmap and handling for invalid args with BitmapData 2020-12-15 00:04:51 -08:00
CUB3D 3c12fa6ee5 core: Implement BitmapData.floodFill and correct getPixel for invalid coordinates 2020-12-15 00:04:51 -08:00
CUB3D 3afd20063f core: Implement get/set pixel(32) functions 2020-12-15 00:04:51 -08:00
CUB3D e45e942a1f core: Start implementation for flash.display.BitmapData 2020-12-15 00:04:51 -08:00
David Wendt 8a787e6153 avm2: Implement `Event.toString` (which matches it's valueof behavior) 2020-12-14 16:46:33 -08:00
David Wendt d393a5f4f8 avm2: Implement `Event.preventDefault` and `Event.isDefaultPrevented` 2020-12-14 16:46:33 -08:00
David Wendt 8b9a804ae9 avm2: Implement `Event.formatToString`. 2020-12-14 16:46:33 -08:00
David Wendt 584c6c8b11 avm2: Implement `Event.clone` 2020-12-14 16:46:33 -08:00
David Wendt 90da20579c avm2: Implement `Event.bubbles`, `cancelable`, and `type`. 2020-12-14 16:46:33 -08:00
David Wendt 58f4470dc5 avm2: Add `Event` class, object type, and native representation 2020-12-14 16:46:33 -08:00
jmckiern cfd003de7a avm1: Implement TextField.backgroundColor 2020-12-14 12:45:45 -08:00
jmckiern 61e3214d0a avm1: Implement TextField.borderColor 2020-12-14 12:45:45 -08:00
Zeh Fernando 8e9de8e16b core: Implement MovieClip._lockroot in avm1
This also enables the (previously ignored) _lockroot tests.
2020-12-13 15:34:42 -08:00
David Wendt afd033898c avm2: Implement `hitTestObject` 2020-12-09 14:00:06 -08:00
David Wendt d9172780c5 avm2: Implement `hitTestPoint`. 2020-12-09 14:00:06 -08:00
David Wendt 06ba2f898a avm2: Implement `visible`. 2020-12-09 14:00:06 -08:00
David Wendt d489aca377 avm2: Expose `DisplayObject.root` 2020-12-09 14:00:06 -08:00
David Wendt 1b2a4708d6 avm2: Implement `DisplayObject.parent`. 2020-12-09 14:00:06 -08:00
David Wendt 852f26bdeb tests: Fix name test breaking with our half-working execution order 2020-12-09 14:00:06 -08:00
David Wendt c053f2c87c avm2: Expose DisplayObject `name` property 2020-12-09 14:00:06 -08:00
David Wendt 19f9e99954 avm2: Expose and test `rotation`. 2020-12-09 14:00:06 -08:00
David Wendt 29f96e76ab tests: Activate alpha test (since it seems to work fine) 2020-12-09 14:00:06 -08:00
David Wendt 200581e1e3 avm2: Expose `x` and `y` properties. 2020-12-09 14:00:06 -08:00
David Wendt 4784dc3c03 tests: Add more stringent height/width test that we're only accurate to within 1 twip. 2020-12-09 14:00:06 -08:00
David Wendt 69db45131b tests: Add inactive tests for `alpha`, `height`, `rotation`, `width`, `x`, and `y`. 2020-12-09 14:00:06 -08:00
jmckiern 3cab11d18e avm1: Implement TextField.textColor (close #1863) 2020-12-07 15:09:36 -08:00
Zeh Fernando c018ac065c tests: Add test for MovieClip._lockroot in avm1 2020-12-02 11:59:01 -08:00
David Wendt 9dde91e0fd core: Store named children on AVM2 movieclips as object properties 2020-11-27 13:23:34 -08:00
David Wendt 86e1037940 avm2: Implement `stopAllMovieClips` 2020-11-27 13:23:34 -08:00
David Wendt cad2c4ecee tests: Add a button child execution order test. 2020-11-27 13:23:34 -08:00
David Wendt e2e598edde avm2: Implement `swapChildren` and `swapChildrenAt`. 2020-11-27 13:23:34 -08:00
David Wendt 71cdbd7194 avm2: Implement `setChildIndex` 2020-11-27 13:23:34 -08:00
David Wendt cf0ab2d82f avm2: Implement `removeChildren`.
This also changes the underlying `DisplayObjectContainer` method to accept any type of range. Turns out enum trait objects aren't actually trait objects and don't need to worry about object safety!
2020-11-27 13:23:34 -08:00
David Wendt 38fd29ae5f avm2: Implement `removeChildAt` 2020-11-27 13:23:34 -08:00
David Wendt 759a590d76 avm2: Implement `getChildIndex` 2020-11-27 13:23:34 -08:00
David Wendt 2454287342 tests: Enable the `removeChild` test that tests timeline manipulation. 2020-11-27 13:23:34 -08:00
David Wendt 85fa8f327d avm2: Impl `contains` w/ test 2020-11-27 13:23:34 -08:00
David Wendt bcef9ef415 tests: Add a whole number of tests of depth/render list interaction from the AS3 side 2020-11-27 13:23:34 -08:00
David Wendt a5f09d3c09 avm2: Implement `removeChild`. 2020-11-27 13:23:34 -08:00
David Wendt a5ea9795f6 avm2: Implement `addChild` and `addChildAt`, with tests 2020-11-27 13:23:34 -08:00
David Wendt f748576927 avm2: Implement `getChildByName` 2020-11-27 13:23:34 -08:00
David Wendt d04f131cfe avm2: Implement `DisplayObjectContainer.getChildAt`.
This test doesn't work yet because it needs `avm2-domainscope` to get merged in.
2020-11-27 13:23:34 -08:00
Nathan Adams d8728bbf25 avm1: Made firstChild and lastChild ignore non-node children 2020-11-26 11:18:00 -08:00
Mike Welsh d9ac9fa076 avm1: Array.reverse should return itself 2020-11-22 13:50:49 -08:00
Mike Welsh 7ac53be24f avm1: Implement TextField.removeTextField 2020-11-22 01:55:46 -08:00
Mike Welsh a61d2b54ae avm1: Implement TextField.type 2020-11-21 16:58:19 -08:00
Mike Welsh 8d78ee5172 avm1: Use f64 when calculating scale/rotation (fix #1622) 2020-11-21 11:39:41 -08:00
Mike Welsh d3265bfd60 avm1: Add allow_empty param to Activation:resolve_target_display_object
In some cases, the empty string path "" should resolve to the
starting clip. In other cases, it should be considered invalid.

Add a parameter to control this behavior, and set this to false
for MovieClip::hit_test to prevent `clip.hitTest("")` from
returning true.
2020-11-18 17:58:42 -08:00
Mike Welsh 4c01022a38 avm1: Allow string paths in hitTest (fix #1559) 2020-11-18 17:58:42 -08:00
Mike Welsh 48ee47d88a tests: Add test for AVM2 Math
Also allow specifying relative epsilon for swf_tests_approx.
2020-11-12 04:24:47 -08:00
Mike Welsh b927acb2c2 avm2: trace accepts multiple arguments 2020-11-10 17:05:56 -08:00
Mike Welsh 2e73eba6c9 tests: Add test for unload clip event 2020-11-09 17:26:19 -08:00
Mike Welsh fe6ff77889 tests: Add test for initialize clip event 2020-11-09 10:43:18 -08:00
Mike Welsh 4fe5fc44a6 tests: Bump script timeout to 200 secs 2020-11-03 16:02:53 -08:00
Nathan Adams 8f064eea6e core: Strip newlines when loading editboxes that contain them and are marked singleline. This appears to be the correct behaviour - they're never stripped anywhere else but on load 2020-11-02 11:43:10 -08:00
Nathan Adams cefa42fae0 tests: Add an avm1 test for Selection 2020-11-02 11:43:10 -08:00
Mike Welsh 93e7f657f1 tests: Update Array.concat test to print out entire array 2020-10-31 02:42:34 -07:00
Mike Welsh e55346a211 tests: Test for removed clip after a function call 2020-10-24 17:36:38 -07:00
Mike Welsh 8da1eeafcb tests: Add test for this in GetVariable action 2020-10-22 17:23:22 -07:00
Mike Welsh e093f05656 tests: Add case insensitivity test for attachMovie 2020-10-21 17:09:31 -07:00
David Wendt 6f659db342 tests: Fix the lazyinit test so that it actually passes on Ruffle 2020-10-17 03:32:09 -07:00
David Wendt a484861f79 tests: Add a test for lazy initialization load order. 2020-10-17 03:32:09 -07:00
Mike Welsh 97a3ef73a3 tests: Add tests for issue #893 2020-10-15 00:10:55 -07:00
Nathan Adams 4abd02e2f7 core: Implement a timeout for script execution, defaulting to 15 seconds. Fixes #554 2020-10-11 13:34:15 -07:00
David Wendt 4c44ca8e77 avm2: Non-integer numbers should be handled as strings and integer-parsible strings should be handled as numbers. 2020-10-06 06:03:22 -07:00
David Wendt 896a5b37a5 avm2: Implement `new MovieClip()`. 2020-10-06 06:03:22 -07:00
David Wendt 50dd9a6733 avm2: Implement the programmatically-playing flag that governs `isPlaying` behavior. 2020-10-06 06:03:22 -07:00
David Wendt 035c841eb5 tests: Add tests for `gotoAndStop` and rename the `gotoAndPlay` one 2020-10-06 06:03:22 -07:00
David Wendt 1f29497b8c tests: Add test for AS3 movieclip play 2020-10-06 06:03:22 -07:00
David Wendt 8152400a39 avm2: Implement `MovieClip.scenes`. 2020-10-06 06:03:22 -07:00
David Wendt c682868205 avm2: Implement `MovieClip.currentScene` 2020-10-06 06:03:22 -07:00
David Wendt 8a13d5fe10 avm2: Implement `Scene` object. 2020-10-06 06:03:22 -07:00
David Wendt de186ed5f3 avm2: Implement `MovieClip.currentLabels` 2020-10-06 06:03:22 -07:00
David Wendt 77a86aef9b avm2: Implement `FrameLabel`. 2020-10-06 06:03:22 -07:00
David Wendt 86b07c0007 tests: Add tests for `prevScene` and `nextScene`. 2020-10-06 06:03:22 -07:00
David Wendt 6d0befad97 avm2: Implement `prevFrame` and `nextFrame`, with tests. 2020-10-06 06:03:22 -07:00
David Wendt 97048fb8bd avm2: Implement `stop` and `play`, with tests for the former. 2020-10-06 06:03:22 -07:00
David Wendt 556c951b1c avm2: Implement `gotoAndPlay`/`gotoAndStop`, with test. 2020-10-06 06:03:22 -07:00
David Wendt 5b83f6b4cc avm2: Add test for movieclip-specific properties. 2020-10-06 06:03:22 -07:00
David Wendt 55fec14a1c tests: Add tests for timeline scripts. 2020-10-06 06:03:22 -07:00
CUB3D 110b9ec551 core: Fix edge cases and implement rest of bevel filter 2020-09-29 11:06:56 -07:00
CUB3D 2c3ee4d94b core: Add flash.filters.BevelFilter 2020-09-29 11:06:56 -07:00
Mike Welsh 98d2651e62 tests: Add tests for Array single-param ctor 2020-09-26 14:13:06 -07:00
David Wendt f6f084098e tests: Add a test for floating point errors in the AVM1 representation of `_xscale`, `_yscale`, and `_rotation`. 2020-09-26 14:12:49 -07:00
Nathan Adams 4a83641a6c core: Support \r newlines in texts - fixes #1071, #808 2020-09-19 16:18:35 -07:00
Luca Weiss d5cb396331 *: fix spelling mistakes 2020-09-19 16:17:58 -07:00
Mike Welsh 6f2655cf95 tests: Add test for SWF4 string ops 2020-09-17 16:03:51 -07:00
Mike Welsh 4593320d36 tests: Add more tests to hittest_shapeflag test 2020-09-15 02:34:32 -07:00
Mike Welsh 0d111ca92f avm1: _target of root should be /
Also, levels other than 0 should be appened in slash syntax, e.g
_level1/clip
2020-09-15 02:20:24 -07:00
David Wendt de0bc93839 Fix `hasOwnProperty` yielding false on populated non-hole array indicies. 2020-09-15 02:20:11 -07:00
David Wendt 07e14463e2 avm2: Array `join` and `toString` treat `undefined` and `null` as empty strings. 2020-09-15 02:20:11 -07:00
David Wendt 3b7922d222 avm2: Implement `Array.sortOn` 2020-09-15 02:20:11 -07:00
David Wendt 0aa2c50118 avm2: Implement `Array.sort` 2020-09-15 02:20:11 -07:00
David Wendt ca4982029b avm2: Impl `Array.toLocaleString`. 2020-09-15 02:20:11 -07:00
David Wendt dbaef812fa avm2: Impl `Array.splice`. 2020-09-15 02:20:11 -07:00
David Wendt 53b564bb52 avm2: Implement `Array.slice`. 2020-09-15 02:20:11 -07:00
David Wendt 685fbc12e0 tests: `Array.reverse`'s test should also include a check for holes. 2020-09-15 02:20:11 -07:00
David Wendt 036f7cbb90 avm2: Implement `Array.shift` and `Array.unshift`.
This also updates `Array.push` to support it's ability to push multiple arguments at once.
2020-09-15 02:20:11 -07:00
David Wendt 879aff3669 avm2: Implement `Array.reverse` 2020-09-15 02:20:11 -07:00
David Wendt 1ce78388a3 avm2: Implement `Array.push` and `Array.pop` 2020-09-15 02:20:11 -07:00
David Wendt 0ece924877 avm2: Implement `indexOf` and `lastIndexOf` 2020-09-15 02:20:11 -07:00
David Wendt 832bbdd711 avm2: Implement `forEach`, `map`, `filter`, `every`, and `some` on `Array`.
This also comes with some refactoring: building the resulting array object and resolving holes is now done in helper methods.
2020-09-15 02:20:11 -07:00
David Wendt 0eeee72be6 avm2: Implement `Array.join`, `Array.toString`, and `Array.valueOf` (w/tests) 2020-09-15 02:20:11 -07:00
David Wendt 79df789028 tests: Add test for `Array.concat`. 2020-09-15 02:20:11 -07:00
David Wendt 75e6018607 tests: Add test for `newarray`. 2020-09-15 02:20:11 -07:00
David Wendt 27793092c2 tests: Add `array_holes` test. 2020-09-15 02:20:11 -07:00
David Wendt 3d37fda1ef tests: Add tests for `deleteproperty` on arrays. 2020-09-15 02:20:11 -07:00
David Wendt 1a8f041b77 tests: Add `array_storage` test. 2020-09-15 02:20:11 -07:00
David Wendt 34ba1643dd tests: Add test for reading properties of an array 2020-09-15 02:20:11 -07:00
David Wendt 1d3f5d80be tests: Add test for `new Array`'s arguments. 2020-09-15 02:20:11 -07:00
Nathan Adams 319efabb47 tests: Make tests capture trace output through new backend 2020-09-13 13:51:39 -07:00
Nathan Adams e25e03a841 core: Log to new avm_trace method where we want things to show up 2020-09-13 13:51:39 -07:00
Nathan Adams de009c7673 core: Add Log backend, for capturing trace output specific to a movie 2020-09-13 13:51:39 -07:00
CUB3D efa7e862fd core: Propagate this through scope and get_variable 2020-09-07 13:14:48 -07:00
CUB3D 91d5e0f74b core: Update tests 2020-09-07 13:14:48 -07:00
CUB3D 136a5664b0 core: Pass the correct this for CallFunction when in a with scope
fixes #805, #945, #1018
2020-09-07 13:14:48 -07:00
David Wendt 3b5411547a avm2: Implement `in` 2020-09-07 11:07:07 -07:00
Mike Welsh 64679e8796 avm1: typeof button/text should be object (fix #1110) 2020-09-04 11:33:40 -07:00
Nathan Adams b2dc564628 avm1: Fix String.lastIndexOf(undefined) 2020-09-04 11:32:16 -07:00
Nathan Adams ea7a9758c4 avm1: Fix String.indexOf(undefined) 2020-09-04 11:32:16 -07:00
Mike Welsh 3a813f1f15 tests: Test for #1104 2020-09-03 19:09:48 -07:00
Nathan Adams b5531a48d0 web: Allow reentrant ExternalInterface callbacks 2020-09-03 18:17:44 -07:00
Nathan Adams a49e8d8587 web: Implement two-way communication with ExternalInterface 2020-09-03 18:17:44 -07:00