mozilla / shumway

Shumway is a Flash VM and runtime written in JavaScript
Apache License 2.0
3.68k stars 396 forks source link

Create a WebExtension #2435

Open ExE-Boss opened 7 years ago

ExE-Boss commented 7 years ago

This is being worked on in: ExE‑Boss/mozilla‑shumway#web‑extension

Depends on bug 1457500

See also bug 1451083

With XUL, XPCOM and SDK addons being removed in Firefox 57, it would be nice to have a working WebExtension before then.

From my own experimentation, most of the code in content/web/ is re-useable, except for lines which refer to a URL of a Shumway resource.

Edit: after some testing, this has been resolved and the browser object is now accessible, but we should still use relative URLs instead.

Edit 2: this seems to be broken again (yay…), also see bug 1443253.

Those get changed to use the following snippet: (which has to be used, because the browser namespace is inaccessible from in-page iframes, unless we inject scripts into those through manifest.json)

/**
 * The non-browser specific extension address.
 * @type {string}
 * @author ExE Boss
 */
const extension_url = window.location.protocol + "//" + window.location.host + '/';

/**
 * Converts a relative path within an add-on's install directory to a fully-qualified URL.
 *
 * @param {string} path The path, relative to manifest.json.
 * @return {string} The same result as calling <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/extension/getURL">
 * <code>browser.extension.getURL(path)</code></a>.
 * @see <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/extension/getURL">
 * <code>browser.extension.getURL(path)</code></a>
 * @author ExE Boss
 */
function getURL(path) {
  if (path.charAt(0) === '/')
    path = path.slice(1);

  return extension_url + path;
}

I have done some work on this at ExE-Boss/mozilla-shumway#web-extension, previous attempt has been archived under ExE-Boss/mozilla-shumway#broken/web-extension/take1.

nanonyme commented 7 years ago

@ExE-Boss Did you ever end up continuing on this? Something like this is definitely necessary if this project is not to be completely forgotten. Also imo if this done, should be investigated what's the amount of effort needed for cross-browser support for Shumway.

ExE-Boss commented 7 years ago

I won't be able to dedicate my time to this until at least July, and keep in mind that I also work on NOVA and my own projects (which includes a lot of unannounced stuff).

ROBERT-MCDOWELL commented 7 years ago

I shared the shumway link to some developers, maybe something good will go out soon.

ExE-Boss commented 7 years ago

Also, after some testing, the browser object being nonexistent in moz-extension:// URLs, that aren't the background, options or popup pages, have been resolved in a recent release.

ExE-Boss commented 7 years ago

I have shared this on /r/firefox, hopefully some developers will show up and help this project succeed.

SoniEx2 commented 7 years ago

I see an @ExE-Boss working on a Shumway...

Have you tried talking to Flash devs? e.g. https://twitter.com/MateuszSkutnik creator of http://www.mateuszskutnik.com/submachine/ ?

ExE-Boss commented 7 years ago

@SoniEx2 Yes, I have played and won all the Submachine games. (But this discussion about what games I have played is off-topic)

SoniEx2 commented 7 years ago

I mean go get mateusz to work on shumway

ExE-Boss commented 7 years ago

Mateusz is a Flash game developer, not a JavaScript VM developer.

Shumway is a Flash VM implemented entirely in JavaScript using HTML5 technology.

romulasry commented 5 years ago

Tired on the latest Firefox 62.0.3, and ran into this issue. It would be interesting if there was an update.

mirh commented 5 years ago

Depends on bug 1457500

Content handlers finally landed in 66 nightly

TriMoon commented 5 years ago

Too bad we can't easily test the W.I.P. of this extension yet... Would be nice to have a xpi in the releases section...