Skip to content

Commit c5c619a

Browse files
n0samuHerschel
authored andcommitted
web: Correct IANA Flash MIME type
1 parent 4dc4468 commit c5c619a

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

web/packages/core/src/plugin-polyfill.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import {
2+
FLASH_MIMETYPE,
3+
FUTURESPLASH_MIMETYPE,
4+
FLASH7_AND_8_MIMETYPE,
5+
FLASH_MOVIE_MIMETYPE,
6+
} from "./ruffle-player";
7+
18
/**
29
* Replacement object for `MimeTypeArray` that lets us install new fake mime
310
* types.
@@ -162,25 +169,25 @@ export const FLASH_PLUGIN = new RufflePlugin(
162169
);
163170

164171
FLASH_PLUGIN.install({
165-
type: "application/futuresplash",
172+
type: FUTURESPLASH_MIMETYPE,
166173
description: "Shockwave Flash",
167174
suffixes: "spl",
168175
enabledPlugin: FLASH_PLUGIN,
169176
});
170177
FLASH_PLUGIN.install({
171-
type: "application/x-shockwave-flash",
178+
type: FLASH_MIMETYPE,
172179
description: "Shockwave Flash",
173180
suffixes: "swf",
174181
enabledPlugin: FLASH_PLUGIN,
175182
});
176183
FLASH_PLUGIN.install({
177-
type: "application/x-shockwave-flash2-preview",
184+
type: FLASH7_AND_8_MIMETYPE,
178185
description: "Shockwave Flash",
179186
suffixes: "swf",
180187
enabledPlugin: FLASH_PLUGIN,
181188
});
182189
FLASH_PLUGIN.install({
183-
type: "application/vnd.adobe.flash-movie",
190+
type: FLASH_MOVIE_MIMETYPE,
184191
description: "Shockwave Flash",
185192
suffixes: "swf",
186193
enabledPlugin: FLASH_PLUGIN,

web/packages/core/src/ruffle-player.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { swfFileName } from "./swf-file-name";
1919
export const FLASH_MIMETYPE = "application/x-shockwave-flash";
2020
export const FUTURESPLASH_MIMETYPE = "application/futuresplash";
2121
export const FLASH7_AND_8_MIMETYPE = "application/x-shockwave-flash2-preview";
22-
export const FLASH_MOVIE_MIMETYPE = "application/vnd.adobe.flash-movie";
22+
export const FLASH_MOVIE_MIMETYPE = "application/vnd.adobe.flash.movie";
2323
export const FLASH_ACTIVEX_CLASSID =
2424
"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
2525

web/packages/extension/src/content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function isXMLDocument(): boolean {
143143
// Unfortunately, this might still be too late for some websites when using Chrome (issue #969).
144144
// TODO: use plugin-polyfill.ts
145145
injectScriptRaw(
146-
'(function(){class RuffleMimeType{constructor(a,b,c){this.type=a,this.description=b,this.suffixes=c}}class RuffleMimeTypeArray{constructor(a){this.__mimetypes=[],this.__named_mimetypes={};for(let b of a)this.install(b)}install(a){let b=this.__mimetypes.length;this.__mimetypes.push(a),this.__named_mimetypes[a.type]=a,this[a.type]=a,this[b]=a}item(a){return this.__mimetypes[a]}namedItem(a){return this.__named_mimetypes[a]}get length(){return this.__mimetypes.length}}class RufflePlugin extends RuffleMimeTypeArray{constructor(a,b,c,d){super(d),this.name=a,this.description=b,this.filename=c}install(a){a.enabledPlugin||(a.enabledPlugin=this),super.install(a)}}class RufflePluginArray{constructor(a){this.__plugins=[],this.__named_plugins={};for(let b of a)this.install(b)}install(a){let b=this.__plugins.length;this.__plugins.push(a),this.__named_plugins[a.name]=a,this[a.name]=a,this[b]=a}item(a){return this.__plugins[a]}namedItem(a){return this.__named_plugins[a]}refresh(){}get length(){return this.__plugins.length}}const FLASH_PLUGIN=new RufflePlugin("Shockwave Flash","Shockwave Flash 32.0 r0","ruffle.js",[new RuffleMimeType("application/futuresplash","Shockwave Flash","spl"),new RuffleMimeType("application/x-shockwave-flash","Shockwave Flash","swf"),new RuffleMimeType("application/x-shockwave-flash2-preview","Shockwave Flash","swf"),new RuffleMimeType("application/vnd.adobe.flash-movie","Shockwave Flash","swf")]);function install_plugin(a){navigator.plugins.install||Object.defineProperty(navigator,"plugins",{value:new RufflePluginArray(navigator.plugins),writable:!1}),navigator.plugins.install(a),0<a.length&&!navigator.mimeTypes.install&&Object.defineProperty(navigator,"mimeTypes",{value:new RuffleMimeTypeArray(navigator.mimeTypes),writable:!1});for(var b=0;b<a.length;b+=1)navigator.mimeTypes.install(a[b])}install_plugin(FLASH_PLUGIN);})();'
146+
'(function(){class RuffleMimeType{constructor(a,b,c){this.type=a,this.description=b,this.suffixes=c}}class RuffleMimeTypeArray{constructor(a){this.__mimetypes=[],this.__named_mimetypes={};for(let b of a)this.install(b)}install(a){let b=this.__mimetypes.length;this.__mimetypes.push(a),this.__named_mimetypes[a.type]=a,this[a.type]=a,this[b]=a}item(a){return this.__mimetypes[a]}namedItem(a){return this.__named_mimetypes[a]}get length(){return this.__mimetypes.length}}class RufflePlugin extends RuffleMimeTypeArray{constructor(a,b,c,d){super(d),this.name=a,this.description=b,this.filename=c}install(a){a.enabledPlugin||(a.enabledPlugin=this),super.install(a)}}class RufflePluginArray{constructor(a){this.__plugins=[],this.__named_plugins={};for(let b of a)this.install(b)}install(a){let b=this.__plugins.length;this.__plugins.push(a),this.__named_plugins[a.name]=a,this[a.name]=a,this[b]=a}item(a){return this.__plugins[a]}namedItem(a){return this.__named_plugins[a]}refresh(){}get length(){return this.__plugins.length}}const FLASH_PLUGIN=new RufflePlugin("Shockwave Flash","Shockwave Flash 32.0 r0","ruffle.js",[new RuffleMimeType("application/futuresplash","Shockwave Flash","spl"),new RuffleMimeType("application/x-shockwave-flash","Shockwave Flash","swf"),new RuffleMimeType("application/x-shockwave-flash2-preview","Shockwave Flash","swf"),new RuffleMimeType("application/vnd.adobe.flash.movie","Shockwave Flash","swf")]);function install_plugin(a){navigator.plugins.install||Object.defineProperty(navigator,"plugins",{value:new RufflePluginArray(navigator.plugins),writable:!1}),navigator.plugins.install(a),0<a.length&&!navigator.mimeTypes.install&&Object.defineProperty(navigator,"mimeTypes",{value:new RuffleMimeTypeArray(navigator.mimeTypes),writable:!1});for(var b=0;b<a.length;b+=1)navigator.mimeTypes.install(a[b])}install_plugin(FLASH_PLUGIN);})();'
147147
);
148148

149149
await injectScriptURL(utils.runtime.getURL(`dist/ruffle.js?id=${ID}`));

0 commit comments

Comments
 (0)