From 74137328343b232e8e6199cef5982fd25ee5414c Mon Sep 17 00:00:00 2001 From: JustinCB Date: Sat, 2 May 2020 10:47:32 -0400 Subject: [PATCH] Add plugin polyfill code to lv0.js (thanks @Toad06 ) --- web/extension/build/js/lv0.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/extension/build/js/lv0.js b/web/extension/build/js/lv0.js index 4403e29e1..56d8efdb5 100644 --- a/web/extension/build/js/lv0.js +++ b/web/extension/build/js/lv0.js @@ -26,10 +26,16 @@ if (!(page_optout||window.RufflePlayer)) { let setup_scriptelem = document.createElement("script"); let setup_src = "var runtime_path = \"" + ext_path + "\";\nvar obfuscated_event_prefix = \"" + - obfuscated_event_prefix + "\";"; + obfuscated_event_prefix + "\";" + + '(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]}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){console.log("installing polyfill");navigator.plugins.install||Object.defineProperty(navigator,"plugins",{value:new RufflePluginArray(navigator.plugins),writable:!1}),navigator.plugins.install(a),0