David Wendt
568d90f4dc
Warn if XML.removeNode fails for whatever reason
2020-01-04 19:00:32 -05:00
David Wendt
1577f51730
Expose elided objects as pointers when debugging XML nodes
2020-01-04 19:00:32 -05:00
David Wendt
19ca11b08c
Impl `toString`
2020-01-04 19:00:31 -05:00
David Wendt
513460e4e0
Implement `insertBefore`
2020-01-04 19:00:31 -05:00
David Wendt
b0dce445b0
Impl `removeNode`
2020-01-04 19:00:29 -05:00
David Wendt
00319f14a8
Implement `namespaceURI`
2020-01-04 19:00:29 -05:00
David Wendt
73da72db98
Add a test for `appendChild`.
2020-01-04 19:00:28 -05:00
David Wendt
7c95eff048
Flag an error if we accidentally introduce a second script object by accident.
2020-01-04 19:00:28 -05:00
David Wendt
abb2690367
When constructing new XML nodes or documents, always ensure that the new node we swap in is properly linked to the same script object so that we don't accidentally recreate them.
2020-01-04 19:00:28 -05:00
David Wendt
8939dae90c
Implement `XMLNode.attributes` w/ read tests
2020-01-04 19:00:27 -05:00
David Wendt
6f48f3436f
Expose `previousSibling` and `nextSibling` to ActionScript.
...
This commit also fixes a bug caused by excessive use of copypaste, which was detected by the included test.
2020-01-04 19:00:25 -05:00
David Wendt
223320c98c
Expose `parentNode` to ActionScript
2020-01-04 19:00:24 -05:00
David Wendt
807725d7aa
Expose `firstChild` and `lastChild` to ActionScript w/ tests
2020-01-04 19:00:24 -05:00
David Wendt
1d1e493e0e
Refactor the child adoption process to ensure the child also adopts it's siblings.
2020-01-04 19:00:23 -05:00
David Wendt
48d68bebc4
Implement `hasChildNodes()` and add test
2020-01-04 19:00:23 -05:00
David Wendt
c58e866236
Add test for `cloneNode`
2020-01-04 19:00:22 -05:00
David Wendt
881dcb76ab
`cloneNode` without arguments is morally equivalent to `false`
2020-01-04 19:00:21 -05:00
David Wendt
8e33566d07
Add namespacing test
2020-01-04 19:00:21 -05:00
David Wendt
69a1ab1649
Expose namespace prefix and URI lookups to ActionScript.
...
Also, fix the previous commit's half-assed impl.
2020-01-04 19:00:20 -05:00
David Wendt
fe7d2b5173
Extremely WIP impl of `lookup_uri_for_namespace`
2020-01-04 19:00:20 -05:00
David Wendt
55fa6ef09b
Add node cloning support
2020-01-04 19:00:19 -05:00
David Wendt
37f6efb753
Expose `appendChild` to ActionScript
2020-01-04 19:00:19 -05:00
David Wendt
08c0f273a6
Add sibling links to nodes.
2020-01-04 19:00:18 -05:00
David Wendt
7e45dee8cf
Clippy said so.
2020-01-04 19:00:18 -05:00
David Wendt
eec449422b
`XMLDocument.roots` is not necessary since you can just get the children of it's node form anyway...
2020-01-04 19:00:18 -05:00
David Wendt
f8f569440f
Add very basic XML test
2020-01-04 19:00:17 -05:00
David Wendt
cfacd397cf
Most XML properties return `null`, not `undefined`.
...
Furthermore, `prefix` does not distinguish between `<test>` and `<:test>` - they both have a `prefix` of `""`.
2020-01-04 19:00:17 -05:00
David Wendt
b491dd034e
Don't overflow stack when debug-printing an entire document, either.
2020-01-04 19:00:16 -05:00
David Wendt
e47a1d1e38
Fix newly constructed XML trees not actually containing the XML they just parsed.
2020-01-04 19:00:16 -05:00
David Wendt
960e4dad90
Don't cause stack overflow when debug-printing XML nodes.
2020-01-04 19:00:16 -05:00
David Wendt
bec60acc1e
`XML.prototype` should be an `XMLObject` so that instances of `XML` can hold a node
2020-01-04 19:00:15 -05:00
David Wendt
d058c83ac0
Document roots should accept children.
2020-01-04 19:00:15 -05:00
David Wendt
571c4bbd52
Cargo fmt compliance
2020-01-04 19:00:15 -05:00
David Wendt
0af248d81f
Expose `childNodes` to ActionScript
2020-01-04 19:00:14 -05:00
David Wendt
e7768d0802
Add methods to allow storing XML objects on the accompanying tree nodes, so that expando properties on child nodes will work.
2020-01-04 19:00:13 -05:00
David Wendt
b06dd5d15e
Add a special node to represent the document root in the node tree, and get rid of the explicit document reference type in `XMLObject`.
2020-01-04 19:00:12 -05:00
David Wendt
0fe0e4fe90
Separate `XMLName` into another module
2020-01-04 19:00:11 -05:00
David Wendt
3928c7cc51
Reject empty text nodes
2020-01-04 19:00:11 -05:00
David Wendt
7a9a16e598
Don't repeat yourself.
2020-01-04 19:00:11 -05:00
David Wendt
bd1ea56cc3
Implement `XMLNode` properties that don't require child or attribute iteration.
2020-01-04 19:00:10 -05:00
David Wendt
e2eb3d0bde
Add a test of XMLDocument::from_str.
...
This test technically works, but the results were slightly surprising. If it turns out Flash works differently from `quick_xml`, we'll change this test to match Flash.
2020-01-04 19:00:10 -05:00
David Wendt
6ae5ae3038
Add Comment parsing support
2020-01-04 19:00:10 -05:00
David Wendt
4f5ac09b73
Expose XML document constructor, including text parsing ability
2020-01-04 19:00:09 -05:00
David Wendt
554f0dc1e5
Add XMLNode class and constructor impl
2020-01-04 19:00:07 -05:00
David Wendt
6a65e984ae
Add a new `XMLObject` variant to the AVM1 object ecosystem.
...
This particular variant is actually a two-in-one deal: `XMLObject`s may either refer to a document or a node.
2020-01-04 18:58:42 -05:00
David Wendt
89c9753520
Add rudimentary custom DOM impl on top of `quick_xml`.
...
`quick_xml` was chosen due to it's high performance and support for zero-copy use cases. However, we are not using `minidom`, which is the already-extant DOM impl that uses `quick_xml` as it's parsing provider. This is because `minidom` nodes are not amenable to garbage collection.
Specifically: we want to be able to construct a new `Object` variant that holds part of an XML node. However, `minidom::Element` directly owns it's children, meaning that we can't hold references to it from within `Object` while also keeping those objects to the `'gc` lifetime. Hence, we provide a GC-exclusive DOM implementation.
I ruled out solutions such as holding an entire XML tree in an `Rc` and having AVM objects that shadow them. This works for `SwfSlice` because indexing an array is cheap; but traversing a tree can get very expensive. XML is used in many places in Flash Player, so it's important that we treat it like a first-class citizen.
2020-01-04 18:48:17 -05:00
Mike Welsh
4ce67535b0
tests: Add test for Color
2020-01-03 20:31:32 -08:00
Mike Welsh
36b3e5b34f
avm1: Implement Color class
2020-01-03 20:31:32 -08:00
Mike Welsh
4bf29f677f
avm1: Implement Sound.duration
...
Add AudioBackend::get_sound_duration.
2020-01-03 17:11:00 -08:00
Mike Welsh
b9d24d9a49
avm1: First pass at implementing Sound.stop
2020-01-03 17:11:00 -08:00