Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 24 files). Show all
Unified · Split
| @@ -139,7 +139,7 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { · 138 unmodified lines | ||
| 139 | 139 | QString fileName = contextInfo.fileName(); |
| 140 | 140 | int lineNumber = contextInfo.lineNumber(); |
| 141 | 141 | QString functionName = contextInfo.functionName(); |
| 142 | − | |
| 142 | + | |
| 143 | 143 | location = functionName; |
| 144 | 144 | if (!fileName.isEmpty()) { |
| 145 | 145 | if (location.isEmpty()) { |
| @@ -155,10 +155,10 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { · 9 unmodified lines | ||
| 155 | 155 | if (location.isEmpty()) { |
| 156 | 156 | location = scriptEngine->getFilename(); |
| 157 | 157 | } |
| 158 | − | |
| 158 | + | |
| 159 | 159 | // give the script engine a chance to notify the system about this message |
| 160 | 160 | scriptEngine->print(message); |
| 161 | − | |
| 161 | + | |
| 162 | 162 | // send the message to debug log |
| 163 | 163 | qCDebug(scriptengine_script, "[%s] %s", qUtf8Printable(location), qUtf8Printable(message)); |
| 164 | 164 | } else { |
| @@ -366,20 +366,20 @@ void ScriptEngine::executeOnScriptThread(std::function<void()> function, const Q · 201 unmodified lines | ||
| 366 | 366 | void ScriptEngine::waitTillDoneRunning(bool shutdown) { |
| 367 | 367 | // Engine should be stopped already, but be defensive |
| 368 | 368 | stop(); |
| 369 | − | |
| 369 | + | |
| 370 | 370 | auto workerThread = thread(); |
| 371 | − | |
| 371 | + | |
| 372 | 372 | if (workerThread == QThread::currentThread()) { |
| 373 | 373 | qCWarning(scriptengine) << "ScriptEngine::waitTillDoneRunning called, but the script is on the same thread:" << getFilename(); |
| 374 | 374 | return; |
| 375 | 375 | } |
| 376 | − | |
| 376 | + | |
| 377 | 377 | if (_isThreaded && workerThread) { |
| 378 | 378 | // We should never be waiting (blocking) on our own thread |
| 379 | 379 | assert(workerThread != QThread::currentThread()); |
| 380 | 380 | |
| 381 | 381 | #if 0 |
| 382 | − // 26 Feb 2021 - Disabled this OSX-specific code because it causes OSX to crash on shutdown; without this code, OSX | |
| 382 | + // 26 Feb 2021 - Disabled this OSX-specific code because it causes OSX to crash on shutdown; without this code, OSX | |
| 383 | 383 | // doesn't crash on shutdown. Qt 5.12.3 and Qt 5.15.2. |
| 384 | 384 | // |
| 385 | 385 | // On mac, don't call QCoreApplication::processEvents() here. This is to prevent |
| @@ -1042,7 +1042,7 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& · 656 unmodified lines | ||
| 1042 | 1042 | }; |
| 1043 | 1043 | |
| 1044 | 1044 | /*@jsdoc |
| 1045 | − * <p>The name of an entity event. When the entity event occurs, any function that has been registered for that event | |
| 1045 | + * <p>The name of an entity event. When the entity event occurs, any function that has been registered for that event | |
| 1046 | 1046 | * via {@link Script.addEventHandler} is called with parameters per the entity event.</p> |
| 1047 | 1047 | * <table> |
| 1048 | 1048 | * <thead> |
| @@ -1338,7 +1338,7 @@ void ScriptEngine::run() { · 289 unmodified lines | ||
| 1338 | 1338 | |
| 1339 | 1339 | emit finished(_fileNameString, qSharedPointerCast<ScriptEngine>(sharedFromThis())); |
| 1340 | 1340 | |
| 1341 | − // Don't leave our local-file-access flag laying around, reset it to false when the scriptengine | |
| 1341 | + // Don't leave our local-file-access flag laying around, reset it to false when the scriptengine | |
| 1342 | 1342 | // thread is finished |
| 1343 | 1343 | hifi::scripting::setLocalAccessSafeThread(false); |
| 1344 | 1344 | _isRunning = false; |
| @@ -1852,7 +1852,7 @@ QScriptValue ScriptEngine::require(const QString& moduleId) { · 507 unmodified lines | ||
| 1852 | 1852 | // modules get cached in `Script.require.cache` and (similar to Node.js) users can access it |
| 1853 | 1853 | // to inspect particular entries and invalidate them by deleting the key: |
| 1854 | 1854 | // `delete Script.require.cache[Script.require.resolve(moduleId)];` |
| 1855 | − | |
| 1855 | + | |
| 1856 | 1856 | // Check to see if we should invalidate the cache based on a user setting. |
| 1857 | 1857 | Setting::Handle<bool> getCachebustSetting {"cachebustScriptRequire", false }; |
| 1858 | 1858 | |
| @@ -2390,25 +2390,25 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 531 unmodified lines | ||
| 2390 | 2390 | |
| 2391 | 2391 | // Entity Script Whitelist toggle check. |
| 2392 | 2392 | Setting::Handle<bool> whitelistEnabled {"private/whitelistEnabled", false }; |
| 2393 | − | |
| 2393 | + | |
| 2394 | 2394 | if (!whitelistEnabled.get()) { |
| 2395 | 2395 | passList = true; |
| 2396 | 2396 | } |
| 2397 | − | |
| 2397 | + | |
| 2398 | 2398 | // Pull SAFEURLS from the Interface.JSON settings. |
| 2399 | 2399 | QVariant raw = Setting::Handle<QVariant>("private/settingsSafeURLS").get(); |
| 2400 | 2400 | QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), Qt::SkipEmptyParts); |
| 2401 | 2401 | safeURLPrefixes += settingsSafeURLS; |
| 2402 | 2402 | // END Pull SAFEURLS from the Interface.JSON settings. |
| 2403 | − | |
| 2403 | + | |
| 2404 | 2404 | // Get current domain whitelist bypass, in case an entire domain is whitelisted. |
| 2405 | 2405 | QString currentDomain = DependencyManager::get<AddressManager>()->getDomainURL().host(); |
| 2406 | − | |
| 2406 | + | |
| 2407 | 2407 | QString domainSafeIP = nodeList->getDomainHandler().getHostname(); |
| 2408 | 2408 | QString domainSafeURL = URL_SCHEME_VIRCADIA + "://" + currentDomain; |
| 2409 | 2409 | for (const auto& str : safeURLPrefixes) { |
| 2410 | 2410 | if (domainSafeURL.startsWith(str) || domainSafeIP.startsWith(str)) { |
| 2411 | − qCDebug(scriptengine) << whitelistPrefix << "Whitelist Bypassed, entire domain is whitelisted. Current Domain Host: " | |
| 2411 | + qCDebug(scriptengine) << whitelistPrefix << "Whitelist Bypassed, entire domain is whitelisted. Current Domain Host: " | |
| 2412 | 2412 | << nodeList->getDomainHandler().getHostname() |
| 2413 | 2413 | << "Current Domain: " << currentDomain; |
| 2414 | 2414 | passList = true; |