1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Use the (viewer) parseQueryString helper function in the reference tests

Rather than re-implementing this functionality in the `Driver` class, we can simply re-use the existing `parseQueryString` helper function instead.
This commit is contained in:
Jonas Jenwald 2022-02-19 09:41:04 +01:00
parent 530af48b8e
commit dde4e43b4a
2 changed files with 9 additions and 15 deletions

View file

@ -26,7 +26,7 @@ const {
shadow,
XfaLayer,
} = pdfjsLib;
const { SimpleLinkService } = pdfjsViewer;
const { parseQueryString, SimpleLinkService } = pdfjsViewer;
const WAITING_TIME = 100; // ms
const CMAP_URL = "/build/generic/web/cmaps/";
@ -332,25 +332,18 @@ class Driver {
this.end = options.end;
// Set parameters from the query string
const parameters = this._getQueryStringParameters();
this.browser = parameters.browser;
this.manifestFile = parameters.manifestFile;
this.delay = parameters.delay | 0 || 0;
const params = parseQueryString(window.location.search.substring(1));
this.browser = params.get("browser");
this.manifestFile = params.get("manifestfile");
this.delay = params.get("delay") | 0;
this.inFlightRequests = 0;
this.testFilter = parameters.testFilter
? JSON.parse(parameters.testFilter)
: [];
this.xfaOnly = parameters.xfaOnly === "true";
this.testFilter = JSON.parse(params.get("testfilter") || "[]");
this.xfaOnly = params.get("xfaonly") === "true";
// Create a working canvas
this.canvas = document.createElement("canvas");
}
_getQueryStringParameters() {
const queryString = window.location.search.substring(1);
return Object.fromEntries(new URLSearchParams(queryString).entries());
}
run() {
window.onerror = (message, source, line, column, error) => {
this._info(