mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 22:51:25 +08:00
修复执行uToolsapi时Unable to deserialize cloned 的报错
This commit is contained in:
parent
e6df0d579f
commit
777ea261c6
10
src/node_modules/vm2/lib/contextify.js
generated
vendored
10
src/node_modules/vm2/lib/contextify.js
generated
vendored
@ -616,7 +616,15 @@ Contextify.function = (fnc, traps, deepTraps, flags, mock) => {
|
||||
// Set context of all arguments to host's context.
|
||||
args = Decontextify.arguments(args);
|
||||
|
||||
try {
|
||||
try {
|
||||
// fix 'Unable to deserialize cloned data due to invalid or unsupported version' error of utools api
|
||||
if (typeof context == 'object') {
|
||||
var keys = Object.keys(context)
|
||||
if (keys.includes('ubrowser') || keys.includes('goto')) {
|
||||
args = args.map(a => (typeof a == 'object') && JSON.parse(JSON.stringify(a)) || a)
|
||||
}
|
||||
}
|
||||
// end of fix
|
||||
return Contextify.value(fnc.apply(context, args));
|
||||
} catch (e) {
|
||||
throw Contextify.value(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user