Hacker News new | comments | show | ask | jobs | submit login
Shumway - Mozilla (mozilla.github.io)
156 points by nsmalch 1466 days ago | hide | past | web | 30 comments | favorite

It's a very cool project I've thought about gettinng involved with. My company has a number of complex flash games that will not initialize in shumway, but for toys and small apps it works about half the time -- and that's cool! So far, when it works, performance is about 3x slower.

I work on Shumway, and we would love to get more complex Flash games running. Would you and your company like to help our team get these games running? Performance is a hit or miss, sometimes we can be really fast, sometimes really slow, it all depends on either:

1. We haven't implemented some feature well enough. 2. We can't implement a feature in JavaScript/HTML5 and we have to emulate it in a very slow way. In these cases, we can either improve the Web Platform to support these features natively, or work with various game developers to avoid using them.

We're a small dev team but I'm happy to help out. I've submitted code to moz-central before, but I noticed shumway is in anpther repo. What type of help did you have in mind?

This was discussed on HN a few weeks ago: https://news.ycombinator.com/item?id=6481319

Fun fact: Shumway, was originally based on similar software called Gordon... And who is Gordon Shumway? https://en.wikipedia.org/wiki/ALF_(TV_series)

I am still pushing to name version 0.1 of Servo "Santa Claus Conquers the Martians". :)


The similar software was called Gordon, and was for Flash. :)

Could someone help me understand the logic behind this project?

Actionscript runs in a VM, that's native code. It seems like Mozilla's argument is that the AS VM is buggy and, thus, is/was/could be exploited often, so it's a security liability.

Their solution to this problem (as far as I understood) is to interprete the SWF bytecode using JavaScript/HTML5, because JavaScript runs in a sandbox.

Isn't anyone concerned that this is not the best solution to the problem? What's the difference between bugs in the AS VM and bugs in the JS VM? The JS VM is native code too, I don't see anyone rushing to replace it.

If the JS VM is more mature, then this is just a matter of getting the AS VM to that maturity level. If someone wrote clang while gcc existed for many years, why can't Mozilla focus their efforts on writing a better AS VM, instead of writing an emulation layer?

Given that both AS and JS are ECMAScripts, why can't AS be compiled in a way that allows it to run on the JS VMs?

If the bytecode generated by the AS compiler doesn't match what a JS VM can execute, then, since the AS bytecode will necessarily mimic features available in the language (and the languages are similar), why can't we translate the AS bytecode into JS bytecode?

> If the bytecode generated by the AS compiler doesn't match what a JS VM can execute, then, since the AS bytecode will necessarily mimic features available in the language (and the languages are similar), why can't we translate the AS bytecode into JS bytecode?

That's essentially what Shumway does. Unless things have significantly changed over the last year when I last looked at it, Shumway's AVM2 implementation is a JIT that compiles ActionScript to JavaScript (and thereby produces JS bytecode by going through "eval"). The tricky thing is that, because of extra features that ActionScript has that JS doesn't (namespaces, most notably) it has to speculate and recompile as needed to get good performance. So Shumway isn't an ahead-of-time static JIT, but it is a dynamically recompiling JIT.

One possible advantage is it enables legacy Flash content to work on devices without Flash support like Android and iOS.

Also I guess Mozilla would rather trust themselves with security than a third party with a pretty bad track record in that department.

We do in fact translate AS (AVM2) bytecode into JS source. We can't target JS bytecode because we would like Shumway to run on every browser, not just Firefox. Maintaining one JS VM is a lot easier than dealing with two. Although it is fairly tricky to emulate AS features in JS, it's significantly easier than rewriting / maintaining a VM like Tamarin.

It may be possible to translate Flash bytecode to JavaScript, but an interpreter will almost always be more accurate. In this particular case, being accurate first is important. Performance can be fixed later by adding a JIT-like mode.

This is what Shumway does, it has both an Interpreter and a JIT.

I'm in favour as long as there is a reliable way of turning these things off.

The biggest advantage of Flash is that Flashblock fairly reliably turns it off, so that ads that use Flash for animation don't get a chance to run.

In the absence of Flash, I worry about gobs of marketing JS animating pages with fewer generic ways of turning them off.

I see no reason why flashblock would not work with this. If the embed is has a swf extension then it will be blocked.

Because there is no <embed> tag. This is a pure javascript flash VM.

I actually just turned off Flash and am going to try this for a while, youtube works pretty good so far.

Youtube doesnt seem to work here, I get a "The Adobe Flash Player is required for video playback" message..

I guess you need Flash installed to make Shumway work ?

alternatively, you could try the html5 youtube player http://www.youtube.com/html5

Well, not all videos will work with the HTML5 player.

WOW, those demos run super smooth. This is really cool, I'll be trying the extension out

I assume the extension is Firefox-only? It would be really cool to have Safari support for this.

Shumway runs in every browser, including IE. The extension however is Firefox-only, but it should be easy to make it run in Safari or Chrome. We're just not familiar enough with those code bases to do it ourselves. It involves some intimate knowledge about how to intercept Flash player initialization.

Is it easier if Flash isn't installed? Because I don't have Flash installed at all, which is why I'm interested in Shumway. I have Chrome installed purely to use when I need Flash support.

Since it is javascript i guess it should run anywhere like pdf.js.

Works for me in Chrome 30 on Linux.

Chrome Version 30.0.1599.66, Linux works fine.

How'd you install it? The extension link gives me an .xpi Firefox extension download.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact