File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,15 @@ export const FLASH_PLUGIN = new RufflePlugin(
150
150
"ruffle.js"
151
151
) ;
152
152
153
+ /**
154
+ * A fake plugin designed to allow early detection of if the Ruffle extension is in use.
155
+ */
156
+ export const RUFFLE_EXTENSION = new RufflePlugin (
157
+ "Ruffle Extension" ,
158
+ "Ruffle Extension" ,
159
+ "ruffle.js"
160
+ ) ;
161
+
153
162
FLASH_PLUGIN . install ( {
154
163
type : FUTURESPLASH_MIMETYPE ,
155
164
description : "Shockwave Flash" ,
Original file line number Diff line number Diff line change @@ -199,7 +199,12 @@ export function pluginPolyfill(): void {
199
199
*/
200
200
export function polyfill ( isExt : boolean ) : void {
201
201
isExtension = isExt ;
202
- polyfillFlashInstances ( ) ;
203
- polyfillFrames ( ) ;
204
- initMutationObserver ( ) ;
202
+ const usingExtension =
203
+ navigator . plugins . namedItem ( "Ruffle Extension" ) ?. filename ===
204
+ "ruffle.js" ;
205
+ if ( isExtension || ! usingExtension ) {
206
+ polyfillFlashInstances ( ) ;
207
+ polyfillFrames ( ) ;
208
+ initMutationObserver ( ) ;
209
+ }
205
210
}
Original file line number Diff line number Diff line change 3
3
import {
4
4
installPlugin ,
5
5
FLASH_PLUGIN ,
6
+ RUFFLE_EXTENSION ,
6
7
} from "ruffle-core/dist/plugin-polyfill.js" ;
7
8
8
9
installPlugin ( FLASH_PLUGIN ) ;
10
+ installPlugin ( RUFFLE_EXTENSION ) ;
You can’t perform that action at this time.
0 commit comments