Skip to content

Commit e84b45a

Browse files
authored
fix getting of the upload manager (#2947)
1 parent 5b521ef commit e84b45a

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "testcafe-hammerhead",
33
"description": "A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).",
4-
"version": "31.4.13",
4+
"version": "31.4.14",
55
"homepage": "https://github.com/DevExpress/testcafe-hammerhead",
66
"bugs": {
77
"url": "https://github.com/DevExpress/testcafe-hammerhead/issues"

src/client/sandbox/node/element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ export default class ElementSandbox extends SandboxBase {
10051005
domProcessor.processElement(el, urlUtils.convertToProxyUrl);
10061006
}
10071007

1008-
addFileInputInfo (el: HTMLElement): void {
1008+
addFileInputInfo (el: HTMLInputElement): void {
10091009
const infoManager = this._uploadSandbox.infoManager;
10101010
const files = infoManager.getFiles(el);
10111011

src/client/sandbox/upload/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class UploadSandbox extends SandboxBase {
3939
static _getCurrentInfoManager (input: HTMLInputElement) {
4040
const contextWindow = input[INTERNAL_PROPS.processedContext];
4141

42-
return getSandboxBackup(contextWindow).upload.infoManager;
42+
return contextWindow && getSandboxBackup(contextWindow).upload.infoManager;
4343
}
4444

4545
/*eslint-disable max-nested-callbacks */
@@ -97,7 +97,9 @@ export default class UploadSandbox extends SandboxBase {
9797
}
9898

9999
static getUploadElementValue (input: HTMLInputElement) {
100-
return UploadSandbox._getCurrentInfoManager(input).getValue(input);
100+
const infoManager = UploadSandbox._getCurrentInfoManager(input);
101+
102+
return infoManager ? infoManager.getValue(input) : '';
101103
}
102104

103105
setUploadElementValue (input: HTMLInputElement, value: string): void {

src/client/sandbox/upload/info-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default class UploadInfoManager {
116116
return null;
117117
}
118118

119-
getValue (input) {
119+
getValue (input: HTMLInputElement) {
120120
const inputInfo = this.getUploadInfo(input);
121121

122122
// eslint-disable-next-line no-restricted-properties

src/client/utils/html.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ const WRAP_DOCTYPE_RE = /<!doctype([^>]*)>/ig;
4545
const WRAP_DOCTYPE_TEMPLATE = `<${ FAKE_DOCTYPE_TAG_NAME }>$1</${ FAKE_DOCTYPE_TAG_NAME }>`;
4646
const UNWRAP_DOCTYPE_RE = new RegExp(`<${ FAKE_DOCTYPE_TAG_NAME }>([\\S\\s]*?)</${ FAKE_DOCTYPE_TAG_NAME }>`, 'ig');
4747

48-
const FIND_SVG_RE = /<svg\s?[^>]*>/ig;
49-
const FIND_NS_ATTRS_RE = /\s(?:NS[0-9]+:[^"']+('|")[\S\s]*?\1|[^:]+:NS[0-9]+=(?:""|''))/g;
50-
5148
const STORED_ATTRS_SELECTOR = (() => {
5249
const storedAttrs = [];
5350

0 commit comments

Comments
 (0)