History

Only whitespace changes

Dale Glass committed 4 years ago

Commit 87ba20e1 parent 3347cc524 files · +183 −183Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 24 files). Show all

Unified · Split

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