@daisy/ace-axe-runner-electron 1.3.3-alpha.2 → 1.3.3-alpha.3
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/bin/ace.js +6 -1
- package/lib/cli.js +11 -0
- package/lib/init.js +7 -5
- package/package.json +3 -3
- package/src/cli.js +11 -0
- package/src/init.js +16 -16
package/bin/ace.js
CHANGED
|
@@ -11,12 +11,17 @@ var path = require('path')
|
|
|
11
11
|
// console.log(__dirname);
|
|
12
12
|
var args = [].concat(path.resolve(__dirname, "../lib/cli.js"), process.argv.slice(2))
|
|
13
13
|
// console.log(args);
|
|
14
|
+
// --no-sandbox
|
|
15
|
+
// --in-process-gpu
|
|
16
|
+
// --disable-software-rasterizer
|
|
17
|
+
// --disable-gpu see app.commandLine.appendSwitch("disable-gpu") in cli.js
|
|
14
18
|
|
|
15
19
|
var child = proc.spawn(electron, args, { stdio: 'inherit', windowsHide: false })
|
|
16
20
|
child.on('close', function (code, signal) {
|
|
17
|
-
if (code === null) {
|
|
21
|
+
if (code === null || code === undefined) {
|
|
18
22
|
console.error(electron, 'exited with signal', signal)
|
|
19
23
|
process.exit(1)
|
|
24
|
+
return;
|
|
20
25
|
}
|
|
21
26
|
process.exit(code)
|
|
22
27
|
})
|
package/lib/cli.js
CHANGED
|
@@ -8,11 +8,22 @@ const app = electron.app;
|
|
|
8
8
|
// NO_HTTP_ADD
|
|
9
9
|
const protocol = electron.protocol;
|
|
10
10
|
|
|
11
|
+
// REMEMBER to keep package.json patchElectronJestRunner* tasks up to date!
|
|
12
|
+
|
|
11
13
|
// Removes the deprecation warning message in the console
|
|
12
14
|
// https://github.com/electron/electron/issues/18397
|
|
13
15
|
// app.allowRendererProcessReuse = true;
|
|
14
16
|
// https://www.electronjs.org/releases/stable#breaking-changes-1400
|
|
15
17
|
|
|
18
|
+
// https://github.com/electron/electron/issues/43415#issuecomment-2308352266
|
|
19
|
+
// https://github.com/electron/electron/issues/28164
|
|
20
|
+
// https://github.com/electron/electron/issues/20702
|
|
21
|
+
// --in-process-gpu ?
|
|
22
|
+
// app.commandLine.appendSwitch("in-process-gpu");
|
|
23
|
+
app.commandLine.appendSwitch("disable-gpu");
|
|
24
|
+
app.disableHardwareAcceleration();
|
|
25
|
+
app.commandLine.appendSwitch("disable-software-rasterizer");
|
|
26
|
+
|
|
16
27
|
const EventEmitter = require('events');
|
|
17
28
|
class ElectronMockMainRendererEmitter extends EventEmitter {}
|
|
18
29
|
const eventEmmitter = new ElectronMockMainRendererEmitter();
|
package/lib/init.js
CHANGED
|
@@ -526,7 +526,9 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
526
526
|
quotas: ["temporary", "persistent", "syncable"],
|
|
527
527
|
storages: ["appcache", "cookies", "filesystem", "indexdb",
|
|
528
528
|
// "localstorage", BLOCKS!?
|
|
529
|
-
"shadercache",
|
|
529
|
+
"shadercache",
|
|
530
|
+
// "websql",
|
|
531
|
+
"serviceworkers"]
|
|
530
532
|
});
|
|
531
533
|
} catch (err) {
|
|
532
534
|
if (LOG_DEBUG) console.log(err);
|
|
@@ -565,7 +567,7 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
565
567
|
console.log("######## URL 3");
|
|
566
568
|
console.log(uarelObj.pathname);
|
|
567
569
|
}
|
|
568
|
-
const full = windowsDrive +
|
|
570
|
+
const full = windowsDrive + decodeURIComponent(uarelObj.pathname);
|
|
569
571
|
if (LOG_DEBUG_URLS) {
|
|
570
572
|
console.log("######## URL 4");
|
|
571
573
|
console.log(full);
|
|
@@ -843,7 +845,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
|
|
|
843
845
|
console.log(">>>>>>>>>> URL 2");
|
|
844
846
|
console.log(ptn);
|
|
845
847
|
}
|
|
846
|
-
const pn =
|
|
848
|
+
const pn = decodeURIComponent(ptn);
|
|
847
849
|
if (LOG_DEBUG_URLS) {
|
|
848
850
|
console.log(">>>>>>>>>> URL 3");
|
|
849
851
|
console.log(pn);
|
|
@@ -919,7 +921,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
|
|
|
919
921
|
console.log(">>>>>>>>>>- URL 2");
|
|
920
922
|
console.log(ptn);
|
|
921
923
|
}
|
|
922
|
-
const pn =
|
|
924
|
+
const pn = decodeURIComponent(ptn);
|
|
923
925
|
if (LOG_DEBUG_URLS) {
|
|
924
926
|
console.log(">>>>>>>>>>- URL 3");
|
|
925
927
|
console.log(pn);
|
|
@@ -973,7 +975,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
|
|
|
973
975
|
|
|
974
976
|
// // const url = new URL(`https://fake.org${req.url}`);
|
|
975
977
|
// // const pathname = url.pathname;
|
|
976
|
-
// const pathname =
|
|
978
|
+
// const pathname = decodeURIComponent(u.pathname);
|
|
977
979
|
|
|
978
980
|
// const filePath = path.join(basedir, pathname);
|
|
979
981
|
// if (filePathsExpressStaticNotExist[filePath]) {
|
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.3",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=12.0.0",
|
|
6
6
|
"yarn": "^1.22.0",
|
|
@@ -23,12 +23,12 @@
|
|
|
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.3",
|
|
27
27
|
"mime-types": "^2.1.35",
|
|
28
28
|
"uuid": "^8.3.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"electron": "^
|
|
31
|
+
"electron": "^33.2.1"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
package/src/cli.js
CHANGED
|
@@ -8,11 +8,22 @@ const app = electron.app;
|
|
|
8
8
|
// NO_HTTP_ADD
|
|
9
9
|
const protocol = electron.protocol;
|
|
10
10
|
|
|
11
|
+
// REMEMBER to keep package.json patchElectronJestRunner* tasks up to date!
|
|
12
|
+
|
|
11
13
|
// Removes the deprecation warning message in the console
|
|
12
14
|
// https://github.com/electron/electron/issues/18397
|
|
13
15
|
// app.allowRendererProcessReuse = true;
|
|
14
16
|
// https://www.electronjs.org/releases/stable#breaking-changes-1400
|
|
15
17
|
|
|
18
|
+
// https://github.com/electron/electron/issues/43415#issuecomment-2308352266
|
|
19
|
+
// https://github.com/electron/electron/issues/28164
|
|
20
|
+
// https://github.com/electron/electron/issues/20702
|
|
21
|
+
// --in-process-gpu ?
|
|
22
|
+
// app.commandLine.appendSwitch("in-process-gpu");
|
|
23
|
+
app.commandLine.appendSwitch("disable-gpu");
|
|
24
|
+
app.disableHardwareAcceleration();
|
|
25
|
+
app.commandLine.appendSwitch("disable-software-rasterizer");
|
|
26
|
+
|
|
16
27
|
const EventEmitter = require('events');
|
|
17
28
|
class ElectronMockMainRendererEmitter extends EventEmitter {}
|
|
18
29
|
const eventEmmitter = new ElectronMockMainRendererEmitter();
|
package/src/init.js
CHANGED
|
@@ -119,7 +119,7 @@ const streamProtocolHandler = async (
|
|
|
119
119
|
|
|
120
120
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} streamProtocolHandler req.url: ${req.url}`);
|
|
121
121
|
const u = new URL(req.url);
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
if (LOG_DEBUG) {
|
|
124
124
|
Object.keys(req.headers).forEach((header) => {
|
|
125
125
|
const val = req.headers[header];
|
|
@@ -211,7 +211,7 @@ function loadUrl(browserWindow) {
|
|
|
211
211
|
clearTimeout(browserWindow.ace__timeout);
|
|
212
212
|
}
|
|
213
213
|
browserWindow.ace__timeout = undefined;
|
|
214
|
-
|
|
214
|
+
|
|
215
215
|
const options = {}; // { extraHeaders: 'pragma: no-cache\n' };
|
|
216
216
|
const uareel = `${rootUrl}${browserWindow.ace__currentUrl}?${HTTP_QUERY_PARAM}=${iHttpReq++}`;
|
|
217
217
|
if (LOG_DEBUG_URLS) {
|
|
@@ -267,7 +267,7 @@ function loadUrl(browserWindow) {
|
|
|
267
267
|
|
|
268
268
|
if (!browserWindow.ace__TIME_executeJavaScript) {
|
|
269
269
|
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
|
-
|
|
270
|
+
|
|
271
271
|
browserWindow.ace__TIME_loadURL = process.hrtime();
|
|
272
272
|
browserWindow.ace__TIME_executeJavaScript = 0;
|
|
273
273
|
try {
|
|
@@ -286,9 +286,9 @@ function loadUrl(browserWindow) {
|
|
|
286
286
|
browserWindow.ace__timeout = setTimeout(timeoutFunc, MILLISECONDS_TIMEOUT_INITIAL);
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
|
|
290
290
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner ${MILLISECONDS_TIMEOUT_INITIAL}ms timeout [[EXTEND]] (${timeElapsed1[0]} seconds + ${timeElapsed1[1]} nanoseconds) (${timeElapsed2[0]} seconds + ${timeElapsed2[1]} nanoseconds) ${browserWindow.ace__currentUrlOriginal} => ${rootUrl}${browserWindow.ace__currentUrl}`);
|
|
291
|
-
|
|
291
|
+
|
|
292
292
|
browserWindow.ace__timeoutExtended = true;
|
|
293
293
|
browserWindow.ace__timeout = setTimeout(timeoutFunc, MILLISECONDS_TIMEOUT_EXTENSION);
|
|
294
294
|
}
|
|
@@ -547,7 +547,7 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
547
547
|
"indexdb",
|
|
548
548
|
// "localstorage", BLOCKS!?
|
|
549
549
|
"shadercache",
|
|
550
|
-
"websql",
|
|
550
|
+
// "websql",
|
|
551
551
|
"serviceworkers",
|
|
552
552
|
],
|
|
553
553
|
});
|
|
@@ -588,7 +588,7 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
588
588
|
console.log("######## URL 3");
|
|
589
589
|
console.log(uarelObj.pathname);
|
|
590
590
|
}
|
|
591
|
-
const full = (windowsDrive +
|
|
591
|
+
const full = (windowsDrive + decodeURIComponent(uarelObj.pathname));
|
|
592
592
|
if (LOG_DEBUG_URLS) {
|
|
593
593
|
console.log("######## URL 4");
|
|
594
594
|
console.log(full);
|
|
@@ -603,7 +603,7 @@ function axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
603
603
|
console.log("######## URL 6");
|
|
604
604
|
console.log(httpUrl);
|
|
605
605
|
}
|
|
606
|
-
|
|
606
|
+
|
|
607
607
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner running ... ${basedir} --- ${uarel} => ${httpUrl}`);
|
|
608
608
|
|
|
609
609
|
function poolPush() {
|
|
@@ -718,7 +718,7 @@ new Promise((resolve, reject) => {
|
|
|
718
718
|
browserWindow.webContents.executeJavaScript(js, true)
|
|
719
719
|
.then((ok) => {
|
|
720
720
|
const timeElapsed = process.hrtime(browserWindow.ace__TIME_executeJavaScript);
|
|
721
|
-
|
|
721
|
+
|
|
722
722
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner done. (${timeElapsed[0]} seconds + ${timeElapsed[1]} nanoseconds) ${browserWindow.ace__poolIndex} ${browserWindow.ace__currentUrlOriginal} --- ${browserWindow.ace__currentUrl}`);
|
|
723
723
|
// if (LOG_DEBUG && ok.axe.violations.length) console.log(ok.axe.url, JSON.stringify(ok, null, 4));
|
|
724
724
|
if (browserWindow.ace__replySent) {
|
|
@@ -870,7 +870,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
|
|
|
870
870
|
console.log(">>>>>>>>>> URL 2");
|
|
871
871
|
console.log(ptn);
|
|
872
872
|
}
|
|
873
|
-
const pn =
|
|
873
|
+
const pn = decodeURIComponent(ptn);
|
|
874
874
|
if (LOG_DEBUG_URLS) {
|
|
875
875
|
console.log(">>>>>>>>>> URL 3");
|
|
876
876
|
console.log(pn);
|
|
@@ -946,7 +946,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
|
|
|
946
946
|
console.log(">>>>>>>>>>- URL 2");
|
|
947
947
|
console.log(ptn);
|
|
948
948
|
}
|
|
949
|
-
const pn =
|
|
949
|
+
const pn = decodeURIComponent(ptn);
|
|
950
950
|
if (LOG_DEBUG_URLS) {
|
|
951
951
|
console.log(">>>>>>>>>>- URL 3");
|
|
952
952
|
console.log(pn);
|
|
@@ -1000,7 +1000,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
|
|
|
1000
1000
|
|
|
1001
1001
|
// // const url = new URL(`https://fake.org${req.url}`);
|
|
1002
1002
|
// // const pathname = url.pathname;
|
|
1003
|
-
// const pathname =
|
|
1003
|
+
// const pathname = decodeURIComponent(u.pathname);
|
|
1004
1004
|
|
|
1005
1005
|
// const filePath = path.join(basedir, pathname);
|
|
1006
1006
|
// if (filePathsExpressStaticNotExist[filePath]) {
|
|
@@ -1170,15 +1170,15 @@ function prepareLaunch(eventEmmitter, CONCURRENT_INSTANCES) {
|
|
|
1170
1170
|
eventEmmitter.on('AXE_RUNNER_LAUNCH', (event, arg) => {
|
|
1171
1171
|
// const payload = eventEmmitter.ace_notElectronIpcMainRenderer ? event : arg;
|
|
1172
1172
|
const sender = eventEmmitter.ace_notElectronIpcMainRenderer ? eventEmmitter : event.sender;
|
|
1173
|
-
|
|
1173
|
+
|
|
1174
1174
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner AXE_RUNNER_LAUNCH ...`);
|
|
1175
|
-
|
|
1175
|
+
|
|
1176
1176
|
axeRunnerInit(eventEmmitter, CONCURRENT_INSTANCES);
|
|
1177
|
-
|
|
1177
|
+
|
|
1178
1178
|
if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} axeRunner sending launched event ...`);
|
|
1179
1179
|
sender.send("AXE_RUNNER_LAUNCH_", {
|
|
1180
1180
|
ok: true
|
|
1181
1181
|
});
|
|
1182
1182
|
});
|
|
1183
1183
|
}
|
|
1184
|
-
module.exports = { prepareLaunch };
|
|
1184
|
+
module.exports = { prepareLaunch };
|