From 9ba5f9fa3475bf920c6a647fe741830ce55ab4ff Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Thu, 6 Aug 2020 20:51:57 +0200
Subject: [PATCH] Create an `OptionalContentConfig`-instance once for each
 task, when running the reference test-suite

This avoids the need to make a round-trip to the worker-thread for *every* single page that's being tested, which should thus be more efficient.
---
 test/driver.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/driver.js b/test/driver.js
index efc28063e..2825525ec 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -397,6 +397,8 @@ var Driver = (function DriverClosure() {
           loadingTask.promise.then(
             doc => {
               task.pdfDoc = doc;
+              task.optionalContentConfigPromise = doc.getOptionalContentConfig();
+
               this._nextPage(task, failure);
             },
             err => {
@@ -605,6 +607,7 @@ var Driver = (function DriverClosure() {
                 canvasContext: ctx,
                 viewport,
                 renderInteractiveForms: renderForms,
+                optionalContentConfigPromise: task.optionalContentConfigPromise,
               };
               if (renderPrint) {
                 const annotationStorage = task.annotationStorage;