Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions test/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion web/pdf_viewer.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
PDFLinkService,
SimpleLinkService,
} from "./pdf_link_service.js";
import { parseQueryString, ProgressBar } from "./ui_utils.js";
import { PDFSinglePageViewer, PDFViewer } from "./pdf_viewer.js";
import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
import { DownloadManager } from "./download_manager.js";
Expand All @@ -34,7 +35,6 @@ import { PDFFindController } from "./pdf_find_controller.js";
import { PDFHistory } from "./pdf_history.js";
import { PDFPageView } from "./pdf_page_view.js";
import { PDFScriptingManager } from "./pdf_scripting_manager.js";
import { ProgressBar } from "./ui_utils.js";
import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js";
import { TextLayerBuilder } from "./text_layer_builder.js";
import { XfaLayerBuilder } from "./xfa_layer_builder.js";
Expand All @@ -55,6 +55,7 @@ export {
GenericL10n,
LinkTarget,
NullL10n,
parseQueryString,
PDFFindController,
PDFHistory,
PDFLinkService,
Expand Down