Skip to content

Commit

Permalink
fix getting of the upload manager (#2947)
Browse files Browse the repository at this point in the history
  • Loading branch information
miherlosev authored Aug 9, 2023
1 parent 5b521ef commit e84b45a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "testcafe-hammerhead",
"description": "A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).",
"version": "31.4.13",
"version": "31.4.14",
"homepage": "https://github.com/DevExpress/testcafe-hammerhead",
"bugs": {
"url": "https://github.com/DevExpress/testcafe-hammerhead/issues"
Expand Down
2 changes: 1 addition & 1 deletion src/client/sandbox/node/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ export default class ElementSandbox extends SandboxBase {
domProcessor.processElement(el, urlUtils.convertToProxyUrl);
}

addFileInputInfo (el: HTMLElement): void {
addFileInputInfo (el: HTMLInputElement): void {
const infoManager = this._uploadSandbox.infoManager;
const files = infoManager.getFiles(el);

Expand Down
6 changes: 4 additions & 2 deletions src/client/sandbox/upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class UploadSandbox extends SandboxBase {
static _getCurrentInfoManager (input: HTMLInputElement) {
const contextWindow = input[INTERNAL_PROPS.processedContext];

return getSandboxBackup(contextWindow).upload.infoManager;
return contextWindow && getSandboxBackup(contextWindow).upload.infoManager;
}

/*eslint-disable max-nested-callbacks */
Expand Down Expand Up @@ -97,7 +97,9 @@ export default class UploadSandbox extends SandboxBase {
}

static getUploadElementValue (input: HTMLInputElement) {
return UploadSandbox._getCurrentInfoManager(input).getValue(input);
const infoManager = UploadSandbox._getCurrentInfoManager(input);

return infoManager ? infoManager.getValue(input) : '';
}

setUploadElementValue (input: HTMLInputElement, value: string): void {
Expand Down
2 changes: 1 addition & 1 deletion src/client/sandbox/upload/info-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default class UploadInfoManager {
return null;
}

getValue (input) {
getValue (input: HTMLInputElement) {
const inputInfo = this.getUploadInfo(input);

// eslint-disable-next-line no-restricted-properties
Expand Down
3 changes: 0 additions & 3 deletions src/client/utils/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ const WRAP_DOCTYPE_RE = /<!doctype([^>]*)>/ig;
const WRAP_DOCTYPE_TEMPLATE = `<${ FAKE_DOCTYPE_TAG_NAME }>$1</${ FAKE_DOCTYPE_TAG_NAME }>`;
const UNWRAP_DOCTYPE_RE = new RegExp(`<${ FAKE_DOCTYPE_TAG_NAME }>([\\S\\s]*?)</${ FAKE_DOCTYPE_TAG_NAME }>`, 'ig');

const FIND_SVG_RE = /<svg\s?[^>]*>/ig;
const FIND_NS_ATTRS_RE = /\s(?:NS[0-9]+:[^"']+('|")[\S\s]*?\1|[^:]+:NS[0-9]+=(?:""|''))/g;

const STORED_ATTRS_SELECTOR = (() => {
const storedAttrs = [];

Expand Down

0 comments on commit e84b45a

Please sign in to comment.