@appium/execute-driver-plugin 3.0.34 → 3.0.36
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-child.d.ts","sourceRoot":"","sources":["../../lib/execute-child.js"],"names":[],"mappings":"AAaA,oEAA+D;AAC/D,4CAA6C;;;;;
|
|
1
|
+
{"version":3,"file":"execute-child.d.ts","sourceRoot":"","sources":["../../lib/execute-child.js"],"names":[],"mappings":"AAaA,oEAA+D;AAC/D,4CAA6C;;;;;gBA8I/B,GAAG;;;;YACH,MAAM;;;;eACN,MAAM;;;cAKN,GAAG;;;;aAMH,GAAG;WACH,GAAG;;;YAKH,GAAG;UACH,MAAM"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.MJSONWP_ELEMENT_KEY = exports.W3C_ELEMENT_KEY = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
9
|
-
const
|
|
9
|
+
const node_vm_1 = __importDefault(require("node:vm"));
|
|
10
10
|
const support_1 = require("appium/support");
|
|
11
11
|
const log = support_1.logger.getLogger('ExecuteDriver Child');
|
|
12
12
|
/**
|
|
@@ -41,30 +41,15 @@ async function runScript(eventParams) {
|
|
|
41
41
|
}
|
|
42
42
|
const { attach } = await import('webdriverio');
|
|
43
43
|
const driver = await attach(driverOpts);
|
|
44
|
-
const fullScript =
|
|
44
|
+
const fullScript = `(async () => {${script}})();`;
|
|
45
45
|
log.info('Running driver script in Node vm');
|
|
46
|
-
const vmCtx = new vm2_1.NodeVM({ timeout: timeoutMs });
|
|
47
|
-
const vmFn = vmCtx.run(fullScript);
|
|
48
46
|
// run the driver script, giving user access to the driver object, a fake
|
|
49
47
|
// console logger, and a promise library
|
|
50
|
-
let result = await
|
|
48
|
+
let result = await node_vm_1.default.runInNewContext(fullScript, { driver, console: consoleFns, Promise: bluebird_1.default }, { timeout: timeoutMs, breakOnSigint: true });
|
|
51
49
|
result = coerceScriptResult(result);
|
|
52
50
|
log.info('Successfully ensured driver script result is appropriate type for return');
|
|
53
51
|
return { result, logs };
|
|
54
52
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Embed a user-generated script inside a method which takes only the
|
|
57
|
-
* predetermined objects we specify
|
|
58
|
-
*
|
|
59
|
-
* @param {string} script - the javascript to execute
|
|
60
|
-
*
|
|
61
|
-
* @return {string} - the full script to execute
|
|
62
|
-
*/
|
|
63
|
-
function buildScript(script) {
|
|
64
|
-
return `module.exports = async function execute (driver, console, Promise) {
|
|
65
|
-
${script}
|
|
66
|
-
}`;
|
|
67
|
-
}
|
|
68
53
|
/**
|
|
69
54
|
* We can get any manner of crazy thing back from a vm executing untrusted
|
|
70
55
|
* code. We might also get WebdriverIO objects that aren't suitable for JSON
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-child.js","sourceRoot":"","sources":["../../lib/execute-child.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,wDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"execute-child.js","sourceRoot":"","sources":["../../lib/execute-child.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,wDAAyB;AACzB,sDAAyB;AACzB,4CAA4C;AAE5C,MAAM,GAAG,GAAG,gBAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;AACpD;;GAEG;AACH,IAAI,IAAI,CAAC;AAET,+EAA+E;AAC/E,wDAAwD;AAC3C,QAAA,eAAe,GAAG,cAAI,CAAC,0BAA0B,CAAC;AAClD,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAE7C;;;;;GAKG;AACH,KAAK,UAAU,SAAS,CAAC,WAAW;IAClC,MAAM,EAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAC,GAAG,WAAW,CAAC;IACpD,IAAI,CAAC,gBAAC,C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4
|
import {logger, util} from 'appium/support';
|
|
5
5
|
|
|
6
6
|
const log = logger.getLogger('ExecuteDriver Child');
|
|
@@ -42,36 +42,23 @@ async function runScript(eventParams) {
|
|
|
42
42
|
|
|
43
43
|
const driver = await attach(driverOpts);
|
|
44
44
|
|
|
45
|
-
const fullScript =
|
|
45
|
+
const fullScript = `(async () => {${script}})();`;
|
|
46
46
|
|
|
47
47
|
log.info('Running driver script in Node vm');
|
|
48
48
|
|
|
49
|
-
const vmCtx = new NodeVM({timeout: timeoutMs});
|
|
50
|
-
const vmFn = vmCtx.run(fullScript);
|
|
51
|
-
|
|
52
49
|
// run the driver script, giving user access to the driver object, a fake
|
|
53
50
|
// console logger, and a promise library
|
|
54
|
-
let result = await
|
|
51
|
+
let result = await vm.runInNewContext(
|
|
52
|
+
fullScript,
|
|
53
|
+
{driver, console: consoleFns, Promise: B},
|
|
54
|
+
{timeout: timeoutMs, breakOnSigint: true},
|
|
55
|
+
);
|
|
55
56
|
|
|
56
57
|
result = coerceScriptResult(result);
|
|
57
58
|
log.info('Successfully ensured driver script result is appropriate type for return');
|
|
58
59
|
return {result, logs};
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
/**
|
|
62
|
-
* Embed a user-generated script inside a method which takes only the
|
|
63
|
-
* predetermined objects we specify
|
|
64
|
-
*
|
|
65
|
-
* @param {string} script - the javascript to execute
|
|
66
|
-
*
|
|
67
|
-
* @return {string} - the full script to execute
|
|
68
|
-
*/
|
|
69
|
-
function buildScript(script) {
|
|
70
|
-
return `module.exports = async function execute (driver, console, Promise) {
|
|
71
|
-
${script}
|
|
72
|
-
}`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
62
|
/**
|
|
76
63
|
* We can get any manner of crazy thing back from a vm executing untrusted
|
|
77
64
|
* code. We might also get WebdriverIO objects that aren't suitable for JSON
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/execute-driver-plugin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.36",
|
|
4
4
|
"description": "Plugin for batching and executing driver commands with Appiums",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -42,8 +42,7 @@
|
|
|
42
42
|
"bluebird": "3.7.2",
|
|
43
43
|
"lodash": "4.17.21",
|
|
44
44
|
"source-map-support": "0.5.21",
|
|
45
|
-
"
|
|
46
|
-
"webdriverio": "8.40.5"
|
|
45
|
+
"webdriverio": "8.40.6"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
48
|
"appium": "^2.0.0-beta.35"
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
"pluginName": "execute-driver",
|
|
60
59
|
"mainClass": "ExecuteDriverPlugin"
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "e3f7bd07f773c42d06b43a69f15e0c8fed0e10aa"
|
|
63
62
|
}
|