* @brief Installs the JS bridge wrappers and verifies they reached globalThis. */
| 606 | * @brief Installs the JS bridge wrappers and verifies they reached globalThis. |
| 607 | */ |
| 608 | void 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. |
nothing calls this directly
no test coverage detected