-
-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avm2: Run DoAbc/DoAbc2/SymbolClass as part of their frame
We previously ran these tags during preloading - however, they are actually run as part of frame execution. This is observable by ActionScript - a SWF can load in a class from a stop()'d MoveClip, and then advance the clip to a frame with a SymbolClass referencing the loaded class.
- Loading branch information
Showing
8 changed files
with
155 additions
and
9 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
22 changes: 22 additions & 0 deletions
22
tests/tests/swfs/avm2/delayed_symbolclass/FourthFrameChild.as
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,22 @@ | ||
package { | ||
|
||
import flash.display.MovieClip; | ||
|
||
|
||
public class FourthFrameChild extends MovieClip { | ||
|
||
public static var DUMMY: String = myFunc(); | ||
|
||
public static function myFunc():String { | ||
trace("In FourthFrameChild class initializer"); | ||
return "FOO"; | ||
} | ||
|
||
public function SecondFrameChild() { | ||
trace("Constructed FourthFrameChild") | ||
} | ||
} | ||
|
||
} | ||
|
||
trace("In FourthFrameChild script initializer"); |
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,40 @@ | ||
package { | ||
import flash.display.MovieClip; | ||
import flash.events.Event; | ||
import flash.utils.getDefinitionByName; | ||
|
||
public class Main extends MovieClip { | ||
public function Main() { | ||
trace("In constructor"); | ||
root.loaderInfo.addEventListener("open", function(e) { | ||
trace("ERROR: Called open event!"); | ||
}); | ||
root.loaderInfo.addEventListener("init", function(e) { | ||
trace("Called init event!"); | ||
}); | ||
root.loaderInfo.addEventListener("complete", function(e) { | ||
trace("Called complete event!"); | ||
}); | ||
|
||
this.addEventListener(Event.ENTER_FRAME, function(e) { | ||
trace("Called enterFrame"); | ||
try { | ||
trace("SecondFrameChild: " + getDefinitionByName("SecondFrameChild")); | ||
} catch (e) { | ||
trace("Caught error in Main enterFrame: " + e); | ||
} | ||
|
||
try { | ||
trace("FourthFrameChild: " + getDefinitionByName("FourthFrameChild")); | ||
} catch (e) { | ||
trace("Caught error in Main enterFrame: " + e); | ||
} | ||
}); | ||
|
||
this.addEventListener(Event.FRAME_CONSTRUCTED, function(e) { | ||
trace("Called frameConstructed"); | ||
}) | ||
trace("Finished constructor"); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/tests/swfs/avm2/delayed_symbolclass/SecondFrameChild.as
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,22 @@ | ||
package { | ||
|
||
import flash.display.MovieClip; | ||
|
||
|
||
public class SecondFrameChild extends MovieClip { | ||
|
||
public static var DUMMY: String = myFunc(); | ||
|
||
public static function myFunc():String { | ||
trace("In SecondFrameChild class initializer"); | ||
return "FOO"; | ||
} | ||
|
||
public function SecondFrameChild() { | ||
trace("Constructed SecondFrameChild") | ||
} | ||
} | ||
|
||
} | ||
|
||
trace("In SecondFrameChild script initializer"); |
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,28 @@ | ||
In constructor | ||
Finished constructor | ||
Called frameConstructed | ||
Main framescript 1 | ||
Called init event! | ||
Called complete event! | ||
In SecondFrameChild class initializer | ||
In SecondFrameChild script initializer | ||
Called enterFrame | ||
SecondFrameChild: [class SecondFrameChild] | ||
In FourthFrameChild class initializer | ||
In FourthFrameChild script initializer | ||
FourthFrameChild: [class FourthFrameChild] | ||
Constructed SecondFrameChild | ||
Called frameConstructed | ||
Main framescript 2 | ||
Called enterFrame | ||
SecondFrameChild: [class SecondFrameChild] | ||
FourthFrameChild: [class FourthFrameChild] | ||
Called frameConstructed | ||
Main framescript 3 - running gotoAndPlay(5) | ||
Called frameConstructed | ||
Main framescript 5 | ||
Called enterFrame | ||
SecondFrameChild: [class SecondFrameChild] | ||
FourthFrameChild: [class FourthFrameChild] | ||
Called frameConstructed | ||
Main framescript 1 |
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 = 4 |