File tree Expand file tree Collapse file tree 9 files changed +148
-5
lines changed Expand file tree Collapse file tree 9 files changed +148
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ pub mod capabilities;
6
6
pub mod security;
7
7
pub mod security_domain;
8
8
pub mod system;
9
+ pub mod worker;
10
+ pub mod worker_domain;
9
11
10
12
use crate :: avm2:: activation:: Activation ;
11
13
use crate :: avm2:: parameters:: ParametersExt ;
Original file line number Diff line number Diff line change 1
1
package flash.system {
2
2
import flash.events.EventDispatcher ;
3
+ import __ruffle__.stub_method ;
3
4
4
5
[API ("682" )]
5
6
[Ruffle (Abstract)]
6
7
public final class MessageChannel extends EventDispatcher {
7
- public function MessageChannel () {
8
- super ( );
8
+ public function send ( arg : * , queueLimit : int = - 1 ): void {
9
+ stub_method( "flash.system.MessageChannel" , "send" );
9
10
}
10
11
}
11
12
}
Original file line number Diff line number Diff line change 1
1
package flash.system {
2
+
3
+ import flash.events.Event ;
2
4
import flash.events.EventDispatcher ;
5
+ import flash.system.MessageChannel ;
6
+ import __ruffle__.stub_getter ;
7
+ import __ruffle__.stub_method ;
3
8
4
9
[API ("682" )]
5
10
[Ruffle (Abstract)]
6
11
public final class Worker extends EventDispatcher {
7
12
public static function get isSupported ():Boolean {
8
13
return false ;
9
14
}
15
+
16
+ private static var _current : Worker;
17
+
18
+ public static function get current ():Worker {
19
+ stub_getter("flash.system.Worker" , "current" );
20
+
21
+ if (! _current ) {
22
+ _current = instantiateInternal();
23
+ }
24
+
25
+ return _current ;
26
+ }
27
+
28
+ public native function createMessageChannel(receiver: Worker): MessageChannel;
29
+
30
+ public function setSharedProperty (key :String , value :* ):void {
31
+ stub_method("flash.system.Worker" , "setSharedProperty" );
32
+ }
33
+
34
+ public function getSharedProperty (key :String ):* {
35
+ stub_method("flash.system.Worker" , "getSharedProperty" );
36
+ }
37
+
38
+ public function start ():void {
39
+ this . dispatchEvent (new Event (Event . WORKER_STATE ));
40
+
41
+ stub_method("flash.system.Worker" , "start" );
42
+ }
43
+
44
+ private static native function instantiateInternal(): Worker;
10
45
}
11
46
}
Original file line number Diff line number Diff line change 1
1
package flash.system {
2
+
3
+ import flash.utils.ByteArray ;
4
+ import flash.system.Worker ;
5
+ import __ruffle__.stub_getter ;
6
+
2
7
[API ("680" )] // the docs say 682, that's wrong
3
8
[Ruffle (Abstract)]
4
9
public final class WorkerDomain {
5
- public static const isSupported: Boolean = false ;
10
+ public static function get isSupported ():Boolean {
11
+ return false ;
12
+ }
13
+
14
+ private static var _current : WorkerDomain;
15
+
16
+ public static function get current ():WorkerDomain {
17
+ stub_getter("flash.system.WorkerDomain" , "current" );
18
+
19
+ if (! _current ) {
20
+ _current = instantiateInternal();
21
+ }
22
+
23
+ return _current ;
24
+ }
25
+
26
+ public native function createWorker(swf: ByteArray , giveAppPrivileges: Boolean = false ): Worker;
27
+
28
+ private static native function instantiateInternal(): WorkerDomain;
6
29
}
7
30
}
Original file line number Diff line number Diff line change
1
+ //! `flash.system.Worker` native methods
2
+
3
+ use crate :: avm2:: activation:: Activation ;
4
+ use crate :: avm2:: object:: { MessageChannelObject , WorkerObject } ;
5
+ use crate :: avm2:: parameters:: ParametersExt ;
6
+ use crate :: avm2:: value:: Value ;
7
+ use crate :: avm2:: Error ;
8
+ use crate :: avm2_stub_method;
9
+
10
+ /// Implements `Worker.createMessageChannel`
11
+ pub fn create_message_channel < ' gc > (
12
+ activation : & mut Activation < ' _ , ' gc > ,
13
+ _this : Value < ' gc > ,
14
+ args : & [ Value < ' gc > ] ,
15
+ ) -> Result < Value < ' gc > , Error < ' gc > > {
16
+ avm2_stub_method ! ( activation, "flash.system.Worker" , "createMessageChannel" ) ;
17
+
18
+ let _receiver = args. get_object ( activation, 0 , "receiver" ) ?;
19
+
20
+ let message_channel = MessageChannelObject :: new ( activation) ;
21
+
22
+ Ok ( message_channel. into ( ) )
23
+ }
24
+
25
+ pub fn instantiate_internal < ' gc > (
26
+ activation : & mut Activation < ' _ , ' gc > ,
27
+ _this : Value < ' gc > ,
28
+ _args : & [ Value < ' gc > ] ,
29
+ ) -> Result < Value < ' gc > , Error < ' gc > > {
30
+ let worker = WorkerObject :: new ( activation) ;
31
+
32
+ Ok ( worker. into ( ) )
33
+ }
Original file line number Diff line number Diff line change
1
+ //! `flash.system.WorkerDomain` native methods
2
+
3
+ use crate :: avm2:: activation:: Activation ;
4
+ use crate :: avm2:: object:: { WorkerDomainObject , WorkerObject } ;
5
+ use crate :: avm2:: parameters:: ParametersExt ;
6
+ use crate :: avm2:: value:: Value ;
7
+ use crate :: avm2:: Error ;
8
+ use crate :: avm2_stub_method;
9
+
10
+ /// Implements `WorkerDomain.createWorker`
11
+ pub fn create_worker < ' gc > (
12
+ activation : & mut Activation < ' _ , ' gc > ,
13
+ _this : Value < ' gc > ,
14
+ args : & [ Value < ' gc > ] ,
15
+ ) -> Result < Value < ' gc > , Error < ' gc > > {
16
+ avm2_stub_method ! ( activation, "flash.system.WorkerDomain" , "createWorker" ) ;
17
+
18
+ let _swf = args. get_object ( activation, 0 , "swf" ) ?;
19
+ let _give_app_privileges = args. get_bool ( 1 ) ;
20
+
21
+ let worker = WorkerObject :: new ( activation) ;
22
+
23
+ Ok ( worker. into ( ) )
24
+ }
25
+
26
+ pub fn instantiate_internal < ' gc > (
27
+ activation : & mut Activation < ' _ , ' gc > ,
28
+ _this : Value < ' gc > ,
29
+ _args : & [ Value < ' gc > ] ,
30
+ ) -> Result < Value < ' gc > , Error < ' gc > > {
31
+ let worker_domain = WorkerDomainObject :: new ( activation) ;
32
+
33
+ Ok ( worker_domain. into ( ) )
34
+ }
Original file line number Diff line number Diff line change 1
1
package flash.utils {
2
+
3
+ import __ruffle__.stub_setter ;
4
+
2
5
[Ruffle (InstanceAllocator)]
3
6
public class ByteArray implements IDataInput2 , IDataOutput2 {
4
7
private static var _defaultObjectEncoding : uint = 3 ;
5
8
9
+ private var _shareable : Boolean = false ;
10
+
11
+ [API ("684" )]
12
+ public function set shareable (shareable : Boolean ):void {
13
+ stub_setter("flash.utils.ByteArray" , "shareable" );
14
+
15
+ this . _shareable = shareable;
16
+ }
17
+
18
+ [API ("684" )]
19
+ public function get shareable ():Boolean {
20
+ return this . _shareable ;
21
+ }
22
+
6
23
public static function get defaultObjectEncoding ():uint {
7
24
return _defaultObjectEncoding ;
8
25
}
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ impl<'gc> TObject<'gc> for WorkerDomainObject<'gc> {
40
40
}
41
41
42
42
impl < ' gc > WorkerDomainObject < ' gc > {
43
- #[ allow( dead_code) ]
44
43
pub fn new ( activation : & mut Activation < ' _ , ' gc > ) -> Self {
45
44
let class = activation. avm2 ( ) . classes ( ) . workerdomain ;
46
45
let base = ScriptObjectData :: new ( class) ;
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ impl<'gc> TObject<'gc> for WorkerObject<'gc> {
40
40
}
41
41
42
42
impl < ' gc > WorkerObject < ' gc > {
43
- #[ allow( dead_code) ]
44
43
pub fn new ( activation : & mut Activation < ' _ , ' gc > ) -> Self {
45
44
let class = activation. avm2 ( ) . classes ( ) . worker ;
46
45
let base = ScriptObjectData :: new ( class) ;
You can’t perform that action at this time.
0 commit comments