Conversation
Contributor
|
Could we assert that the Value type is primitive? |
Contributor
|
Thinking more about it, it feels like there may be a possibility that reference indexes may be used for XML Documents and Dates. I feel like that may have to be tested. |
Contributor
|
Contributor
Well, that proves the Date case, XML Document shows this: var payload = new Object();
payload.n_xml = new XML("<root><child id='avm1'>test</child></root>");
payload.n_xml_ref = payload.n_xml;
var nc = new NetConnection();
nc.connect("http://localhost:8000/");
var responder = new Object();
nc.call("test.avm1", responder, payload);Flash output: |
Contributor
|
That said, this isn't correct in Ruffle currently either: running 1 test
2026-07-28T18:52:38.084378Z ERROR ruffle_core::net_connection: Couldn't submit AMF Packet to http://localhost:8000/: FetchError("Could not get metadata for '/localhost': The file or directory could not be found")
test avm1/xml_ref ... FAILED
failures:
---- avm1/xml_ref ----
assertion failed: `(ruffle_actual == flash_expected)`
Diff < left / right > :
Navigator::fetch:
URL: http://localhost:8000/
Method: POST
Mime-Type: application/x-amf
< Body: [00, 00, 00, 00, 00, 01, 00, 09, 74, 65, 73, 74, 2E, 61, 76, 6D, 31, 00, 02, 2F, 31, 00, 00, 00, 79, 0A, 00, 00, 00, 01, 03, 00, 05, 6E, 5F, 78, 6D, 6C, 0F, 00, 00, 00, 2A, 3C, 72, 6F, 6F, 74, 3E, 3C, 63, 68, 69, 6C, 64, 20, 69, 64, 3D, 22, 61, 76, 6D, 31, 22, 3E, 74, 65, 73, 74, 3C, 2F, 63, 68, 69, 6C, 64, 3E, 3C, 2F, 72, 6F, 6F, 74, 3E, 00, 09, 6E, 5F, 78, 6D, 6C, 5F, 72, 65, 66, 0F, 00, 00, 00, 2A, 3C, 72, 6F, 6F, 74, 3E, 3C, 63, 68, 69, 6C, 64, 20, 69, 64, 3D, 22, 61, 76, 6D, 31, 22, 3E, 74, 65, 73, 74, 3C, 2F, 63, 68, 69, 6C, 64, 3E, 3C, 2F, 72, 6F, 6F, 74, 3E, 00, 00, 09]
> Body: [00, 00, 00, 00, 00, 01, 00, 09, 74, 65, 73, 74, 2E, 61, 76, 6D, 31, 00, 02, 2F, 31, 00, 00, 00, 4D, 0A, 00, 00, 00, 01, 03, 00, 05, 6E, 5F, 78, 6D, 6C, 0F, 00, 00, 00, 2A, 3C, 72, 6F, 6F, 74, 3E, 3C, 63, 68, 69, 6C, 64, 20, 69, 64, 3D, 22, 61, 76, 6D, 31, 22, 3E, 74, 65, 73, 74, 3C, 2F, 63, 68, 69, 6C, 64, 3E, 3C, 2F, 72, 6F, 6F, 74, 3E, 00, 09, 6E, 5F, 78, 6D, 6C, 5F, 72, 65, 66, 07, 00, 02, 00, 00, 09]
failures:
avm1/xml_ref
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.20s
error: test failed, to rerun pass `--test tests`var payload = new Object();
payload.n_xml = new XML("<root><child id='avm1'>test</child></root>");
payload.n_xml_ref = payload.n_xml;
var nc = new NetConnection();
nc.connect("http://localhost:8000/");
var responder = new Object();
nc.call("test.avm1", responder, payload); |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When writing primitive values, we currently increment the reference value for some primitive types. We shouldn't do that. Lets also support
CacheKeys forXMLandDatekinds as well as they can be referenced. As long asadd_elementis only used for adding primitives this is correct, it would be ideal to enforce this somehow but I don't see a way to handle that while also not duplicating the logic ofdate()andxml()for each writer.Also added tests for the
XMLandDatecases.Lets check if the
Valuekind inadd_elementis something that should be reference-able instead.Checklist
Closes AMF0 obj_writer increments its reference index for every property #115, In AMF0, XML objects should reference the cache #124, AMF0 Reference generation seems broken #72