The goal is to strip out data that can be used by untoward users in copying models, avatars, etc.
Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 36 files). Show all
Unified · Split
| @@ -369,7 +369,6 @@ void ScriptEngine::runInThread() { · 368 unmodified lines | |||
| 369 | Q_ASSERT_X(!_isThreaded, "ScriptEngine::runInThread()", "runInThread should not be called more than once"); | 369 | Q_ASSERT_X(!_isThreaded, "ScriptEngine::runInThread()", "runInThread should not be called more than once"); |
| 370 | 370 | ||
| 371 | if (_isThreaded) { | 371 | if (_isThreaded) { |
| 372 | qCWarning(scriptengine) << "ScriptEngine already running in thread: " << getFilename(); | ||
| 373 | return; | 372 | return; |
| 374 | } | 373 | } |
| 375 | 374 | ||
| @@ -419,10 +418,10 @@ void ScriptEngine::waitTillDoneRunning() { · 43 unmodified lines | |||
| 419 | workerThread->quit(); | 418 | workerThread->quit(); |
| 420 | 419 | ||
| 421 | if (isEvaluating()) { | 420 | if (isEvaluating()) { |
| 422 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); | 421 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting."; |
| 423 | abortEvaluation(); | 422 | abortEvaluation(); |
| 424 | } else { | 423 | } else { |
| 425 | qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename(); | 424 | qCWarning(scriptengine) << "Script Engine has been running too long, throwing."; |
| 426 | auto context = currentContext(); | 425 | auto context = currentContext(); |
| 427 | if (context) { | 426 | if (context) { |
| 428 | context->throwError("Timed out during shutdown"); | 427 | context->throwError("Timed out during shutdown"); |
| @@ -498,7 +497,6 @@ void ScriptEngine::loadURL(const QUrl& scriptURL, bool reload) { · 69 unmodified lines | |||
| 498 | { | 497 | { |
| 499 | static const QString DEBUG_FLAG("#debug"); | 498 | static const QString DEBUG_FLAG("#debug"); |
| 500 | if (QRegularExpression(DEBUG_FLAG).match(scriptContents).hasMatch()) { | 499 | if (QRegularExpression(DEBUG_FLAG).match(scriptContents).hasMatch()) { |
| 501 | qCWarning(scriptengine) << "NOTE: ScriptEngine for " << QUrl(url).fileName() << " will be launched in debug mode"; | ||
| 502 | _debuggable = true; | 500 | _debuggable = true; |
| 503 | } | 501 | } |
| 504 | } | 502 | } |
| @@ -1632,7 +1630,6 @@ QVariantMap ScriptEngine::fetchModuleSource(const QString& modulePath, const boo · 1127 unmodified lines | |||
| 1632 | auto url = modulePath; | 1630 | auto url = modulePath; |
| 1633 | auto status = _status[url]; | 1631 | auto status = _status[url]; |
| 1634 | auto contents = data[url]; | 1632 | auto contents = data[url]; |
| 1635 | qCDebug(scriptengine_module) << "require.fetchModuleSource.onload: " << QUrl(url).fileName() << status << QThread::currentThread(); | ||
| 1636 | if (isStopping()) { | 1633 | if (isStopping()) { |
| 1637 | req["status"] = "Stopped"; | 1634 | req["status"] = "Stopped"; |
| 1638 | req["success"] = false; | 1635 | req["success"] = false; |
| @@ -1752,8 +1749,8 @@ QScriptValue ScriptEngine::require(const QString& moduleId) { · 113 unmodified lines | |||
| 1752 | auto exports = module.property("exports"); | 1749 | auto exports = module.property("exports"); |
| 1753 | if (!invalidateCache && exports.isObject()) { | 1750 | if (!invalidateCache && exports.isObject()) { |
| 1754 | // we have found a cached module -- just need to possibly register it with current parent | 1751 | // we have found a cached module -- just need to possibly register it with current parent |
| 1755 | qCDebug(scriptengine_module) << QString("require - using cached module '%1' for '%2' (loaded: %3)") | 1752 | qCDebug(scriptengine_module) << QString("require - using cached module for '%1' (loaded: %2)") |
| 1756 | .arg(modulePath).arg(moduleId).arg(module.property("loaded").toString()); | 1753 | .arg(moduleId).arg(module.property("loaded").toString()); |
| 1757 | registerModuleWithParent(module, parent); | 1754 | registerModuleWithParent(module, parent); |
| 1758 | maybeEmitUncaughtException("cached module"); | 1755 | maybeEmitUncaughtException("cached module"); |
| 1759 | return exports; | 1756 | return exports; |
| @@ -2138,7 +2135,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 378 unmodified lines | |||
| 2138 | PROFILE_RANGE(script, __FUNCTION__); | 2135 | PROFILE_RANGE(script, __FUNCTION__); |
| 2139 | 2136 | ||
| 2140 | if (isStopping() || DependencyManager::get<ScriptEngines>()->isStopped()) { | 2137 | if (isStopping() || DependencyManager::get<ScriptEngines>()->isStopped()) { |
| 2141 | qCDebug(scriptengine) << "loadEntityScript.start " << entityScript << entityID.toString() | 2138 | qCDebug(scriptengine) << "loadEntityScript.start " << entityID.toString() |
| 2142 | << " but isStopping==" << isStopping() | 2139 | << " but isStopping==" << isStopping() |
| 2143 | << " || engines->isStopped==" << DependencyManager::get<ScriptEngines>()->isStopped(); | 2140 | << " || engines->isStopped==" << DependencyManager::get<ScriptEngines>()->isStopped(); |
| 2144 | return; | 2141 | return; |
| @@ -2163,8 +2160,8 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 18 unmodified lines | |||
| 2163 | // since not reloading, assume that the exact same input would produce the exact same output again | 2160 | // since not reloading, assume that the exact same input would produce the exact same output again |
| 2164 | // note: this state gets reset with "reload all scripts," leaving/returning to a Domain, clear cache, etc. | 2161 | // note: this state gets reset with "reload all scripts," leaving/returning to a Domain, clear cache, etc. |
| 2165 | #ifdef DEBUG_ENTITY_STATES | 2162 | #ifdef DEBUG_ENTITY_STATES |
| 2166 | qCDebug(scriptengine) << QString("loadEntityScript.cancelled entity: %1 script: %2 (previous script failure)") | 2163 | qCDebug(scriptengine) << QString("loadEntityScript.cancelled entity: %1 (previous script failure)") |
| 2167 | .arg(entityID.toString()).arg(entityScript); | 2164 | .arg(entityID.toString()); |
| 2168 | #endif | 2165 | #endif |
| 2169 | updateEntityScriptStatus(entityID, EntityScriptStatus::ERROR_LOADING_SCRIPT, | 2166 | updateEntityScriptStatus(entityID, EntityScriptStatus::ERROR_LOADING_SCRIPT, |
| 2170 | "A previous Entity failed to load using this script URL; reload to try again."); | 2167 | "A previous Entity failed to load using this script URL; reload to try again."); |
| @@ -2173,8 +2170,8 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 2 unmodified lines | |||
| 2173 | } else { | 2170 | } else { |
| 2174 | // another entity is busy loading from this script URL so wait for them to finish | 2171 | // another entity is busy loading from this script URL so wait for them to finish |
| 2175 | #ifdef DEBUG_ENTITY_STATES | 2172 | #ifdef DEBUG_ENTITY_STATES |
| 2176 | qCDebug(scriptengine) << QString("loadEntityScript.deferring[%0] entity: %1 script: %2 (waiting on %3)") | 2173 | qCDebug(scriptengine) << QString("loadEntityScript.deferring[%0] entity: %1 (waiting on %2 )") |
| 2177 | .arg(_deferredEntityLoads.size()).arg(entityID.toString()).arg(entityScript).arg(currentEntityID.toString()); | 2174 | .arg(_deferredEntityLoads.size()).arg(entityID.toString()).arg(currentEntityID.toString()); |
| 2178 | #endif | 2175 | #endif |
| 2179 | _deferredEntityLoads.push_back({ entityID, entityScript }); | 2176 | _deferredEntityLoads.push_back({ entityID, entityScript }); |
| 2180 | return; | 2177 | return; |
| @@ -2188,7 +2185,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 7 unmodified lines | |||
| 2188 | { | 2185 | { |
| 2189 | EntityScriptDetails details; | 2186 | EntityScriptDetails details; |
| 2190 | bool hasEntityScript = getEntityScriptDetails(entityID, details); | 2187 | bool hasEntityScript = getEntityScriptDetails(entityID, details); |
| 2191 | qCDebug(scriptengine) << "loadEntityScript.LOADING: " << entityScript << entityID.toString() | 2188 | qCDebug(scriptengine) << "loadEntityScript.LOADING: " << entityID.toString() |
| 2192 | << "(previous: " << (hasEntityScript ? details.status : EntityScriptStatus::PENDING) << ")"; | 2189 | << "(previous: " << (hasEntityScript ? details.status : EntityScriptStatus::PENDING) << ")"; |
| 2193 | } | 2190 | } |
| 2194 | #endif | 2191 | #endif |
| @@ -2217,7 +2214,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 22 unmodified lines | |||
| 2217 | } | 2214 | } |
| 2218 | executeOnScriptThread([=]{ | 2215 | executeOnScriptThread([=]{ |
| 2219 | #ifdef DEBUG_ENTITY_STATES | 2216 | #ifdef DEBUG_ENTITY_STATES |
| 2220 | qCDebug(scriptengine) << "loadEntityScript.contentAvailable" << status << QUrl(url).fileName() << entityID.toString(); | 2217 | qCDebug(scriptengine) << "loadEntityScript.contentAvailable" << status << entityID.toString(); |
| 2221 | #endif | 2218 | #endif |
| 2222 | if (!isStopping() && hasEntityScriptDetails(entityID)) { | 2219 | if (!isStopping() && hasEntityScriptDetails(entityID)) { |
| 2223 | _contentAvailableQueue[entityID] = { entityID, url, contents, isURL, success, status }; | 2220 | _contentAvailableQueue[entityID] = { entityID, url, contents, isURL, success, status }; |
| @@ -2306,7 +2303,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 82 unmodified lines | |||
| 2306 | setEntityScriptDetails(entityID, newDetails); | 2303 | setEntityScriptDetails(entityID, newDetails); |
| 2307 | 2304 | ||
| 2308 | #ifdef DEBUG_ENTITY_STATES | 2305 | #ifdef DEBUG_ENTITY_STATES |
| 2309 | qCDebug(scriptengine) << "entityScriptContentAvailable -- flagging " << entityScript << " as BAD_SCRIPT_UUID_PLACEHOLDER"; | 2306 | qCDebug(scriptengine) << "entityScriptContentAvailable -- flagging as BAD_SCRIPT_UUID_PLACEHOLDER"; |
| 2310 | #endif | 2307 | #endif |
| 2311 | // flag the original entityScript as unusuable | 2308 | // flag the original entityScript as unusuable |
| 2312 | _occupiedScriptURLs[entityScript] = BAD_SCRIPT_UUID_PLACEHOLDER; | 2309 | _occupiedScriptURLs[entityScript] = BAD_SCRIPT_UUID_PLACEHOLDER; |
| @@ -2352,7 +2349,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 39 unmodified lines | |||
| 2352 | timeout.setSingleShot(true); | 2349 | timeout.setSingleShot(true); |
| 2353 | timeout.start(SANDBOX_TIMEOUT); | 2350 | timeout.start(SANDBOX_TIMEOUT); |
| 2354 | connect(&timeout, &QTimer::timeout, [=, &sandbox]{ | 2351 | connect(&timeout, &QTimer::timeout, [=, &sandbox]{ |
| 2355 | qCDebug(scriptengine) << "ScriptEngine::entityScriptContentAvailable timeout(" << scriptOrURL << ")"; | 2352 | qCDebug(scriptengine) << "ScriptEngine::entityScriptContentAvailable timeout"; |
| 2356 | 2353 | ||
| 2357 | // Guard against infinite loops and non-performant code | 2354 | // Guard against infinite loops and non-performant code |
| 2358 | sandbox.raiseException( | 2355 | sandbox.raiseException( |