From c2e9d5d757b69955e2a90ab764d5759737a496a1 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Wed, 25 Mar 2020 17:00:12 -0700 Subject: [PATCH] web: Install plugin spoof immediately on script load Scripts like SWFObject check for the Flash plugin immediately when they load, so we can't defer installing the spoof. Fixes #448. --- web/js-src/public-api.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/js-src/public-api.js b/web/js-src/public-api.js index ef0dfa763..288eef099 100644 --- a/web/js-src/public-api.js +++ b/web/js-src/public-api.js @@ -242,6 +242,15 @@ export class PublicAPI { if (source_name !== undefined && source_api !== undefined) { public_api.register_source(source_name, source_api); + + // Install the faux plugin detection immediately. + // This is necessary because scripts such as SWFObject check for the + // Flash Player immediately when they load. + // TODO: Maybe there's a better place for this. + let polyfills = public_api.config.polyfills; + if (polyfills === undefined || polyfills.includes("plugin-detect")) { + source_api.polyfill(["plugin-detect"]); + } } return public_api;