MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / installBootstrap

Method installBootstrap

app/src/UI/Widgets/Painter.cpp:608–631  ·  view source on GitHub ↗

* @brief Installs the JS bridge wrappers and verifies they reached globalThis. */

Source from the content-addressed store, hash-verified

606 * @brief Installs the JS bridge wrappers and verifies they reached globalThis.
607 */
608void Widgets::Painter::installBootstrap()
609{
610 m_bootstrapOk = false;
611
612 auto result = m_engine.evaluate(jsBootstrap(), QStringLiteral("painter_bootstrap.js"));
613 if (result.isError()) [[unlikely]] {
614 setLastError(QStringLiteral("bootstrap: ")
615 + result.property(QStringLiteral("message")).toString() + QStringLiteral(" (line ")
616 + result.property(QStringLiteral("lineNumber")).toString() + QStringLiteral(")"));
617 return;
618 }
619
620 auto global = m_engine.globalObject();
621 const auto bridge = global.property(QStringLiteral("__pp"));
622 const auto ds = global.property(QStringLiteral("datasets"));
623 const auto grp = global.property(QStringLiteral("group"));
624 const auto frm = global.property(QStringLiteral("frame"));
625 if (!bridge.isObject() || !ds.isObject() || !grp.isObject() || !frm.isObject()) [[unlikely]] {
626 setLastError(QStringLiteral("bootstrap: bridge globals missing after evaluate"));
627 return;
628 }
629
630 m_bootstrapOk = true;
631}
632
633/**
634 * @brief Snapshots the ThemeManager palette into a frozen `theme` global.

Callers

nothing calls this directly

Calls 3

jsBootstrapFunction · 0.85
isErrorMethod · 0.80
evaluateMethod · 0.45

Tested by

no test coverage detected