Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 5 files). Show all
Unified · Split
| @@ -1873,9 +1873,12 @@ QScriptValue ScriptEngine::require(const QString& moduleId) { · 1872 unmodified lines | |||
| 1873 | // modules get cached in `Script.require.cache` and (similar to Node.js) users can access it | 1873 | // modules get cached in `Script.require.cache` and (similar to Node.js) users can access it |
| 1874 | // to inspect particular entries and invalidate them by deleting the key: | 1874 | // to inspect particular entries and invalidate them by deleting the key: |
| 1875 | // `delete Script.require.cache[Script.require.resolve(moduleId)];` | 1875 | // `delete Script.require.cache[Script.require.resolve(moduleId)];` |
| 1876 | |||
| 1877 | // Check to see if | ||
| 1878 | Setting::Handle<bool> getCachebustSetting {"cachebustScriptRequire", false }; | ||
| 1876 | 1879 | ||
| 1877 | // cacheMeta is just used right now to tell deleted keys apart from undefined ones | 1880 | // cacheMeta is just used right now to tell deleted keys apart from undefined ones |
| 1878 | bool invalidateCache = module.isUndefined() && cacheMeta.property(moduleId).isValid(); | 1881 | bool invalidateCache = getCachebustSetting.get() || (module.isUndefined() && cacheMeta.property(moduleId).isValid()); |
| 1879 | 1882 | ||
| 1880 | // reset the cacheMeta record so invalidation won't apply next time, even if the module fails to load | 1883 | // reset the cacheMeta record so invalidation won't apply next time, even if the module fails to load |
| 1881 | cacheMeta.setProperty(modulePath, QScriptValue()); | 1884 | cacheMeta.setProperty(modulePath, QScriptValue()); |