See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
if (task.enableXfa) {
            
            
            
            xfaStyleElement = document.createElement("style");
            document.documentElement
              .getElementsByTagName("head")[0]
              .appendChild(xfaStyleElement);
          }
          const loadingTask = getDocument({
            url: absoluteUrl,
            password: task.password,
            cMapUrl: CMAP_URL,
            cMapPacked: CMAP_PACKED,
            standardFontDataUrl: STANDARD_FONT_DATA_URL,
            disableRange: task.disableRange,
            disableAutoFetch: !task.enableAutoFetch,
            pdfBug: true,
            useSystemFonts: task.useSystemFonts,
            useWorkerFetch: task.useWorkerFetch,
            enableXfa: task.enableXfa,
            styleElement: xfaStyleElement,
          });
          loadingTask.promise.then(
            async doc => {
              if (task.enableXfa) {
                task.fontRules = "";
                for (const rule of xfaStyleElement.sheet.cssRules) {
                  task.fontRules += rule.cssText + "\n";
                }