Showing the changes to libraries/script-engine/src/qtscript/ScriptEngineQtScript.cpp (1 of 11 files). Show all
Unified · Split
| @@ -229,11 +229,11 @@ bool ScriptEngineQtScript::raiseException(const QScriptValue& exception) { · 228 unmodified lines | |||
| 229 | // we have an active context / JS stack frame so throw the exception per usual | 229 | // we have an active context / JS stack frame so throw the exception per usual |
| 230 | QScriptEngine::currentContext()->throwValue(makeError(exception)); | 230 | QScriptEngine::currentContext()->throwValue(makeError(exception)); |
| 231 | return true; | 231 | return true; |
| 232 | } else if(_manager) { | 232 | } else if (_scriptManager) { |
| 233 | // we are within a pure C++ stack frame (ie: being called directly by other C++ code) | 233 | // we are within a pure C++ stack frame (ie: being called directly by other C++ code) |
| 234 | // in this case no context information is available so just emit the exception for reporting | 234 | // in this case no context information is available so just emit the exception for reporting |
| 235 | QScriptValue thrown = makeError(exception); | 235 | QScriptValue thrown = makeError(exception); |
| 236 | emit _manager->unhandledException(ScriptValue(new ScriptValueQtWrapper(this, std::move(thrown)))); | 236 | emit _scriptManager->unhandledException(ScriptValue(new ScriptValueQtWrapper(this, std::move(thrown)))); |
| 237 | } | 237 | } |
| 238 | return false; | 238 | return false; |
| 239 | } | 239 | } |
| @@ -242,8 +242,8 @@ bool ScriptEngineQtScript::maybeEmitUncaughtException(const QString& debugHint) · 2 unmodified lines | |||
| 242 | if (!IS_THREADSAFE_INVOCATION(thread(), __FUNCTION__)) { | 242 | if (!IS_THREADSAFE_INVOCATION(thread(), __FUNCTION__)) { |
| 243 | return false; | 243 | return false; |
| 244 | } | 244 | } |
| 245 | if (!isEvaluating() && hasUncaughtException() && _manager) { | 245 | if (!isEvaluating() && hasUncaughtException() && _scriptManager) { |
| 246 | emit _manager->unhandledException(cloneUncaughtException(debugHint)); | 246 | emit _scriptManager->unhandledException(cloneUncaughtException(debugHint)); |
| 247 | clearExceptions(); | 247 | clearExceptions(); |
| 248 | return true; | 248 | return true; |
| 249 | } | 249 | } |
| @@ -322,21 +322,21 @@ static void ScriptValueFromQScriptValue(const QScriptValue& src, ScriptValue& de · 72 unmodified lines | |||
| 322 | 322 | ||
| 323 | ScriptEngineQtScript::ScriptEngineQtScript(ScriptManager* scriptManager) : | 323 | ScriptEngineQtScript::ScriptEngineQtScript(ScriptManager* scriptManager) : |
| 324 | QScriptEngine(), | 324 | QScriptEngine(), |
| 325 | _manager(scriptManager), | 325 | _scriptManager(scriptManager), |
| 326 | _arrayBufferClass(new ArrayBufferClass(this)) | 326 | _arrayBufferClass(new ArrayBufferClass(this)) |
| 327 | { | 327 | { |
| 328 | qScriptRegisterMetaType(this, ScriptValueToQScriptValue, ScriptValueFromQScriptValue); | 328 | qScriptRegisterMetaType(this, ScriptValueToQScriptValue, ScriptValueFromQScriptValue); |
| 329 | 329 | ||
| 330 | if (_manager) { | 330 | if (_scriptManager) { |
| 331 | connect(this, &QScriptEngine::signalHandlerException, this, [this](const QScriptValue& exception) { | 331 | connect(this, &QScriptEngine::signalHandlerException, this, [this](const QScriptValue& exception) { |
| 332 | if (hasUncaughtException()) { | 332 | if (hasUncaughtException()) { |
| 333 | // the engine's uncaughtException() seems to produce much better stack traces here | 333 | // the engine's uncaughtException() seems to produce much better stack traces here |
| 334 | emit _manager->unhandledException(cloneUncaughtException("signalHandlerException")); | 334 | emit _scriptManager->unhandledException(cloneUncaughtException("signalHandlerException")); |
| 335 | clearExceptions(); | 335 | clearExceptions(); |
| 336 | } else { | 336 | } else { |
| 337 | // ... but may not always be available -- so if needed we fallback to the passed exception | 337 | // ... but may not always be available -- so if needed we fallback to the passed exception |
| 338 | QScriptValue thrown = makeError(exception); | 338 | QScriptValue thrown = makeError(exception); |
| 339 | emit _manager->unhandledException(ScriptValue(new ScriptValueQtWrapper(this, std::move(thrown)))); | 339 | emit _scriptManager->unhandledException(ScriptValue(new ScriptValueQtWrapper(this, std::move(thrown)))); |
| 340 | } | 340 | } |
| 341 | }, Qt::DirectConnection); | 341 | }, Qt::DirectConnection); |
| 342 | moveToThread(scriptManager->thread()); | 342 | moveToThread(scriptManager->thread()); |
| @@ -649,7 +649,7 @@ ScriptValue ScriptEngineQtScript::evaluateInClosure(const ScriptValue& _closure, · 306 unmodified lines | |||
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | ScriptValue ScriptEngineQtScript::evaluate(const QString& sourceCode, const QString& fileName) { | 651 | ScriptValue ScriptEngineQtScript::evaluate(const QString& sourceCode, const QString& fileName) { |
| 652 | if (_manager && _manager->isStopped()) { | 652 | if (_scriptManager && _scriptManager->isStopped()) { |
| 653 | return undefinedValue(); // bail early | 653 | return undefinedValue(); // bail early |
| 654 | } | 654 | } |
| 655 | 655 | ||
| @@ -692,7 +692,7 @@ ScriptValue ScriptEngineQtScript::evaluate(const QString& sourceCode, const QStr · 36 unmodified lines | |||
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | Q_INVOKABLE ScriptValue ScriptEngineQtScript::evaluate(const ScriptProgramPointer& program) { | 694 | Q_INVOKABLE ScriptValue ScriptEngineQtScript::evaluate(const ScriptProgramPointer& program) { |
| 695 | if (_manager && _manager->isStopped()) { | 695 | if (_scriptManager && _scriptManager->isStopped()) { |
| 696 | return undefinedValue(); // bail early | 696 | return undefinedValue(); // bail early |
| 697 | } | 697 | } |
| 698 | 698 | ||
| @@ -751,7 +751,7 @@ ScriptValue ScriptEngineQtScript::globalObject() const { · 52 unmodified lines | |||
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | ScriptManager* ScriptEngineQtScript::manager() const { | 753 | ScriptManager* ScriptEngineQtScript::manager() const { |
| 754 | return _manager; | 754 | return _scriptManager; |
| 755 | } | 755 | } |
| 756 | 756 | ||
| 757 | ScriptValue ScriptEngineQtScript::newArray(uint length) { | 757 | ScriptValue ScriptEngineQtScript::newArray(uint length) { |