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.
This commit is contained in:
Mike Welsh 2020-03-25 17:00:12 -07:00
parent 353eeec6c3
commit c2e9d5d757
1 changed files with 9 additions and 0 deletions

View File

@ -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;