Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can I use Shumway's implementation for AVM2 as standalone JavaScript library

137 views
Skip to first unread message

zeev.f...@gmail.com

unread,
May 21, 2015, 9:55:07 AM5/21/15
to mozilla-d...@lists.mozilla.org
Hi,
I'm looking for AVM2 implementation to trace calls from AS3 bytecode file. Is there way to convert Shumway (or at least its AVM2 implementation) from FF extension to standalone (i.e. without Node.js) JavaScript library?

Best Regards,
Ze'ev

Michael Bebenita

unread,
May 21, 2015, 7:52:11 PM5/21/15
to zeev.f...@gmail.com, mozilla-dev-sh.
Yes. AVM2 is a separate module that is independent of the Player.

You can run arbitrary .abc files in the VM by first creating a new security
domain:

https://github.com/mozilla/shumway/blob/master/src/shell/shell.ts#L488

and then executing the .abc file:

https://github.com/mozilla/shumway/blob/master/src/shell/shell.ts#L497

You'll need to include is build/ts/base.js and build/ts/avm2.js. But keep
in mind that this will just give you the ability to run .abc files, if
these files use any Flash APIs, you'll need to run the entire player, not
just AVM2.

If you're interested in accessing the Flash APIs, I can walk you though how
to do that.

- Michael
> _______________________________________________
> dev-shumway mailing list
> dev-s...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-shumway
>

zeev.f...@gmail.com

unread,
Jun 10, 2015, 10:15:12 AM6/10/15
to mozilla-d...@lists.mozilla.org
пятница, 22 мая 2015 г., 2:52:11 UTC+3 пользователь Michael Bebenita написал:
Hi Michael,
First of all thanks for your response !
Now, I have more questions that can be divided to 3 categories (the order is from less to more important): development environment issues, compilation issues and usage in base.js + avm2.js.

The questions mentioned in "environment issues" and "compilation issues" currently are less relevant than question about usage in AVM2 - I added them in order to get some background to procedure describing how I created base.js + avm2.js

However "usage" is critical for me ...

==========================================================
Environment :
==========================================================
1. Development Environment (environment build was based on recommendations from https://github.com/mozilla/shumway/wiki):
1.1 "git clone --recursive https://github.com/mozilla/shumway.git Shumway" didn't work for me because of certificate issues (my system failed to validate certificate related to https scheme), so I got sources as ZIP and installed it at destination place, as result I had with missing ".git" ... when tried "make bootstrap"
1.2 Create development environment for Firefox (Do I need it???) done according to "https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Linux_Prerequisites": bootstrap.py did not work properly, so I installed manually (using chapter deals with RedHat family distributions), but were missing the following libraries: "wireless-tools-devel", "mesa-libGL-devel", "gstreamer-devel", "gstreamer-plugins-base-devel", "pulseaudio-libs-devel", "dbus-glib-devel", "Gconf2-devel" - how that is critical for Shumway compilation ?
1.3 Probably I tried to build system more comprehensive than I need ... may be installation of node.js, grunt, libstdc++ and mercurial will be enough to build Shumway sources or I'm wrong?

==========================================================
2. Compilation:
==========================================================
2.1 "make {bootstrap,install-libs,build-web,build-libs}" and some other options did not work. Does that matter for building procedure ???
2.2 "make -C utils/ install-tamarin-src install-tamarin-tests" does not work: "install-tamarin-src" returns error and "install-tamarin-tests" unsupported option ...
2.3 According to "https://github.com/mozilla/shumway/wiki/Build-System" the "utils/builder/Makefile" is responsible to build all system ... but "utils/builder" directory is missing although running of "grunt build" created "base.js" and "avm2.js" !!!

==========================================================
Usage:
==========================================================
According to your comment I figured out that I can run ABC file in AVM2 using the following logic:
var sec = Shumway.createSecurityDomain(builtinABCPath, null, null);

var buffer = new Uint8Array(read(file, "binary"));
var env = {url: file, app: sec.application};
var abc = new Shumway.ABCFile(env, buffer);
sec.application.loadAndExecuteABC(abc);
var sec = createSecurityDomain(builtinABCPath, null, null);

sec.application.loadAndExecuteABC(abc);

Probably that code may be run from script tag after shell.js script was added to HTML page or not ?
I tried to find something similar in avm2.js but found definition:
"AXApplicationDomain.prototype.loadAndExecuteABC"
May be you can mention very simple example for working code. "Code" - I means HTML with script tags: includes JS lib and script running external ABC file with AVM2.

Best Regards,
Ze'ev
0 new messages