* @brief Runs the JS parse function over a text frame. */
| 319 | * @brief Runs the JS parse function over a text frame. |
| 320 | */ |
| 321 | QList<QStringList> DataModel::JsScriptEngine::parseString(const QString& frame) |
| 322 | { |
| 323 | Q_ASSERT(!frame.isEmpty()); |
| 324 | |
| 325 | if (!m_parseFunction.isCallable() || m_disabled) |
| 326 | return {}; |
| 327 | |
| 328 | QJSValueList args; |
| 329 | args << frame; |
| 330 | const auto jsResult = guardedCall(args); |
| 331 | |
| 332 | if (m_watchdog.lastCallTimedOut()) [[unlikely]] { |
| 333 | qWarning() << "[JsScriptEngine] parse() timed out after" << kRuntimeWatchdogMs << "ms"; |
| 334 | (void)noteTimeoutAndCheckDisabled(0); |
| 335 | return {}; |
| 336 | } |
| 337 | |
| 338 | if (jsResult.isError()) [[unlikely]] { |
| 339 | qWarning() << "[JsScriptEngine] JS error:" << jsResult.property("message").toString(); |
| 340 | return {}; |
| 341 | } |
| 342 | |
| 343 | resetTimeoutCounter(); |
| 344 | return convertJsResult(jsResult); |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * @brief Runs the JS parse function over a binary frame. |
nothing calls this directly
no test coverage detected