From 85376ad4df5251dc983eb1eaa7c1c0ae205d2847 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 30 Sep 2019 14:54:25 +1000 Subject: [PATCH] minimaws: Chromium doesn't like in-place modification of returned JSON data (nw) --- scripts/minimaws/lib/assets/romident.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/minimaws/lib/assets/romident.js b/scripts/minimaws/lib/assets/romident.js index 0e77d62ca25..6db7a7f221a 100644 --- a/scripts/minimaws/lib/assets/romident.js +++ b/scripts/minimaws/lib/assets/romident.js @@ -164,7 +164,8 @@ function request_dumps(name, group, crc, sha1, url, progress) if (req.status == 200) { var machines = Object.create(null); - if (Object.keys(req.response).length > 0) + var matched = Object.keys(req.response); + if (matched.length > 0) { Object.keys(machine_info).forEach( function (shortname) @@ -174,20 +175,22 @@ function request_dumps(name, group, crc, sha1, url, progress) { machines[shortname] = req.response[shortname].matches; add_matches(table, group.names, req.response[shortname].matches); - delete req.response[shortname]; } else { add_matches(table, group.names, null); } }); - Object.keys(req.response).forEach( + matched.forEach( function (shortname) { - var info = req.response[shortname]; - var table = get_machine_table(shortname, info.description); - machines[shortname] = req.response[shortname].matches; - add_matches(table, group.names, info.matches); + if (!Object.hasOwnProperty.call(machine_info, shortname)) + { + var info = req.response[shortname]; + var table = get_machine_table(shortname, info.description); + machines[shortname] = req.response[shortname].matches; + add_matches(table, group.names, info.matches); + } }); for (var i = 0; i < group.names.length; i++) matched_names.push(group.names[i]);