See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
ctx,
    viewport,
    xfa,
    fontRules,
    annotationStorage,
    isPrint
  ) {
    return new Promise(function (resolve, reject) {
      
      const svg = document.createElementNS(SVG_NS, "svg:svg");
      svg.setAttribute("width", viewport.width + "px");
      svg.setAttribute("height", viewport.height + "px");
      const foreignObject = document.createElementNS(
        SVG_NS,
        "svg:foreignObject"
      );
      foreignObject.setAttribute("x", "0");
      foreignObject.setAttribute("y", "0");
      foreignObject.setAttribute("width", viewport.width + "px");
      foreignObject.setAttribute("height", viewport.height + "px");
      const style = document.createElement("style");
      const stylePromise = getXfaLayerStyle();
      foreignObject.appendChild(style);
      const div = document.createElement("div");
      foreignObject.appendChild(div);
      stylePromise
        .then(async ([cssRules]) => {
          style.textContent = fontRules + "\n" + cssRules;
          XfaLayer.render({