jsParse: Replace eval()
The evil() function is considered eval, replace it like we already did in looking glass. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2842>
This commit is contained in:
parent
a66ffcfc74
commit
13e20e47bf
@ -197,7 +197,9 @@ function getPropertyNamesFromExpression(expr, commandHeader = '') {
|
|||||||
let obj = {};
|
let obj = {};
|
||||||
if (!isUnsafeExpression(expr)) {
|
if (!isUnsafeExpression(expr)) {
|
||||||
try {
|
try {
|
||||||
obj = eval(commandHeader + expr);
|
const lines = expr.split(';');
|
||||||
|
lines.push(`return ${lines.pop()}`);
|
||||||
|
obj = Function(commandHeader + lines.join(';'))();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user