@daisy/ace-axe-runner-electron 1.3.3-alpha.4 → 1.3.3-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +11 -1
- package/lib/init.js +11 -4
- package/package.json +2 -2
- package/src/index.js +13 -3
- package/src/init.js +11 -4
package/lib/index.js
CHANGED
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
const LOG_DEBUG = false;
|
|
4
4
|
const ACE_LOG_PREFIX = "[ACE-AXE]";
|
|
5
5
|
|
|
6
|
+
let cliOption_MILLISECONDS_TIMEOUT_EXTENSION = undefined;
|
|
7
|
+
|
|
6
8
|
function createAxeRunner(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
7
9
|
|
|
8
10
|
return {
|
|
11
|
+
setTimeout: function (ms) {
|
|
12
|
+
try {
|
|
13
|
+
cliOption_MILLISECONDS_TIMEOUT_EXTENSION = parseInt(ms, 10);
|
|
14
|
+
} catch (_e) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
},
|
|
9
18
|
concurrency: CONCURRENT_INSTANCES,
|
|
10
19
|
launch: function () {
|
|
11
20
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner will launch ...`);
|
|
@@ -109,7 +118,8 @@ function createAxeRunner(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
109
118
|
url,
|
|
110
119
|
scripts,
|
|
111
120
|
scriptContents,
|
|
112
|
-
basedir
|
|
121
|
+
basedir,
|
|
122
|
+
cliOption_MILLISECONDS_TIMEOUT_EXTENSION
|
|
113
123
|
});
|
|
114
124
|
});
|
|
115
125
|
}
|
package/lib/init.js
CHANGED
|
@@ -39,6 +39,8 @@ const fsOriginal = require('original-fs');
|
|
|
39
39
|
const isDev = process && process.env && (process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true');
|
|
40
40
|
const showWindow = false;
|
|
41
41
|
|
|
42
|
+
let cliOption_MILLISECONDS_TIMEOUT_EXTENSION = undefined;
|
|
43
|
+
|
|
42
44
|
const LOG_DEBUG_URLS = process.env.LOG_DEBUG_URLS === "1";
|
|
43
45
|
|
|
44
46
|
const LOG_DEBUG = false;
|
|
@@ -198,6 +200,7 @@ function loadUrl(browserWindow) {
|
|
|
198
200
|
|
|
199
201
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner LOAD URL ... ${browserWindow.ace__currentUrlOriginal} => ${rootUrl}${browserWindow.ace__currentUrl}`);
|
|
200
202
|
|
|
203
|
+
browserWindow.ace__TIME_loadURL_ELLAPSED = undefined;
|
|
201
204
|
browserWindow.ace__TIME_loadURL = process.hrtime();
|
|
202
205
|
browserWindow.ace__TIME_executeJavaScript = 0;
|
|
203
206
|
|
|
@@ -235,8 +238,8 @@ function loadUrl(browserWindow) {
|
|
|
235
238
|
} catch (_e) {
|
|
236
239
|
// ignore
|
|
237
240
|
}
|
|
238
|
-
const MILLISECONDS_TIMEOUT_INITIAL = _MILLISECONDS_TIMEOUT_INITIAL ||
|
|
239
|
-
const MILLISECONDS_TIMEOUT_EXTENSION = _MILLISECONDS_TIMEOUT_EXTENSION ||
|
|
241
|
+
const MILLISECONDS_TIMEOUT_INITIAL = _MILLISECONDS_TIMEOUT_INITIAL || 5000; // 5s check to load the browser window web contents + execute Axe checkers
|
|
242
|
+
const MILLISECONDS_TIMEOUT_EXTENSION = cliOption_MILLISECONDS_TIMEOUT_EXTENSION || _MILLISECONDS_TIMEOUT_EXTENSION || 240000; // 240s (4mn) extension (window contents usually loads fast, but Axe runtime takes time...)
|
|
240
243
|
|
|
241
244
|
const timeoutFunc = () => {
|
|
242
245
|
if (browserWindow.ace__replySent) {
|
|
@@ -245,7 +248,7 @@ function loadUrl(browserWindow) {
|
|
|
245
248
|
return;
|
|
246
249
|
}
|
|
247
250
|
|
|
248
|
-
const timeElapsed1 = process.hrtime(browserWindow.ace__TIME_loadURL);
|
|
251
|
+
const timeElapsed1 = browserWindow.ace__TIME_loadURL_ELLAPSED || (browserWindow.ace__TIME_loadURL_ELLAPSED = process.hrtime(browserWindow.ace__TIME_loadURL));
|
|
249
252
|
const timeElapsed2 = browserWindow.ace__TIME_executeJavaScript ? process.hrtime(browserWindow.ace__TIME_executeJavaScript) : [0, 0];
|
|
250
253
|
|
|
251
254
|
if (browserWindow.ace__timeoutExtended) {
|
|
@@ -262,6 +265,7 @@ function loadUrl(browserWindow) {
|
|
|
262
265
|
if (!browserWindow.ace__TIME_executeJavaScript) {
|
|
263
266
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner ${MILLISECONDS_TIMEOUT_INITIAL}ms timeout [[RELOAD]] (${timeElapsed1[0]} seconds + ${timeElapsed1[1]} nanoseconds) (${timeElapsed2[0]} seconds + ${timeElapsed2[1]} nanoseconds) ${browserWindow.ace__currentUrlOriginal} => ${rootUrl}${browserWindow.ace__currentUrl}`);
|
|
264
267
|
|
|
268
|
+
browserWindow.ace__TIME_loadURL_ELLAPSED = undefined;
|
|
265
269
|
browserWindow.ace__TIME_loadURL = process.hrtime();
|
|
266
270
|
browserWindow.ace__TIME_executeJavaScript = 0;
|
|
267
271
|
try {
|
|
@@ -549,6 +553,7 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
549
553
|
const uarel = payload.url;
|
|
550
554
|
const scripts = payload.scripts;
|
|
551
555
|
const scriptContents = payload.scriptContents;
|
|
556
|
+
cliOption_MILLISECONDS_TIMEOUT_EXTENSION = payload.cliOption_MILLISECONDS_TIMEOUT_EXTENSION;
|
|
552
557
|
|
|
553
558
|
if (LOG_DEBUG_URLS) {
|
|
554
559
|
console.log("######## URL 1");
|
|
@@ -653,7 +658,9 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
653
658
|
// (node:5505) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 did-fail-load listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
|
|
654
659
|
browserWindow.webContents.removeListener("did-fail-load", didFailLoadHandler);
|
|
655
660
|
|
|
656
|
-
|
|
661
|
+
browserWindow.ace__TIME_loadURL_ELLAPSED = process.hrtime(browserWindow.ace__TIME_loadURL);
|
|
662
|
+
|
|
663
|
+
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner did-finish-load (${browserWindow.ace__TIME_loadURL_ELLAPSED[0]} seconds + ${browserWindow.ace__TIME_loadURL_ELLAPSED[1]} nanoseconds) ${browserWindow.ace__poolIndex} ${browserWindow.ace__currentUrlOriginal} --- ${browserWindow.ace__currentUrl}`);
|
|
657
664
|
|
|
658
665
|
browserWindow.ace__TIME_executeJavaScript = process.hrtime();
|
|
659
666
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daisy/ace-axe-runner-electron",
|
|
3
|
-
"version": "1.3.3-alpha.
|
|
3
|
+
"version": "1.3.3-alpha.5",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=12.0.0",
|
|
6
6
|
"yarn": "^1.22.0",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"main": "lib/index.js",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@daisy/ace-cli-shared": "1.3.3-alpha.
|
|
26
|
+
"@daisy/ace-cli-shared": "1.3.3-alpha.5",
|
|
27
27
|
"mime-types": "^2.1.35",
|
|
28
28
|
"uuid": "^8.3.2"
|
|
29
29
|
},
|
package/src/index.js
CHANGED
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
const LOG_DEBUG = false;
|
|
4
4
|
const ACE_LOG_PREFIX = "[ACE-AXE]";
|
|
5
5
|
|
|
6
|
+
let cliOption_MILLISECONDS_TIMEOUT_EXTENSION = undefined;
|
|
7
|
+
|
|
6
8
|
function createAxeRunner(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
7
9
|
|
|
8
10
|
return {
|
|
11
|
+
setTimeout: function (ms) {
|
|
12
|
+
try {
|
|
13
|
+
cliOption_MILLISECONDS_TIMEOUT_EXTENSION = parseInt(ms, 10);
|
|
14
|
+
} catch(_e) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
},
|
|
9
18
|
concurrency: CONCURRENT_INSTANCES,
|
|
10
19
|
launch: function () {
|
|
11
20
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner will launch ...`);
|
|
@@ -42,7 +51,7 @@ function createAxeRunner(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
42
51
|
},
|
|
43
52
|
close: function () {
|
|
44
53
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner will close ...`);
|
|
45
|
-
|
|
54
|
+
|
|
46
55
|
// // ipcRenderer
|
|
47
56
|
// eventEmmitter.send('AXE_RUNNER_CLOSE', {});
|
|
48
57
|
// return Promise.resolve();
|
|
@@ -79,7 +88,7 @@ function createAxeRunner(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
79
88
|
},
|
|
80
89
|
run: function (url, scripts, scriptContents, basedir) {
|
|
81
90
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner will run ... ${url}`);
|
|
82
|
-
|
|
91
|
+
|
|
83
92
|
return new Promise((resolve, reject) => {
|
|
84
93
|
// ipcRenderer
|
|
85
94
|
const callback = (event, arg) => {
|
|
@@ -110,10 +119,11 @@ function createAxeRunner(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
110
119
|
scripts,
|
|
111
120
|
scriptContents,
|
|
112
121
|
basedir,
|
|
122
|
+
cliOption_MILLISECONDS_TIMEOUT_EXTENSION,
|
|
113
123
|
});
|
|
114
124
|
});
|
|
115
125
|
}
|
|
116
126
|
};
|
|
117
127
|
}
|
|
118
128
|
|
|
119
|
-
module.exports = { createAxeRunner };
|
|
129
|
+
module.exports = { createAxeRunner };
|
package/src/init.js
CHANGED
|
@@ -39,6 +39,8 @@ const fsOriginal = require('original-fs');
|
|
|
39
39
|
const isDev = process && process.env && (process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true');
|
|
40
40
|
const showWindow = false;
|
|
41
41
|
|
|
42
|
+
let cliOption_MILLISECONDS_TIMEOUT_EXTENSION = undefined;
|
|
43
|
+
|
|
42
44
|
const LOG_DEBUG_URLS = process.env.LOG_DEBUG_URLS === "1";
|
|
43
45
|
|
|
44
46
|
const LOG_DEBUG = false;
|
|
@@ -204,6 +206,7 @@ function loadUrl(browserWindow) {
|
|
|
204
206
|
|
|
205
207
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner LOAD URL ... ${browserWindow.ace__currentUrlOriginal} => ${rootUrl}${browserWindow.ace__currentUrl}`);
|
|
206
208
|
|
|
209
|
+
browserWindow.ace__TIME_loadURL_ELLAPSED = undefined;
|
|
207
210
|
browserWindow.ace__TIME_loadURL = process.hrtime();
|
|
208
211
|
browserWindow.ace__TIME_executeJavaScript = 0;
|
|
209
212
|
|
|
@@ -241,8 +244,8 @@ function loadUrl(browserWindow) {
|
|
|
241
244
|
} catch(_e) {
|
|
242
245
|
// ignore
|
|
243
246
|
}
|
|
244
|
-
const MILLISECONDS_TIMEOUT_INITIAL = _MILLISECONDS_TIMEOUT_INITIAL ||
|
|
245
|
-
const MILLISECONDS_TIMEOUT_EXTENSION = _MILLISECONDS_TIMEOUT_EXTENSION ||
|
|
247
|
+
const MILLISECONDS_TIMEOUT_INITIAL = _MILLISECONDS_TIMEOUT_INITIAL || 5000; // 5s check to load the browser window web contents + execute Axe checkers
|
|
248
|
+
const MILLISECONDS_TIMEOUT_EXTENSION = cliOption_MILLISECONDS_TIMEOUT_EXTENSION || _MILLISECONDS_TIMEOUT_EXTENSION || 240000; // 240s (4mn) extension (window contents usually loads fast, but Axe runtime takes time...)
|
|
246
249
|
|
|
247
250
|
const timeoutFunc = () => {
|
|
248
251
|
if (browserWindow.ace__replySent) {
|
|
@@ -251,7 +254,7 @@ function loadUrl(browserWindow) {
|
|
|
251
254
|
return;
|
|
252
255
|
}
|
|
253
256
|
|
|
254
|
-
const timeElapsed1 = process.hrtime(browserWindow.ace__TIME_loadURL);
|
|
257
|
+
const timeElapsed1 = browserWindow.ace__TIME_loadURL_ELLAPSED || (browserWindow.ace__TIME_loadURL_ELLAPSED = process.hrtime(browserWindow.ace__TIME_loadURL));
|
|
255
258
|
const timeElapsed2 = browserWindow.ace__TIME_executeJavaScript ? process.hrtime(browserWindow.ace__TIME_executeJavaScript) : [0, 0];
|
|
256
259
|
|
|
257
260
|
if (browserWindow.ace__timeoutExtended) {
|
|
@@ -268,6 +271,7 @@ function loadUrl(browserWindow) {
|
|
|
268
271
|
if (!browserWindow.ace__TIME_executeJavaScript) {
|
|
269
272
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner ${MILLISECONDS_TIMEOUT_INITIAL}ms timeout [[RELOAD]] (${timeElapsed1[0]} seconds + ${timeElapsed1[1]} nanoseconds) (${timeElapsed2[0]} seconds + ${timeElapsed2[1]} nanoseconds) ${browserWindow.ace__currentUrlOriginal} => ${rootUrl}${browserWindow.ace__currentUrl}`);
|
|
270
273
|
|
|
274
|
+
browserWindow.ace__TIME_loadURL_ELLAPSED = undefined;
|
|
271
275
|
browserWindow.ace__TIME_loadURL = process.hrtime();
|
|
272
276
|
browserWindow.ace__TIME_executeJavaScript = 0;
|
|
273
277
|
try {
|
|
@@ -570,6 +574,7 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
570
574
|
const uarel = payload.url;
|
|
571
575
|
const scripts = payload.scripts;
|
|
572
576
|
const scriptContents = payload.scriptContents;
|
|
577
|
+
cliOption_MILLISECONDS_TIMEOUT_EXTENSION = payload.cliOption_MILLISECONDS_TIMEOUT_EXTENSION;
|
|
573
578
|
|
|
574
579
|
if (LOG_DEBUG_URLS) {
|
|
575
580
|
console.log("######## URL 1");
|
|
@@ -674,7 +679,9 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
674
679
|
// (node:5505) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 did-fail-load listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
|
|
675
680
|
browserWindow.webContents.removeListener("did-fail-load", didFailLoadHandler);
|
|
676
681
|
|
|
677
|
-
|
|
682
|
+
browserWindow.ace__TIME_loadURL_ELLAPSED = process.hrtime(browserWindow.ace__TIME_loadURL);
|
|
683
|
+
|
|
684
|
+
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner did-finish-load (${browserWindow.ace__TIME_loadURL_ELLAPSED[0]} seconds + ${browserWindow.ace__TIME_loadURL_ELLAPSED[1]} nanoseconds) ${browserWindow.ace__poolIndex} ${browserWindow.ace__currentUrlOriginal} --- ${browserWindow.ace__currentUrl}`);
|
|
678
685
|
|
|
679
686
|
browserWindow.ace__TIME_executeJavaScript = process.hrtime();
|
|
680
687
|
|