Revert forceRedownload functionality.

This commit is contained in:
Kalila L 2020-09-17 14:14:32 -04:00
parent 8a007a4edf
commit 8eb12a873b
2 changed files with 3 additions and 6 deletions
libraries/script-engine/src

View file

@ -4,7 +4,6 @@
//
// Created by Brad Hefta-Gaub on 12/14/13.
// Copyright 2013 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -1837,7 +1836,7 @@ QScriptValue ScriptEngine::instantiateModule(const QScriptValue& module, const Q
}
// CommonJS/Node.js like require/module support
QScriptValue ScriptEngine::require(const QString& moduleId, bool forceRedownload) {
QScriptValue ScriptEngine::require(const QString& moduleId) {
qCDebug(scriptengine_module) << "ScriptEngine::require(" << moduleId.left(MAX_DEBUG_VALUE_LENGTH) << ")";
if (!IS_THREADSAFE_INVOCATION(thread(), __FUNCTION__)) {
return unboundNullValue();
@ -1876,7 +1875,7 @@ QScriptValue ScriptEngine::require(const QString& moduleId, bool forceRedownload
// `delete Script.require.cache[Script.require.resolve(moduleId)];`
// cacheMeta is just used right now to tell deleted keys apart from undefined ones
bool invalidateCache = forceRedownload || (module.isUndefined() && cacheMeta.property(moduleId).isValid());
bool invalidateCache = module.isUndefined() && cacheMeta.property(moduleId).isValid();
// reset the cacheMeta record so invalidation won't apply next time, even if the module fails to load
cacheMeta.setProperty(modulePath, QScriptValue());

View file

@ -4,7 +4,6 @@
//
// Created by Brad Hefta-Gaub on 12/14/13.
// Copyright 2013 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -422,11 +421,10 @@ public:
* @function Script.require
* @param {string} module - The module to use. May be a JavaScript file, a JSON file, or the name of a system module such
* as <code>"appUi"</code> (i.e., the "appUi.js" system module JavaScript file).
* @param {boolean} [forceRedownload=false] - Invalidate the cache for this module and redownload it if necessary.
* @returns {object|array} The value assigned to <code>module.exports</code> in the JavaScript file, or the value defined
* in the JSON file.
*/
Q_INVOKABLE QScriptValue require(const QString& moduleId, bool forceRedownload = false);
Q_INVOKABLE QScriptValue require(const QString& moduleId);
/**jsdoc
* @function Script.resetModuleCache