FLUID-6764: Infusion's jquery.standalone file throws an error when loaded in an AudioWorkletGlobalScope

Metadata

Source
FLUID-6764
Type
Bug
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Colin Clark
Created
2023-03-12T12:47:03.537-0400
Updated
2024-07-22T10:34:59.844-0400
Versions
  1. 4.6
Fixed Versions
N/A
Component
  1. Framework

Description

When Infusion's jquery.standalone.js file is used with an AudioWorkletProcessor, an error occurs on line 35. This is because we refer to "global" without checking first to see if the "global" global variable is actually present. AudioWorkletGlobalScope (and I assume other Worklet scopes, though I haven't tested with any other) are extremely minimal environments that don't even provide a reference to a global scope.

The following refinement to our global scope detection on lines 34-5 solved the problem for me:

var globalScope = typeof window !== "undefined" ? window :
        typeof self !== "undefined" ? self :
        typeof global !== "undefined" ? global : {};