From cb23067382b9fd42aecdcf7f19c435cbbb4ad1f2 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 27 Jul 2023 01:08:45 +0200 Subject: [PATCH] avm2: Implement UninitializedError --- core/src/avm2/globals/UninitializedError.as | 12 +++++++++ core/src/avm2/globals/globals.as | 1 + .../MultipleCatchBlocksEval/test.toml | 1 - .../MultipleCatchBlocksRange/test.toml | 1 - .../test.toml | 1 - .../test.toml | 1 - .../test.toml | 1 - .../MultipleCatchBlocksWithSyntax/test.toml | 1 - .../test.toml | 1 - .../test.toml | 1 - .../test.toml | 1 - .../test.toml | 1 - .../MultipleCatchBlocksWithVerify1/test.toml | 1 - .../test.toml | 1 - .../tests/swfs/avm2/static_length/output.txt | 1 + .../avm2/static_length/output_original.txt | 23 ------------------ tests/tests/swfs/avm2/static_length/test.as | 6 +---- tests/tests/swfs/avm2/static_length/test.swf | Bin 1197 -> 1234 bytes 18 files changed, 15 insertions(+), 40 deletions(-) create mode 100644 core/src/avm2/globals/UninitializedError.as delete mode 100644 tests/tests/swfs/avm2/static_length/output_original.txt diff --git a/core/src/avm2/globals/UninitializedError.as b/core/src/avm2/globals/UninitializedError.as new file mode 100644 index 000000000..675f6a2d5 --- /dev/null +++ b/core/src/avm2/globals/UninitializedError.as @@ -0,0 +1,12 @@ +package { + public dynamic class UninitializedError extends Error { + UninitializedError.prototype.name = "UninitializedError"; + + public function UninitializedError(message:String = "", code:* = 0) { + super(message, code); + this.name = prototype.name; + } + + public static const length:int = 1; + } +} diff --git a/core/src/avm2/globals/globals.as b/core/src/avm2/globals/globals.as index 4c8fbea85..050afca2e 100644 --- a/core/src/avm2/globals/globals.as +++ b/core/src/avm2/globals/globals.as @@ -15,6 +15,7 @@ include "ReferenceError.as" include "RegExp.as" include "SecurityError.as" include "SyntaxError.as" +include "UninitializedError.as" include "URIError.as" include "VerifyError.as" diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksEval/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksEval/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksEval/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksEval/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksRange/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksRange/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksRange/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksRange/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithArgErrorCaughtByError/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithArgErrorCaughtByError/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithArgErrorCaughtByError/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithArgErrorCaughtByError/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithEvalErrorCaughtByError/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithEvalErrorCaughtByError/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithEvalErrorCaughtByError/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithEvalErrorCaughtByError/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithRangeErrorCaughtByError/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithRangeErrorCaughtByError/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithRangeErrorCaughtByError/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithRangeErrorCaughtByError/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntax/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntax/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntax/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntax/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntaxErrorCaughtByError/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntaxErrorCaughtByError/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntaxErrorCaughtByError/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithSyntaxErrorCaughtByError/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithURICaughtByError/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithURICaughtByError/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithURICaughtByError/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithURICaughtByError/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUninitialized1/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUninitialized1/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUninitialized1/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUninitialized1/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUnitializedCaughtWithError/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUnitializedCaughtWithError/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUnitializedCaughtWithError/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithUnitializedCaughtWithError/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerify1/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerify1/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerify1/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerify1/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerifyCaughtByError/test.toml b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerifyCaughtByError/test.toml index 29f3cef79..cf6123969 100644 --- a/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerifyCaughtByError/test.toml +++ b/tests/tests/swfs/avm2/from_avmplus/as3/Statements/Exceptions/MultipleCatchBlocksWithVerifyCaughtByError/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true diff --git a/tests/tests/swfs/avm2/static_length/output.txt b/tests/tests/swfs/avm2/static_length/output.txt index 6f8a61c4b..fa977f69c 100644 --- a/tests/tests/swfs/avm2/static_length/output.txt +++ b/tests/tests/swfs/avm2/static_length/output.txt @@ -21,3 +21,4 @@ Array.length is: 1 uint.length is: 1 Date.length is: 7 Error.length is: 1 +UninitializedError.length is: 1 diff --git a/tests/tests/swfs/avm2/static_length/output_original.txt b/tests/tests/swfs/avm2/static_length/output_original.txt deleted file mode 100644 index 5c8981594..000000000 --- a/tests/tests/swfs/avm2/static_length/output_original.txt +++ /dev/null @@ -1,23 +0,0 @@ -RegExp.length is: 1 -String.length is: 1 -XMLList.length is: 1 -Namespace.length is: 2 -ReferenceError.length is: 1 -DefinitionError.length is: 1 -ArgumentError.length is: 1 -SyntaxError.length is: 1 -VerifyError.length is: 1 -SecurityError.length is: 1 -EvalError.length is: 1 -Number.length is: 1 -RangeError.length is: 1 -Boolean.length is: 1 -XML.length is: 1 -Function.length is: 1 -TypeError.length is: 1 -URIError.length is: 1 -Array.length is: 1 -uint.length is: 1 -Date.length is: 7 -Error.length is: 1 -UninitializedError.length is: 1 diff --git a/tests/tests/swfs/avm2/static_length/test.as b/tests/tests/swfs/avm2/static_length/test.as index 444804880..655c2487e 100644 --- a/tests/tests/swfs/avm2/static_length/test.as +++ b/tests/tests/swfs/avm2/static_length/test.as @@ -31,9 +31,5 @@ trace("Array.length is: " + Array.length); trace("uint.length is: " + uint.length); trace("Date.length is: " + Date.length); trace("Error.length is: " + Error.length); -// Once the class UninitializedError has been implemented, please: -// - Implement UninitializedError.length . -// - Replace the file "output.txt" with "output_original.txt". -// - Comment in the line below. -//trace("UninitializedError.length is: " + UninitializedError.length); +trace("UninitializedError.length is: " + UninitializedError.length); diff --git a/tests/tests/swfs/avm2/static_length/test.swf b/tests/tests/swfs/avm2/static_length/test.swf index 3be966d3a09e6059179c603431f0c001c3af10a5..e3ce7f7965aac355772ee5729c69f41074459d4f 100644 GIT binary patch literal 1234 zcmV;@1TFhRS5qeV2mkFNz&$iYkJLIpe$@IO<|X&ZP>DDp=jAf z4TaSzqsVn;60@#t`O>t!An}HH|5n<8vYKhakj%5QGI$Xr+pRAbgeiQxt?9tH&Bgt%K6}sixZvXzi{K9LH=_tHa^2 zGTf{fR=>KjwY62P)vNV-85CvvLU-izvTom5Z~6&Z)K)CjbW}qxc?snc!*zDo*RQko zlyOqiwKP9vPpMLko>JYhs~eRKNYqmr%&<;nrzxAJrYf?Ru6ka!2Zr);D4)?X(`0+F zQ@s&-9!GUF+T1f`Wk5>@8a*%V-PnEcNa1OFH~nm0kCK6-BKvN?U%q2f=lM+cL{sen zwfKA526Kk81uryQz32DTH{J+6n_^MfG5*)YWu8To^}Z|jX_M;Rwn$G*PXLuPm6v(tLVc3@VOu158~ zGuYntL>1YNc>h)J7W0dt(o=0ylP^MT(^4H8dUo;!Rh-2B8Prt^Lb3x@Va<=U)T4IH z<6s#{Q-``kEm?8YGdd#qsrX|9N?nCP1RYS(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