From 918a989e729b4e019c005d5b7334c8fd5790b00a Mon Sep 17 00:00:00 2001 From: Miguel Angel Mulero Martinez Date: Mon, 4 Nov 2019 12:46:14 +0100 Subject: [PATCH] Disable Schema validation for ChromeOS --- src/js/tabs/vtx.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/js/tabs/vtx.js b/src/js/tabs/vtx.js index d1d05eef..050b838f 100644 --- a/src/js/tabs/vtx.js +++ b/src/js/tabs/vtx.js @@ -111,20 +111,26 @@ TABS.vtx.initialize = function (callback) { // Load schema const urlVtxSchema = chrome.runtime.getURL(`resources/jsonschema/vtxconfig_schema-${vtxConfig.version}.json`); - fetch(urlVtxSchema) - .then(response => response.json()) - .catch(error => console.error('Error fetching VTX Schema:', error)) - .then(schemaJson => { + if (GUI.Mode === GUI_Modes.ChromeApp) { + // FIXME the ChromeOs don't let us use a Schema Validator because almost all of them use eval, and/or use require + callback_valid(); + } else { + fetch(urlVtxSchema) + .then(response => response.json()) + .catch(error => console.error('Error fetching VTX Schema:', error)) + .then(schemaJson => { - let valid = false; - if (schemaJson !== undefined) { - // Validate - valid = (TABS.vtx.env.validate(schemaJson, vtxConfig) === undefined); + let valid = false; + if (schemaJson !== undefined) { + // Validate + valid = (TABS.vtx.env.validate(schemaJson, vtxConfig) === undefined); + } + + console.log("Validation against schema result:", valid); + valid ? callback_valid() : callback_error(); } - - console.log("Validation against schema result:", valid); - valid ? callback_valid() : callback_error(); - }); + ); + } }