See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
) {
    return new Promise(function (resolve, reject) {
      
      var svg = document.createElementNS(SVG_NS, "svg:svg");
      svg.setAttribute("width", viewport.width + "px");
      svg.setAttribute("height", viewport.height + "px");
      
      var 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");
      var style = document.createElement("style");
      var stylePromise = getAnnotationLayerStyle();
      foreignObject.appendChild(style);
      var div = document.createElement("div");
      div.className = "annotationLayer";
      
      stylePromise
        .then(async ([common, overrides]) => {
          style.textContent = common + "\n" + overrides;
          var annotation_viewport = viewport.clone({ dontFlip: true });
          var parameters = {
            viewport: annotation_viewport,
            div,
            annotations,
            page,
            linkService: new SimpleLinkService(),
            imageResourcesPath,
            renderForms,