-
-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avm2: Ignore errors when setting properties in amf deserializer
Flash Player *traces* any errors that occur during setting properties on the newly-constructed object durting AMf deserialization, and continues deserializing.
- Loading branch information
Showing
6 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package { | ||
|
||
import flash.display.MovieClip; | ||
|
||
|
||
public class Test extends MovieClip { | ||
|
||
|
||
public function Test() { | ||
} | ||
} | ||
|
||
} | ||
|
||
import flash.utils.ByteArray; | ||
import flash.net.registerClassAlias; | ||
import flash.net.getClassByAlias; | ||
import flash.net.ObjectEncoding; | ||
|
||
|
||
class MyFirstClass { | ||
public var myProp: String; | ||
public var myOtherProp: String; | ||
public var oneGoodProp: String; | ||
public function MyFirstClass(val: String) { | ||
this.myProp = val; | ||
this.myOtherProp = "My other val"; | ||
this.oneGoodProp = "The one good prop"; | ||
} | ||
} | ||
|
||
class MySecondClass { | ||
public function set myOtherProp(newVal: String) { | ||
trace("Called setter with: " + newVal); | ||
throw new Error("Called myOtherProp setter with " + newVal); | ||
} | ||
|
||
public var oneGoodProp:String; | ||
|
||
public function toString(): String { | ||
return "MySecondClass(oneGoodProp = " + this.oneGoodProp + ")"; | ||
} | ||
} | ||
|
||
function doRoundTrip(version: int) { | ||
trace("Roundtrip with AMF version: " + version); | ||
var bytes = new ByteArray(); | ||
bytes.objectEncoding = version; | ||
registerClassAlias("MyClass", MyFirstClass); | ||
bytes.writeObject(new MyFirstClass("My value")); | ||
bytes.position = 0; | ||
registerClassAlias("MyClass", MySecondClass); | ||
trace("Current alias: " + getClassByAlias("MyClass")); | ||
var roundtrip = bytes.readObject(); | ||
trace("Deserialized: " + roundtrip); | ||
} | ||
|
||
// FIXME - Ruffle AMF0 class serialization is broken | ||
//doRoundTrip(ObjectEncoding.AMF0); | ||
trace(); | ||
doRoundTrip(ObjectEncoding.AMF3); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
Roundtrip with AMF version: 3 | ||
Current alias: [class MySecondClass] | ||
Called setter with: My other val | ||
Error: Called myOtherProp setter with My other val | ||
ReferenceError: Error #1056: Cannot create property myProp on Test.as$0.MySecondClass. | ||
Deserialized: MySecondClass(oneGoodProp = The one good prop) |
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 1 |